Skip to content

Commit 40ccca5

Browse files
committed
Add tests
1 parent e9cea45 commit 40ccca5

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

test/algorithms.jl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,18 +430,28 @@ end
430430
@testset "leading_boundary" verbose = true begin
431431
tol = 1e-4
432432
verbosity = verbosity_conv
433+
D = 10
434+
D1 = 13
433435
algs = [VUMPS(; tol, verbosity), VOMPS(; tol, verbosity),
434-
GradientGrassmann(; tol, verbosity)]
436+
GradientGrassmann(; tol, verbosity), IDMRG(; tol, verbosity),
437+
IDMRG2(; tol, verbosity, trscheme=truncdim(D1))]
435438
mpo = force_planar(classical_ising())
436439

437-
ψ₀ = InfiniteMPS([ℙ^2], [ℙ^10])
440+
ψ₀ = InfiniteMPS([ℙ^2], [ℙ^D])
438441
@testset "Infinite $i" for (i, alg) in enumerate(algs)
439-
ψ, envs = leading_boundary(ψ₀, mpo, alg)
440-
ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme=truncdim(3)), envs)
441-
ψ, envs = leading_boundary(ψ, mpo, alg)
442-
443-
@test dim(space(ψ.AL[1, 1], 1)) == dim(space(ψ₀.AL[1, 1], 1)) + 3
444-
@test expectation_value(ψ, mpo, envs) 2.5337 atol = 1e-3
442+
if alg isa IDMRG2
443+
ψ2 = repeat(ψ₀, 2)
444+
mpo2 = repeat(mpo, 2)
445+
ψ, envs = leading_boundary(ψ2, mpo2, alg)
446+
@test dim(space(ψ.AL[1, 1], 1)) == dim(space(ψ₀.AL[1, 1], 1)) + (D1 - D)
447+
@test expectation_value(ψ, mpo2, envs) 2.5337^2 atol = 1e-3
448+
else
449+
ψ, envs = leading_boundary(ψ₀, mpo, alg)
450+
ψ, envs = changebonds(ψ, mpo, OptimalExpand(; trscheme=truncdim(D1 - D)), envs)
451+
ψ, envs = leading_boundary(ψ, mpo, alg)
452+
@test dim(space(ψ.AL[1, 1], 1)) == dim(space(ψ₀.AL[1, 1], 1)) + (D1 - D)
453+
@test expectation_value(ψ, mpo, envs) 2.5337 atol = 1e-3
454+
end
445455
end
446456
end
447457

0 commit comments

Comments
 (0)