@@ -47,7 +47,7 @@ module TestAlgorithms
4747 @testset " DMRG2" begin
4848 ψ₀ = FiniteMPS (randn, ComplexF64, 10 , ℙ^ 2 , ℙ^ D)
4949 v₀ = variance (ψ₀, H)
50- trscheme = truncdim (floor (Int, D * 1.5 ))
50+ trscheme = truncrank (floor (Int, D * 1.5 ))
5151 # test logging
5252 ψ, envs, δ = find_groundstate (
5353 ψ₀, H, DMRG2 (; verbosity = verbosity_full, maxiter = 2 , trscheme)
@@ -133,7 +133,7 @@ module TestAlgorithms
133133 ψ = repeat (InfiniteMPS (ℙ^ 2 , ℙ^ D), 2 )
134134 H = repeat (H_ref, 2 )
135135
136- trscheme = truncbelow ( 1.0e-8 )
136+ trscheme = trunctol (; atol = 1.0e-8 )
137137
138138 # test logging
139139 ψ, envs, δ = find_groundstate (
@@ -225,7 +225,7 @@ module TestAlgorithms
225225
226226 @testset " DMRG2" begin
227227 # test logging passes
228- trscheme = truncdim (floor (Int, D * 1.5 ))
228+ trscheme = truncrank (floor (Int, D * 1.5 ))
229229 ψ, envs, δ = find_groundstate (
230230 ψ₀, H_lazy, DMRG2 (; tol, verbosity = verbosity_full, maxiter = 1 , trscheme)
231231 )
@@ -303,7 +303,7 @@ module TestAlgorithms
303303 H_lazy′ = repeat (H_lazy, 2 )
304304 H′ = repeat (H, 2 )
305305
306- trscheme = truncdim (floor (Int, D * 1.5 ))
306+ trscheme = truncrank (floor (Int, D * 1.5 ))
307307 # test logging passes
308308 ψ, envs, δ = find_groundstate (
309309 ψ₀′, H_lazy′, IDMRG2 (; tol, verbosity = verbosity_full, maxiter = 2 , trscheme)
@@ -332,7 +332,7 @@ module TestAlgorithms
332332
333333 @testset " timestep" verbose = true begin
334334 dt = 0.1
335- algs = [TDVP (), TDVP2 (; trscheme = truncdim (10 ))]
335+ algs = [TDVP (), TDVP2 (; trscheme = truncrank (10 ))]
336336 L = 10
337337
338338 H = force_planar (heisenberg_XXX (Trivial, Float64; spin = 1 // 2 , L))
@@ -410,7 +410,7 @@ module TestAlgorithms
410410
411411 @testset " time_evolve" verbose = true begin
412412 t_span = 0 : 0.1 : 0.1
413- algs = [TDVP (), TDVP2 (; trscheme = truncdim (10 ))]
413+ algs = [TDVP (), TDVP2 (; trscheme = truncrank (10 ))]
414414
415415 L = 10
416416 H = force_planar (heisenberg_XXX (; spin = 1 // 2 , L))
@@ -442,7 +442,7 @@ module TestAlgorithms
442442 algs = [
443443 VUMPS (; tol, verbosity), VOMPS (; tol, verbosity),
444444 GradientGrassmann (; tol, verbosity), IDMRG (; tol, verbosity),
445- IDMRG2 (; tol, verbosity, trscheme = truncdim (D1)),
445+ IDMRG2 (; tol, verbosity, trscheme = truncrank (D1)),
446446 ]
447447 mpo = force_planar (classical_ising ())
448448
@@ -456,7 +456,7 @@ module TestAlgorithms
456456 @test expectation_value (ψ, mpo2, envs) ≈ 2.5337 ^ 2 atol = 1.0e-3
457457 else
458458 ψ, envs = leading_boundary (ψ₀, mpo, alg)
459- ψ, envs = changebonds (ψ, mpo, OptimalExpand (; trscheme = truncdim (D1 - D)), envs)
459+ ψ, envs = changebonds (ψ, mpo, OptimalExpand (; trscheme = truncrank (D1 - D)), envs)
460460 ψ, envs = leading_boundary (ψ, mpo, alg)
461461 @test dim (space (ψ. AL[1 , 1 ], 1 )) == dim (space (ψ₀. AL[1 , 1 ], 1 )) + (D1 - D)
462462 @test expectation_value (ψ, mpo, envs) ≈ 2.5337 atol = 1.0e-3
@@ -524,7 +524,7 @@ module TestAlgorithms
524524 # find energy with normal dmrg
525525 for gsalg in (
526526 DMRG (; verbosity, tol = 1.0e-6 ),
527- DMRG2 (; verbosity, tol = 1.0e-6 , trscheme = truncbelow ( 1.0e-4 )),
527+ DMRG2 (; verbosity, tol = 1.0e-6 , trscheme = trunctol (; atol = 1.0e-4 )),
528528 )
529529 energies_dm, _ = @inferred excitations (H, FiniteExcited (; gsalg), ψ)
530530 @test energies_dm[1 ] ≈ energies_QP[1 ] + expectation_value (ψ, H, envs) atol = 1.0e-4
@@ -557,7 +557,7 @@ module TestAlgorithms
557557
558558 O = MPSKit. DenseMPO (expH)
559559 Op = periodic_boundary_conditions (O, 10 )
560- Op′ = changebonds (Op, SvdCut (; trscheme = truncdim (5 )))
560+ Op′ = changebonds (Op, SvdCut (; trscheme = truncrank (5 )))
561561
562562 @test dim (space (Op′[5 ], 1 )) < dim (space (Op[5 ], 1 ))
563563 end
@@ -574,7 +574,7 @@ module TestAlgorithms
574574 state = InfiniteMPS (fill (pspace, unit_cell_size), fill (Dspace, unit_cell_size))
575575
576576 state_re = changebonds (
577- state, RandExpand (; trscheme = truncdim (dim (Dspace) * dim (Dspace)))
577+ state, RandExpand (; trscheme = truncrank (dim (Dspace) * dim (Dspace)))
578578 )
579579 @test dot (state, state_re) ≈ 1 atol = 1.0e-8
580580 end
@@ -584,7 +584,7 @@ module TestAlgorithms
584584 state = InfiniteMPS (fill (pspace, unit_cell_size), fill (Dspace, unit_cell_size))
585585
586586 state_oe, _ = changebonds (
587- state, H, OptimalExpand (; trscheme = truncdim (dim (Dspace) * dim (Dspace)))
587+ state, H, OptimalExpand (; trscheme = truncrank (dim (Dspace) * dim (Dspace)))
588588 )
589589 @test dot (state, state_oe) ≈ 1 atol = 1.0e-8
590590 end
@@ -596,7 +596,7 @@ module TestAlgorithms
596596 state_vs, _ = changebonds (state, H, VUMPSSvdCut (; trscheme = notrunc ()))
597597 @test dim (left_virtualspace (state, 1 )) < dim (left_virtualspace (state_vs, 1 ))
598598
599- state_vs_tr = changebonds (state_vs, SvdCut (; trscheme = truncdim (dim (Dspace))))
599+ state_vs_tr = changebonds (state_vs, SvdCut (; trscheme = truncrank (dim (Dspace))))
600600 @test dim (right_virtualspace (state_vs_tr, 1 )) < dim (right_virtualspace (state_vs, 1 ))
601601 end
602602 end
@@ -611,16 +611,16 @@ module TestAlgorithms
611611 state = FiniteMPS (L, pspace, Dspace)
612612
613613 state_re = changebonds (
614- state, RandExpand (; trscheme = truncdim (dim (Dspace) * dim (Dspace)))
614+ state, RandExpand (; trscheme = truncrank (dim (Dspace) * dim (Dspace)))
615615 )
616616 @test dot (state, state_re) ≈ 1 atol = 1.0e-8
617617
618618 state_oe, _ = changebonds (
619- state, H, OptimalExpand (; trscheme = truncdim (dim (Dspace) * dim (Dspace)))
619+ state, H, OptimalExpand (; trscheme = truncrank (dim (Dspace) * dim (Dspace)))
620620 )
621621 @test dot (state, state_oe) ≈ 1 atol = 1.0e-8
622622
623- state_tr = changebonds (state_oe, SvdCut (; trscheme = truncdim (dim (Dspace))))
623+ state_tr = changebonds (state_oe, SvdCut (; trscheme = truncrank (dim (Dspace))))
624624
625625 @test dim (left_virtualspace (state_tr, 5 )) < dim (left_virtualspace (state_oe, 5 ))
626626 end
@@ -633,16 +633,16 @@ module TestAlgorithms
633633 state = MultilineMPS (fill (t, 1 , 1 ))
634634
635635 state_re = changebonds (
636- state, RandExpand (; trscheme = truncdim (dim (Dspace) * dim (Dspace)))
636+ state, RandExpand (; trscheme = truncrank (dim (Dspace) * dim (Dspace)))
637637 )
638638 @test dot (state, state_re) ≈ 1 atol = 1.0e-8
639639
640640 state_oe, _ = changebonds (
641- state, mpo, OptimalExpand (; trscheme = truncdim (dim (Dspace) * dim (Dspace)))
641+ state, mpo, OptimalExpand (; trscheme = truncrank (dim (Dspace) * dim (Dspace)))
642642 )
643643 @test dot (state, state_oe) ≈ 1 atol = 1.0e-8
644644
645- state_tr = changebonds (state_oe, SvdCut (; trscheme = truncdim (dim (Dspace))))
645+ state_tr = changebonds (state_oe, SvdCut (; trscheme = truncrank (dim (Dspace))))
646646
647647 @test dim (left_virtualspace (state_tr, 1 , 1 )) < dim (left_virtualspace (state_oe, 1 , 1 ))
648648 end
@@ -756,20 +756,20 @@ module TestAlgorithms
756756 MPSKit. Defaults. set_scheduler! ()
757757
758758 ψ3, _ = approximate (ψ0, (W1, ψ), IDMRG (; verbosity))
759- ψ4, _ = approximate (ψ0, (sW2, ψ), IDMRG2 (; trscheme = truncdim (12 ), verbosity))
759+ ψ4, _ = approximate (ψ0, (sW2, ψ), IDMRG2 (; trscheme = truncrank (12 ), verbosity))
760760 ψ5, _ = timestep (ψ, H, 0.0 , dt, TDVP ())
761- ψ6 = changebonds (W1 * ψ, SvdCut (; trscheme = truncdim (12 )))
761+ ψ6 = changebonds (W1 * ψ, SvdCut (; trscheme = truncrank (12 )))
762762
763763 @test abs (dot (ψ1, ψ5)) ≈ 1.0 atol = dt
764764 @test abs (dot (ψ3, ψ5)) ≈ 1.0 atol = dt
765765 @test abs (dot (ψ6, ψ5)) ≈ 1.0 atol = dt
766766 @test abs (dot (ψ2, ψ4)) ≈ 1.0 atol = dt
767767
768- nW1 = changebonds (W1, SvdCut (; trscheme = truncbelow ( dt))) # this should be a trivial mpo now
768+ nW1 = changebonds (W1, SvdCut (; trscheme = trunctol (; atol = dt))) # this should be a trivial mpo now
769769 @test dim (space (nW1[1 ], 1 )) == 1
770770 end
771771
772- finite_algs = [DMRG (; verbosity), DMRG2 (; verbosity, trscheme = truncdim (10 ))]
772+ finite_algs = [DMRG (; verbosity), DMRG2 (; verbosity, trscheme = truncrank (10 ))]
773773 @testset " finitemps1 ≈ finitemps2" for alg in finite_algs
774774 a = FiniteMPS (10 , ℂ^ 2 , ℂ^ 10 )
775775 b = FiniteMPS (10 , ℂ^ 2 , ℂ^ 20 )
@@ -956,7 +956,7 @@ module TestAlgorithms
956956 @testset " Finite-size" begin
957957 L = 6
958958 H = transverse_field_ising (; L)
959- trscheme = truncdim (20 )
959+ trscheme = truncrank (20 )
960960 verbosity = 1
961961 beta = 0.1
962962
@@ -1003,7 +1003,7 @@ module TestAlgorithms
10031003
10041004 @testset " Infinite-size" begin
10051005 H = transverse_field_ising ()
1006- trscheme = truncdim (20 )
1006+ trscheme = truncrank (20 )
10071007 verbosity = 1
10081008 beta = 0.1
10091009
@@ -1030,7 +1030,7 @@ module TestAlgorithms
10301030
10311031 # TDVP
10321032 rho_0 = MPSKit. infinite_temperature_density_matrix (H)
1033- rho_0_mps, = changebonds (convert (InfiniteMPS, rho_0), H, OptimalExpand (; trscheme = truncdim (20 )))
1033+ rho_0_mps, = changebonds (convert (InfiniteMPS, rho_0), H, OptimalExpand (; trscheme = truncrank (20 )))
10341034 rho_mps_tdvp, = timestep (rho_0_mps, H, 0.0 , beta, TDVP (); imaginary_evolution)
10351035 E_tdvp = expectation_value (rho_mps_tdvp, H)
10361036 @test E_tdvp ≈ E_taylor atol = 1.0e-2
0 commit comments