Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrehmer committed Jul 9, 2024
1 parent 66a827e commit d09561f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 6 additions & 2 deletions test/ctmrg/gaugefix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ end
ctm = CTMRGEnv(psi; Venv=ctm_space)

verbosity = 1
alg = CTMRG(; tol=1e-10, miniter=4, maxiter=400, verbosity, trscheme=truncdim(dim(ctm_space)))
alg = CTMRG(;
tol=1e-10, miniter=4, maxiter=400, verbosity, trscheme=truncdim(dim(ctm_space))
)
alg_fixed = @set alg.projector_alg.trscheme = FixedSpaceTruncation()

ctm = leading_boundary(ctm, psi, alg)
Expand All @@ -69,7 +71,9 @@ end
ctm = CTMRGEnv(psi; Venv=ctm_space)

verbosity = 1
alg = CTMRG(; tol=1e-10, miniter=4, maxiter=400, verbosity, trscheme=truncdim(dim(ctm_space)))
alg = CTMRG(;
tol=1e-10, miniter=4, maxiter=400, verbosity, trscheme=truncdim(dim(ctm_space))
)
alg_fixed = @set alg.projector_alg.trscheme = FixedSpaceTruncation()

ctm = leading_boundary(ctm, psi, alg)
Expand Down
12 changes: 9 additions & 3 deletions test/ctmrg/svd_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,19 @@ symm_R = TensorMap(randn, dtype, space(symm_r))
@test l_itersvd l_fullsvd
@test norm(g_fullsvd[1] - g_itersvd[1]) / norm(g_fullsvd[1]) < rtol

l_fullsvd_tr, g_fullsvd_tr = withgradient(A -> lossfun(A, full_alg, symm_R, symm_trspace), symm_r)
l_itersvd_tr, g_itersvd_tr = withgradient(A -> lossfun(A, iter_alg, symm_R, symm_trspace), symm_r)
l_fullsvd_tr, g_fullsvd_tr = withgradient(
A -> lossfun(A, full_alg, symm_R, symm_trspace), symm_r
)
l_itersvd_tr, g_itersvd_tr = withgradient(
A -> lossfun(A, iter_alg, symm_R, symm_trspace), symm_r
)
@test l_itersvd_tr l_fullsvd_tr
@test norm(g_fullsvd_tr[1] - g_itersvd_tr[1]) / norm(g_fullsvd_tr[1]) < rtol

iter_alg_fallback = @set iter_alg.svd_alg.fallback_threshold = 0.4 # Do dense SVD in one block, sparse SVD in the other
l_itersvd_fb, g_itersvd_fb = withgradient(A -> lossfun(A, iter_alg_fallback, symm_R, symm_trspace), symm_r)
l_itersvd_fb, g_itersvd_fb = withgradient(
A -> lossfun(A, iter_alg_fallback, symm_R, symm_trspace), symm_r
)
@test l_itersvd_fb l_fullsvd_tr
@test norm(g_fullsvd_tr[1] - g_itersvd_fb[1]) / norm(g_fullsvd_tr[1]) < rtol
end

0 comments on commit d09561f

Please sign in to comment.