Skip to content

Commit c5767d0

Browse files
authored
Pass truncation kwargs to insert_local_tensor (#106)
1 parent b108f68 commit c5767d0

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/treetensornetworks/solvers/update_step.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,16 @@ function local_update(
185185
#end
186186

187187
psi, spec = insert_local_tensor(
188-
psi, phi, region; eigen_perturbation=drho, ortho, normalize, kwargs...
188+
psi,
189+
phi,
190+
region;
191+
eigen_perturbation=drho,
192+
ortho,
193+
normalize,
194+
cutoff,
195+
maxdim,
196+
mindim,
197+
kwargs...,
189198
)
190199

191200
update!(

test/test_treetensornetworks/test_solvers/test_dmrg.jl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ end
112112
cutoff = 1e-12
113113

114114
tooth_lengths = fill(2, 3)
115-
root_vertex = (3, 2)
116115
c = named_comb_tree(tooth_lengths)
117116
s = siteinds("S=1/2", c)
118117

@@ -140,4 +139,19 @@ end
140139
@test inner(psi', H, psi) inner(psi2', Hline, psi2) atol = 1e-5
141140
end
142141

142+
@testset "Regression test: tree truncation" begin
143+
maxdim = 4
144+
nsite = 2
145+
nsweeps = 10
146+
147+
c = named_comb_tree((3, 2))
148+
s = siteinds("S=1/2", c)
149+
os = ITensorNetworks.heisenberg(c)
150+
H = TTN(os, s)
151+
psi = random_ttn(s; link_space=5)
152+
psi = dmrg(H, psi; nsweeps, maxdim, nsite)
153+
154+
@test all(edge_data(linkdims(psi)) .<= maxdim)
155+
end
156+
143157
nothing

test/test_treetensornetworks/test_solvers/test_tdvp.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ end
633633
F = abs(scalar(dag(psix) * contract(psi)))
634634
end
635635

636-
@test norm(Sz_tdvp - Sz_exact) < 1e-5 # broken when rebasing local draft on remote main, fix this
636+
@test norm(Sz_tdvp - Sz_exact) < 1e-5
637637
end
638638

639639
# TODO: apply gates in ITensorNetworks

0 commit comments

Comments
 (0)