def setUp(self): self.size = 8 #dense graph self.dense = G.Dense(self.size) self.dense = self.gen_testcase(self.dense) #sparse graph self.sparse = G.Sparse(self.size) self.sparse = self.gen_testcase(self.sparse) #chimera graph #Note: make sure to use ChimeraGPU (not Chimera) when using GPU since the type between FloatType and GPUFloatType is in general different. self.chimera = G.ChimeraGPU(2, 2) self.chimera = self.gen_chimera_testcase(self.chimera) self.seed_for_spin = 1234 self.seed_for_mc = 5678
def convert_to_dense_graph(self) -> cjg.Dense: """ Convert to cxxjij.graph.Dense class from Python dictionary (h, J) or Q """ N = len(self.indices) ising_int = self.ising_interactions() # cxxjij.graph.dense cxx_dense_ising = cjg.Dense(N) for i in range(N): if ising_int[i, i] != 0.0: cxx_dense_ising[i, i] = ising_int[i, i] for j in range(i + 1, N): if ising_int[i, j] != 0.0: cxx_dense_ising[i, j] = ising_int[i, j] return cxx_dense_ising