Skip to content

Commit 69f7c49

Browse files
Test on julia 1 and lts (#108)
* also test on julia lts * initialize with ones and warn the user if eigsolve did not converge * use ones in area_term * add warnings to eigsolve to check if this is the issue * Make LoopTNR tests more deterministic
1 parent 31a6a91 commit 69f7c49

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
version:
22-
- '1'
22+
- 'lts' # minimal supported version
23+
- '1' # latest released Julia version
2324
os:
2425
- ubuntu-latest
2526
- macOS-latest

src/utility/cft.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,18 @@ end
7676
function area_term(A, B; is_real = true)
7777
a_in = domain(A)[1]
7878
b_in = domain(B)[1]
79-
x0 = rand(a_in b_in)
79+
x0 = ones(a_in b_in)
8080

8181
function f0(x)
8282
@plansor fx[-1 -2] := A[c -1; 1 m] * x[1 2] * B[m -2; 2 c]
8383
@plansor ffx[-1 -2] := B[c -1; 1 m] * fx[1 2] * A[m -2; 2 c]
8484
return ffx
8585
end
8686

87-
spec0, _, _ = eigsolve(f0, x0, 1, :LR; verbosity = 0)
88-
87+
spec0, _, info = eigsolve(f0, x0, 1, :LR; verbosity = 0)
88+
if info.converged == 0
89+
@warn "The area term eigensolver did not converge."
90+
end
8991
if is_real
9092
return real(spec0[1])
9193
else
@@ -176,15 +178,18 @@ function spec(TA::TensorMap, TB::TensorMap, shape::Array; Nh = 25)
176178
spec_sector = Dict(
177179
map(sectors(fuse(xspace))) do charge
178180
V = (I == Trivial) ? 𝔽^1 : Vect[I](charge => 1)
179-
x = rand(xspace V)
181+
x = ones(xspace V)
180182
if dim(x) == 0
181183
return charge => [0.0]
182184
else
183-
spec, _, _ = eigsolve(
185+
spec, _, info = eigsolve(
184186
a -> f(TA, TB, a), x, Nh, :LM; krylovdim = 40, maxiter = 100,
185187
tol = 1.0e-12,
186188
verbosity = 0
187189
)
190+
if info.converged == 0
191+
@warn "The spectrum eigensolver in sector $charge did not converge."
192+
end
188193
return charge => filter(x -> abs(real(x)) 1.0e-12, spec)
189194
end
190195
end

test/schemes.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ end
9191
@info "LoopTNR ising free energy"
9292
scheme = LoopTNR(T)
9393

94-
entanglement_function(steps, data) = abs(data[end])
95-
entanglement_criterion = maxiter(100) & convcrit(1.0e-15, entanglement_function)
96-
loop_criterion = maxiter(5) & convcrit(1.0e-10, entanglement_function)
94+
entanglement_criterion = maxiter(100)
95+
loop_criterion = maxiter(5)
9796

9897
data = run!(
9998
scheme, truncdim(8), truncbelow(1.0e-12), maxiter(25), entanglement_criterion,
@@ -104,22 +103,22 @@ end
104103

105104
@info "LoopTNR ising CFT data"
106105
scheme = LoopTNR(T)
107-
run!(scheme, truncdim(8), maxiter(10))
106+
run!(scheme, truncdim(12), maxiter(10))
108107

109108
for shape in [[1, 4, 1], [sqrt(2), 2 * sqrt(2), 0]]
110109
cft = cft_data!(scheme, shape)
111110
d1, d2 = real(cft[Z2Irrep(1)][1]), real(cft[Z2Irrep(0)][2])
112111
@info "Obtained lowest scaling dimensions:\n$(d1), $(d2)."
113112
@test d1 ising_cft_exact[1] rtol = 5.0e-4
114-
@test d2 ising_cft_exact[2] rtol = 1.0e-2
113+
@test d2 ising_cft_exact[2] rtol = 5.0e-4
115114
end
116115

117116
for shape in [[1, 8, 1], [4 / sqrt(10), 2 * sqrt(10), 2 / sqrt(10)]]
118-
cft = cft_data!(scheme, shape, truncdim(8), truncbelow(1.0e-10))
117+
cft = cft_data!(scheme, shape, truncdim(12), truncbelow(1.0e-10))
119118
d1, d2 = real(cft[Z2Irrep(1)][1]), real(cft[Z2Irrep(0)][2])
120119
@info "Obtained lowest scaling dimensions:\n$(d1), $(d2)."
121-
@test d1 ising_cft_exact[1] rtol = 1.0e-2
122-
@test d2 ising_cft_exact[2] rtol = 1.0e-2
120+
@test d1 ising_cft_exact[1] rtol = 1.0e-3
121+
@test d2 ising_cft_exact[2] rtol = 1.0e-3
123122
end
124123
end
125124

0 commit comments

Comments
 (0)