Skip to content

Commit e2c9e50

Browse files
committed
Fix GS degeneracy
1 parent 2aa9de6 commit e2c9e50

3 files changed

Lines changed: 51 additions & 52 deletions

File tree

src/schemes/renormalizer.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ end
2727
get_tensor(r::Renormalizer)
2828
2929
Return the tensor(s) stored in the renormalizer's current state.
30-
For a single-tensor scheme like [`TRG`](@ref), returns the central tensor `T`.
3130
"""
3231
function get_tensor end
3332

src/utility/cft.jl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,29 @@ function CFTData(
6767
end
6868
end
6969

70+
"""
71+
_row_transfer_matrix(T::AbstractTensorMap, unitcell::Int)
72+
73+
Build a row transfer matrix from `unitcell` copies of the tensor `T`
74+
concatenated horizontally with periodic boundary conditions.
75+
"""
76+
function _row_transfer_matrix(T::AbstractTensorMap, unitcell::Int)
77+
indices = [[i, -i, -(i + unitcell), i + 1] for i in 1:unitcell]
78+
indices[end][4] = 1
79+
Tcontracted = ncon(fill(T, unitcell), indices)
80+
outinds = ntuple(i -> i, unitcell)
81+
ininds = ntuple(i -> unitcell + i, unitcell)
82+
return permute(Tcontracted, (outinds, ininds))
83+
end
84+
7085
"""
7186
Construct the transfer matrix along vertical direction
7287
with `unitcell` copies of `T` concatenated horizontally.
7388
`τ0` is the modular parameter of a single `T`.
7489
"""
7590
function _scaling_dimensions(T::TensorMap{E, S, 2, 2}, τ0::Number; unitcell = 1) where {E, S}
76-
indices = [[i, -i, -(i + unitcell), i + 1] for i in 1:unitcell]
77-
indices[end][4] = 1
78-
79-
T = ncon(fill(T, unitcell), indices)
80-
# restore leg convention
81-
outinds = Tuple(collect(1:unitcell))
82-
ininds = Tuple(collect((unitcell + 1):(2unitcell)))
83-
T = permute(T, (outinds, ininds))
84-
85-
sv = StructuredVector(eig_vals(T))
91+
tm = _row_transfer_matrix(T, unitcell)
92+
sv = StructuredVector(eig_vals(tm))
8693
sv = filter(x -> real(x) > 0 && abs(x) > 1.0e-12, sv)
8794
isempty(sv) && throw(ArgumentError("No valid eigenvalues found in transfer matrix spectrum."))
8895

src/utility/gs_degeneracy.jl

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
function _ground_state_degeneracy(tm::AbstractTensorMap{E, S, N, N}) where {E, S, N}
2+
D, _ = eig_full(tm)
3+
D = D / tr(D)
4+
evs = filter(!iszero, abs.(D.data))
5+
entropy = -sum(evs .* log.(ev))
6+
return exp(entropy)
7+
end
8+
19
"""
210
ground_state_degeneracy(T::AbstractTensorMap, unitcell=1)
311
@@ -6,45 +14,28 @@ using the eigenvalues of the transfer matrix. The GSD is the exponential
614
of the Shannon entropy of the normalized eigenvalue spectrum.
715
"""
816
function ground_state_degeneracy(T::AbstractTensorMap, unitcell::Int = 1)
9-
indices = Vector{NTuple{4, Int}}(undef, unitcell)
10-
for i in 1:unitcell
11-
indices[i] = (i, -i, -(i + unitcell), i + 1)
12-
end
13-
indices[end] = (unitcell, -unitcell, -(unitcell + unitcell), 1)
14-
15-
Ts = fill(T, unitcell)
16-
Tcontracted = ncon(Ts, indices)
17-
18-
outinds = ntuple(i -> i, unitcell)
19-
ininds = ntuple(i -> unitcell + i, unitcell)
20-
Tcontracted = permute(Tcontracted, (outinds, ininds))
21-
22-
D, _ = eig_full(Tcontracted)
23-
D = D / tr(D)
24-
vals = filter(!iszero, abs.(D.data))
25-
S = 0.0
26-
for v in vals
27-
ev = abs(v)
28-
if ev > 0
29-
S -= ev * log(ev)
30-
end
31-
end
32-
return exp(S)
17+
tm = _row_transfer_matrix(T, unitcell)
18+
return _ground_state_degeneracy(tm)
3319
end
3420

3521
"""
36-
ground_state_degeneracy(TA::AbstractTensorMap, TB::AbstractTensorMap; unitcell=1)
37-
38-
Compute the GSD from a two-site unit cell (TA, TB). Builds an effective
39-
single-site tensor and delegates to the single-tensor method.
22+
ground_state_degeneracy(TA::AbstractTensorMap, TB::AbstractTensorMap)
23+
24+
Compute the GSD for a checkerboard network (TA, TB) from the 2-column transfer matrix
25+
```
26+
┌-┐ ┌-┐
27+
1'--A-------B---3'
28+
| | | |
29+
| | | |
30+
| | | |
31+
2'--B-------A---4'
32+
└-┘ └-┘
33+
```
4034
"""
41-
function ground_state_degeneracy(TA::AbstractTensorMap, TB::AbstractTensorMap; unitcell::Int = 1)
42-
norm_const = area_term(TA, TB)
43-
T1 = TA / abs(norm_const)^(1 / 4)
44-
T2 = TB / abs(norm_const)^(1 / 4)
45-
@tensor T_unit[-1 -2; -3 -4] := T1[-1 1; 3 2] * T2[2 6; 4 -3] *
46-
T2[-2 3; 1 5] * T1[5 4; 6 -4]
47-
return ground_state_degeneracy(T_unit, unitcell)
35+
function ground_state_degeneracy(TA::AbstractTensorMap, TB::AbstractTensorMap)
36+
@tensor tm[-1 -2; -3 -4] := TA[-1 1; 3 2] * TB[2 6; 4 -3] *
37+
TB[-2 3; 1 5] * TA[5 4; 6 -4]
38+
return _ground_state_degeneracy(tm)
4839
end
4940

5041
ground_state_degeneracy(scheme::TNRScheme; unitcell::Int = 1) = ground_state_degeneracy(scheme.T, unitcell)
@@ -55,10 +46,10 @@ function ground_state_degeneracy(scheme::BTRG; unitcell::Int = 1)
5546
return ground_state_degeneracy(T_unit, unitcell)
5647
end
5748

58-
ground_state_degeneracy(scheme::LoopTNR; unitcell::Int = 2) = ground_state_degeneracy(scheme.TA, scheme.TB; unitcell)
49+
ground_state_degeneracy(scheme::LoopTNR) = ground_state_degeneracy(scheme.TA, scheme.TB)
5950

6051
"""
61-
gu_wen_ratio(T::AbstractTensorMap)
52+
gu_wen_ratio(T::AbstractTensorMap{E, S, 2, 2}) where {E, S}
6253
6354
Compute the Gu-Wen ratios (X1, X2) from a single network tensor.
6455
The Gu-Wen ratios are related to the ground state degeneracy and
@@ -68,7 +59,7 @@ the scaling dimensions.
6859
* [Zheng-Cheng Gu & Xiao-Gang Wen. PhysRevB.80.155131](@cite gu2009)
6960
* [Satoshi Morita et al. arxiv:2512.03395](@cite morita2025)
7061
"""
71-
function gu_wen_ratio(T::AbstractTensorMap)
62+
function gu_wen_ratio(T::AbstractTensorMap{E, S, 2, 2}) where {E, S}
7263
one_norm = norm(@tensor T[1 2; 2 1])
7364
two_norm_X1 = norm(@tensor T[1 2; 2 3] * T[3 4; 4 1])
7465
two_norm_X2 = norm(@tensor T[1 2; 3 4] * T[4 3; 2 1])
@@ -78,11 +69,13 @@ function gu_wen_ratio(T::AbstractTensorMap)
7869
end
7970

8071
"""
81-
gu_wen_ratio(TA::AbstractTensorMap, TB::AbstractTensorMap)
72+
gu_wen_ratio(TA::AbstractTensorMap{E, S, 2, 2}, TB::AbstractTensorMap{E, S, 2, 2}) where {E, S}
8273
83-
Compute the Gu-Wen ratios (X1, X2) from a two-site unit cell (TA, TB).
74+
Compute the Gu-Wen ratios (X1, X2) for a checkerboard network (TA, TB).
8475
"""
85-
function gu_wen_ratio(TA::AbstractTensorMap, TB::AbstractTensorMap)
76+
function gu_wen_ratio(
77+
TA::AbstractTensorMap{E, S, 2, 2}, TB::AbstractTensorMap{E, S, 2, 2}
78+
) where {E, S}
8679
one_norm = norm(
8780
@tensor opt = true TA[1 2; 3 4] * TB[4 5; 6 1] *
8881
TB[7 3; 2 8] * TA[8 6; 5 7]

0 commit comments

Comments
 (0)