Skip to content

Commit

Permalink
tests: change random-greedy -> auto-hq
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Oct 17, 2023
1 parent c1eca61 commit 1203116
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/test_tensor/test_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def heis_pbc():
H = qtn.MPO_ham_heis(L, cyclic=True).astype(dtype)

def norm_fn(psi):
factor = (psi & psi).contract(all, optimize='random-greedy')
factor = (psi & psi).contract(all, optimize="auto-hq")
return psi / factor**0.5

def loss_fn(psi, H):
k, H, b = qtn.tensor_network_align(psi, H, psi)
energy = (k & H & b).contract(all, optimize='random-greedy')
energy = (k & H & b).contract(all, optimize="auto-hq")
return energy

en_ex = qu.groundenergy(qu.ham_heis(L, cyclic=True, sparse=True))
Expand All @@ -102,12 +102,12 @@ def ham_mbl_pbc_complex():
H = qtn.MPO_ham_mbl(L, **ham_opts).astype(dtype)

def norm_fn(psi):
factor = (psi.H & psi).contract(all, optimize='random-greedy')
factor = (psi.H & psi).contract(all, optimize="auto-hq")
return psi * factor**-0.5

def loss_fn(psi, H):
k, H, b = qtn.tensor_network_align(psi, H, psi.H)
energy = (k & H & b).contract(all, optimize='random-greedy')
energy = (k & H & b).contract(all, optimize="auto-hq")
return real(energy)

en_ex = qu.groundenergy(qu.ham_mbl(L, sparse=True, **ham_opts))
Expand Down
8 changes: 4 additions & 4 deletions tests/test_tensor/test_tensor_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_basic_rand(self, Lx, Ly):
assert isinstance(psi[f"I{i},{j}"], qtn.Tensor)

if Lx == Ly == 3:
psi_dense = psi.to_qarray(optimize="random-greedy")
psi_dense = psi.to_qarray(optimize="auto-hq")
assert psi_dense.shape == (512, 1)

psi.show()
Expand Down Expand Up @@ -392,7 +392,7 @@ def test_compute_local_expectation_one_sites(self, mode, normalized):
)
ex = qu.expec(A, k)

opts = dict(cutoff=2e-3, max_bond=9, contract_optimize="random-greedy")
opts = dict(cutoff=2e-3, max_bond=9, contract_optimize="auto-hq")
e = peps.compute_local_expectation(
terms, mode=mode, normalized=normalized, **opts
)
Expand All @@ -417,7 +417,7 @@ def test_compute_local_expectation_two_sites(self, mode, normalized):
normalized=normalized,
cutoff=2e-3,
max_bond=16,
contract_optimize="random-greedy",
contract_optimize="auto-hq",
)

# compute 2x1 and 1x2 plaquettes separately
Expand Down Expand Up @@ -488,7 +488,7 @@ def test_basic_rand(self, Lx, Ly):
assert isinstance(X[f"I{i},{j}"], qtn.Tensor)

if Lx == Ly == 3:
X_dense = X.to_qarray(optimize="random-greedy")
X_dense = X.to_qarray(optimize="auto-hq")
assert X_dense.shape == (512, 512)
assert qu.isherm(X_dense)

Expand Down

0 comments on commit 1203116

Please sign in to comment.