Skip to content

Commit 10559ba

Browse files
Make SUWeight axis order definite (#315)
* Make SUWeight axis order definite * Update related tests * Update docs on CTMRGEnv(wts) * Update SU and bond truncation * Test SU with non-standard virtual dualness * Undo metadata changes * Update docstring * Refactor SUWeight rotation * Apply suggestions and add SUWeight random init * Streamline CTMRGEnv(wts) * Correct a comment * Apply suggestions * Improve `rand!(wts)`
1 parent d520d8a commit 10559ba

File tree

12 files changed

+191
-206
lines changed

12 files changed

+191
-206
lines changed

docs/src/examples/hubbard_su/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ is achieved by using `trunc=truncrank(χ)` with different `χ`s in the CTMRG run
130130
χenv₀, χenv = 6, 16
131131
env_space = Vect[fℤ₂](0 => χenv₀ / 2, 1 => χenv₀ / 2)
132132
normalize!.(peps.A, Inf)
133-
env = CTMRGEnv(wts, peps)
133+
env = CTMRGEnv(wts)
134134
for χ in [χenv₀, χenv]
135135
global env, = leading_boundary(
136136
env, peps; alg = :sequential, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ)

docs/src/examples/hubbard_su/main.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
"χenv₀, χenv = 6, 16\n",
141141
"env_space = Vect[fℤ₂](0 => χenv₀ / 2, 1 => χenv₀ / 2)\n",
142142
"normalize!.(peps.A, Inf)\n",
143-
"env = CTMRGEnv(wts, peps)\n",
143+
"env = CTMRGEnv(wts)\n",
144144
"for χ in [χenv₀, χenv]\n",
145145
" global env, = leading_boundary(\n",
146146
" env, peps; alg = :sequential, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ)\n",

examples/hubbard_su/main.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ is achieved by using `trunc=truncrank(χ)` with different `χ`s in the CTMRG run
8383
χenv₀, χenv = 6, 16
8484
env_space = Vect[fℤ₂](0 => χenv₀ / 2, 1 => χenv₀ / 2)
8585
normalize!.(peps.A, Inf)
86-
env = CTMRGEnv(wts, peps)
86+
env = CTMRGEnv(wts)
8787
for χ in [χenv₀, χenv]
8888
global env, = leading_boundary(
8989
env, peps; alg = :sequential, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ)

src/PEPSKit.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module PEPSKit
22

33
using LinearAlgebra, Statistics, Base.Threads, Base.Iterators, Printf
4+
using Random
45
using Compat
56
using Accessors: @set, @reset
67
using VectorInterface

src/algorithms/time_evolution/evoltools.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ function _apply_gate(
233233

234234
a, b = absorb_s(a, s, b)
235235
if need_flip
236-
a, s, b = flip_svd(a, s, b)
236+
a, s, b = flip(a, numind(a)), _fliptwist_s(s), flip(b, 1)
237237
end
238238
return a, s, b, ϵ
239239
end

src/algorithms/time_evolution/simpleupdate3site.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ function _su3site_se!(
479479
Ms = [first(_unfuse_physicalspace(M, Vphy)) for (M, Vphy) in zip(Ms, Vphys)]
480480
end
481481
for (wt, wt_idx, flip) in zip(wts, wt_idxs, flips)
482-
env[CartesianIndex(wt_idx)] = normalize(flip ? _flip_s(wt) : wt, Inf)
482+
env[CartesianIndex(wt_idx)] = normalize(flip ? _fliptwist_s(wt) : wt, Inf)
483483
end
484484
end
485485
# restore virtual arrows in `Ms`

src/algorithms/truncation/bond_truncation.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function bond_truncate(
139139
a, s, b = svd_trunc!(permute(_combine_ab(a, b), perm_ab); trunc = alg.trunc)
140140
a, b = absorb_s(a, s, b)
141141
if need_flip
142-
a, s, b = flip_svd(a, s, b)
142+
a, s, b = flip(a, numind(a)), _fliptwist_s(s), flip(b, 1)
143143
end
144144
return a, s, b, (; fid, Δfid, Δs)
145145
end
@@ -186,7 +186,7 @@ function bond_truncate(
186186
@tensor a[-1 -2; -3] := Qa[-1 -2 3] * u[3 -3]
187187
@tensor b[-1; -2 -3] := vh[-1 1] * Qb[1 -2 -3]
188188
if need_flip
189-
a, s, b = flip_svd(a, s, b)
189+
a, s, b = flip(a, numind(a)), _fliptwist_s(s), flip(b, 1)
190190
end
191191
return a, s, b, info
192192
end

0 commit comments

Comments
 (0)