Skip to content

Commit 240d2f3

Browse files
committed
Add regression test
1 parent fca28ef commit 240d2f3

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

test/solvers/test_eigsolve.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Graphs: dst, edges, src, vertices
22
using ITensorMPS: OpSum
3-
using ITensorNetworks: dmrg, siteinds, ttn
3+
using ITensorNetworks: SweepIterator, dmrg, siteinds, ttn
44
using ITensors
55
using Suppressor: @capture_out
66
using TensorOperations: TensorOperations
@@ -73,6 +73,17 @@ include("utilities/tree_graphs.jl")
7373
(outputlevel >= 1) && println("2-site DMRG energy = ", E)
7474
@test E Ex atol = 1.0e-5
7575

76+
#
77+
# Test ability to pass custom sweep_callback
78+
# (Regression test for PR #304)
79+
#
80+
sweep_count = 0
81+
function sweep_callback(sweep_iter::SweepIterator; kws...)
82+
return sweep_count += 1
83+
end
84+
dmrg(H, psi0; factorize_kwargs, nsweeps, outputlevel, sweep_callback)
85+
@test sweep_count == nsweeps
86+
7687
#
7788
# Test that outputlevel > 0 generates output
7889
# and outputlevel == 0 generates no output

0 commit comments

Comments
 (0)