@@ -3,12 +3,10 @@ using ITensorNetworks: ITensorNetwork, siteinds, ttn, random_tensornetwork
33using ITensorNetworks. ModelHamiltonians: heisenberg
44using NamedGraphs. NamedGraphGenerators: named_comb_tree
55using Test: @test , @testset
6- using Printf
76using StableRNGs: StableRNG
87using TensorOperations: TensorOperations # For contraction order finding
98
109@testset " Fitting Tests" begin
11- outputlevel = 1
1210 for elt in (Float32, Float64, Complex{Float32}, Complex{Float64})
1311 (outputlevel >= 1 ) && println (" \n Fitting tests with elt = " , elt)
1412 g = named_comb_tree ((3 , 2 ))
@@ -22,7 +20,6 @@ using TensorOperations: TensorOperations #For contraction order finding
2220 # f =
2321 # inner(a, b; alg="exact") /
2422 # sqrt(inner(a, a; alg="exact") * inner(b, b; alg="exact"))
25- # (outputlevel >= 1) && @printf("One-site truncation. Fidelity = %s\n", f)
2623 # @test abs(abs(f) - 1.0) <= 10*eps(real(elt))
2724
2825 # #Two-site truncation
@@ -31,23 +28,20 @@ using TensorOperations: TensorOperations #For contraction order finding
3128 # f =
3229 # inner(a, b; alg="exact") /
3330 # sqrt(inner(a, a; alg="exact") * inner(b, b; alg="exact"))
34- # (outputlevel >= 1) && @printf("Two-site truncation. Fidelity = %s\n", f)
3531 # @test abs(abs(f) - 1.0) <= 10*eps(real(elt))
3632
3733 # #One-site apply (no normalization)
3834 a = random_tensornetwork (rng, elt, s; link_space = 2 )
3935 H = ITensorNetwork (ttn (heisenberg (g), s))
4036 Ha = apply (H, a; maxdim = 4 , nsites = 1 , normalize = false )
4137 f = inner (Ha, a; alg = " exact" ) / inner (a, H, a; alg = " exact" )
42- (outputlevel >= 1 ) && @printf (" One-site apply. Fidelity = %s\n " , f)
4338 @test abs (f - 1.0 ) <= 500 * eps (real (elt))
4439
4540 # #Two-site apply (no normalization)
4641 a = random_tensornetwork (rng, elt, s; link_space = 2 )
4742 H = ITensorNetwork (ttn (heisenberg (g), s))
4843 Ha = apply (H, a; maxdim = 4 , cutoff = 1.0e-16 , nsites = 2 , normalize = false )
4944 f = inner (Ha, a; alg = " exact" ) / inner (a, H, a; alg = " exact" )
50- (outputlevel >= 1 ) && @printf (" Two-site apply. Fidelity = %s\n " , f)
5145 @test abs (f - 1.0 ) <= 500 * eps (real (elt))
5246 end
5347end
0 commit comments