diff --git a/quimb/tensor/tensor_approx_spectral.py b/quimb/tensor/tensor_approx_spectral.py index 802ec803..b5ab33b8 100644 --- a/quimb/tensor/tensor_approx_spectral.py +++ b/quimb/tensor/tensor_approx_spectral.py @@ -36,7 +36,7 @@ def construct_lanczos_tridiag_MPO(A, K, v0=None, initial_bond_dim=None, bsz = A.phys_dim()**A.L beta[1] = bsz # == sqrt(prod(A.shape)) - compress_kws = {'max_bond': max_bond, 'method': 'svd'} + compress_kws = {'max_bond': max_bond, 'method': 'svd', "renorm": True} for j in range(1, K + 1): diff --git a/tests/test_tensor/test_belief_propagation/test_l2bp.py b/tests/test_tensor/test_belief_propagation/test_l2bp.py index e669d3b8..3800bbec 100644 --- a/tests/test_tensor/test_belief_propagation/test_l2bp.py +++ b/tests/test_tensor/test_belief_propagation/test_l2bp.py @@ -80,7 +80,7 @@ def test_compress_double_layer_loopy(dtype, damping, update): # compress using basic local compression tn_eager = qtn.tensor_network_apply_op_vec(pepo, peps, contract=True) assert tn_eager.num_tensors == 12 - tn_eager.compress_all_(max_bond=3) + tn_eager.compress_all_(max_bond=3, canonize=False) fid_basic = abs(tn_eager.H @ tn_lazy) # compress using BP diff --git a/tests/test_tensor/test_tensor_1d.py b/tests/test_tensor/test_tensor_1d.py index 0270f53f..a40681ec 100644 --- a/tests/test_tensor/test_tensor_1d.py +++ b/tests/test_tensor/test_tensor_1d.py @@ -298,9 +298,9 @@ def test_compress_mps_right(self): def test_compress_trim_max_bond(self, method): p0 = MPS_rand_state(20, 20) p = p0.copy() - p.compress(method=method) + p.compress(method=method, renorm=True) assert max(p["I4"].shape) == 20 - p.compress(max_bond=13, method=method) + p.compress(max_bond=13, method=method, renorm=True) assert max(p["I4"].shape) == 13 assert_allclose(p.H @ p, p0.H @ p0) diff --git a/tests/test_tensor/test_tensor_core.py b/tests/test_tensor/test_tensor_core.py index 7725c309..e86fda2a 100644 --- a/tests/test_tensor/test_tensor_core.py +++ b/tests/test_tensor/test_tensor_core.py @@ -525,22 +525,30 @@ def test_renorm(self, method): assert fn2 == pytest.approx(385.0) assert trc == pytest.approx(55.0) - tn2 = t.split("a", method="svd", cutoff=0.1, cutoff_mode="rsum2") + tn2 = t.split( + "a", method="svd", cutoff=0.1, renorm=True, cutoff_mode="rsum2" + ) a_fn2 = tn2.H @ tn2 assert qtn.bonds_size(*tn2) == 6 assert a_fn2 == pytest.approx(fn2) - tn2 = t.split("a", method="svd", cutoff=40, cutoff_mode="sum2") + tn2 = t.split( + "a", method="svd", cutoff=40, renorm=True, cutoff_mode="sum2" + ) a_fn2 = tn2.H @ tn2 assert qtn.bonds_size(*tn2) == 6 assert a_fn2 == pytest.approx(fn2) - tn1 = t.split("a", method="svd", cutoff=0.2, cutoff_mode="rsum1") + tn1 = t.split( + "a", method="svd", cutoff=0.2, renorm=True, cutoff_mode="rsum1" + ) a_trc = tn1.trace("a", "b").real assert qtn.bonds_size(*tn1) == 6 assert a_trc == pytest.approx(trc) - tn1 = t.split("a", method="svd", cutoff=11, cutoff_mode="sum1") + tn1 = t.split( + "a", method="svd", cutoff=11, renorm=True, cutoff_mode="sum1" + ) a_trc = tn1.trace("a", "b").real assert qtn.bonds_size(*tn1) == 6 assert a_trc == pytest.approx(trc) @@ -1450,7 +1458,7 @@ def test_compress_between(self, method): B.expand_ind("d", 10) tn = A | B assert A.shared_bond_size(B) == 10 - tn.compress_between("T1", "T2", method=method) + tn.compress_between("T1", "T2", method=method, mode="basic") assert A.shared_bond_size(B) == 5 @pytest.mark.parametrize("method", ["svd", "eig", "isvd", "svds", "rsvd"]) @@ -1458,7 +1466,7 @@ def test_compress_all(self, method): k = MPS_rand_state(10, 7) k += k k /= 2 - k.compress_all_(max_bond=7, method=method) + k.compress_all_(max_bond=7, method=method, mode="basic") assert k.max_bond() == 7 assert_allclose(k.H @ k, 1.0)