def test_add_mpo(self): h = MPO_ham_heis(12) h2 = h + h assert max(h2[6].shape) == 10 h.lower_ind_id = h.upper_ind_id t = h ^ ... h2.upper_ind_id = h2.lower_ind_id t2 = h2 ^ ... assert_allclose(2 * t, t2)
def test_expand_mpo(self): h = MPO_ham_heis(12) assert h.site[0].dtype == float he = h.expand_bond_dimension(13) assert h.site[0].dtype == float assert max(he.site[6].shape) == 13 h.lower_ind_id = h.upper_ind_id t = h ^ ... he.upper_ind_id = he.lower_ind_id te = he ^ ... assert_allclose(t, te)
def test_expand_mpo(self, cyclic, rand_strength): h = MPO_ham_heis(12, cyclic=cyclic) assert h[0].dtype == float he = h.expand_bond_dimension(13, rand_strength=rand_strength) assert h[0].dtype == float assert max(he[6].shape) == 13 if cyclic: assert he.bond_size(0, -1) == 13 h.lower_ind_id = h.upper_ind_id t = h ^ ... he.upper_ind_id = he.lower_ind_id te = he ^ ... assert_allclose(t, te)