Skip to content

Commit 05ba326

Browse files
committed
Add topological data
1 parent 32198bd commit 05ba326

File tree

1 file changed

+62
-2
lines changed

1 file changed

+62
-2
lines changed

src/irreps/dnirrep.jl

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,73 @@ function Nsymbol(a::DNIrrep{N}, b::DNIrrep{N}, c::DNIrrep{N}) where {N}
190190
end
191191

192192
function Fsymbol(a::I, b::I, c::I, d::I, e::I, f::I) where {N, I <: DNIrrep{N}}
193-
193+
T = sectorscalartype(I)
194+
(Nsymbol(a, b, e) & Nsymbol(e, c, d) & Nsymbol(b, c, f) & Nsymbol(a, f, d)) || return zero(T)
195+
196+
A = fusiontensor(a, b, e)
197+
A = reshape(A, size(A, 1), size(A, 2), size(A, 3))
198+
B = fusiontensor(e, c, d)
199+
B1 = reshape(view(B, :, :, 1), size(B, 1), size(B, 2))
200+
C = fusiontensor(b, c, f)
201+
C = reshape(C, size(C, 1), size(C, 2), size(C, 3))
202+
D = fusiontensor(a, f, d)
203+
D1 = reshape(view(D, :, :, 1), size(D, 1), size(D, 2))
204+
205+
return @tensor conj(D1[1 5]) * conj(C[2 4 5]) * A[1 2 3] * B1[3 4]
194206
end
195207

196208
function Rsymbol(a::I, b::I, c::I) where {N, I <: DNIrrep{N}}
197-
209+
R = convert(sectorscalartype(I), Nsymbol(a, b, c))
210+
return ifelse(c.isodd & (dim(a) != 1), -R, R)
198211
end
199212

213+
const _invsqrt2 = 1 / sqrt(2)
214+
200215
function fusiontensor(a::I, b::I, c::I) where {N, I <: DNIrrep{N}}
216+
C = fill(zero(sectorscalartype(I)), dim(a), dim(b), dim(c), 1)
217+
Nsymbol(a, b, c) || return C
218+
219+
if c.j == 0
220+
if a.j == b.j == 0
221+
C[1] = 1
222+
else # a.j == b.j
223+
# 0\pm = 1/sqrt(2) (v_i^+ \otimes w_j^- \pm v_i^- \otimes w_j^+)
224+
C[1, 2] = _invsqrt2
225+
C[2, 1] = c.isodd ? -_invsqrt2 : _invsqrt2
226+
end
227+
elseif iseven(N) && c.j == (N >> 1)
228+
if (a.j == (N >> 1)) | (b.j == (N >> 1))
229+
C[1] = 1
230+
else
231+
C[1, 1] = _invsqrt2
232+
C[2, 2] = c.isodd ? -_invsqrt2 : _invsqrt2
233+
end
234+
elseif a.j == 0
235+
C[1, 1, 1] = 1
236+
C[1, 2, 2] = a.isodd ? -1 : 1
237+
elseif b.j == 0
238+
C[1, 1, 1] = 1
239+
C[2, 1, 2] = b.isodd ? -1 : 1
240+
elseif iseven(N) && (a.j == (N >> 1))
241+
C[1, 1, 1] = -1
242+
C[1, 2, 2] = a.isodd ? 1 : -1
243+
elseif iseven(N) && (b.j == (N >> 1))
244+
C[1, 1, 1] = -1
245+
C[2, 1, 2] = b.isodd ? 1 : -1
246+
# from here on everything is 2D --------------------
247+
elseif c.j == a.j + b.j
248+
C[1, 1, 1] = 1
249+
C[2, 2, 2] = 1
250+
elseif c.j == N - (a.j + b.j)
251+
C[1, 1, 2] = 1
252+
C[2, 2, 1] = 1
253+
elseif c.j == a.j - b.j
254+
C[1, 2, 1] = 1
255+
C[2, 1, 2] = 1
256+
elseif c.j == b.j - a.j
257+
C[2, 1, 1] = 1
258+
C[1, 2, 2] = 1
259+
end
201260

261+
return C
202262
end

0 commit comments

Comments
 (0)