Skip to content

Commit 4ec1b6f

Browse files
committed
Change iseven(N) checks
1 parent dbd2a08 commit 4ec1b6f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/irreps/dnirrep.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ Base.eltype(::Type{DNIrrepProdIterator{N}}) where {N} = DNIrrep{N}
126126
Base.IteratorSize(x::DNIrrepProdIterator) = Base.HasLength()
127127
function Base.length(x::DNIrrepProdIterator{N}) where {N}
128128
a, b = x.a, x.b
129-
if a.j == 0 || b.j == 0 || (iseven(N) && (a.j == N >> 1 || b.j == N >> 1))
129+
if a.j == 0 || b.j == 0 || (N == 2 * a.j) || (N == 2 * b.j)
130130
return 1
131131
end
132132

133133
Asplits = iszero(b.j - a.j)
134-
Bsplits = iseven(N) & (a.j + b.j == N >> 1)
134+
Bsplits = 2 * (a.j + b.j) == N
135135
return 2 + Asplits + Bsplits
136136
end
137137

@@ -149,7 +149,7 @@ function Base.iterate(p::DNIrrepProdIterator{N}, state::Int = 1) where {N}
149149
cj = b.j
150150

151151
# A_i x B_j = B_{xor(i,j)}
152-
if iseven(N) && (cj == N >> 1)
152+
if 2 * cj == N
153153
cisodd = xor(a.isodd, b.isodd)
154154
return DNIrrep{N}(cj, cisodd), 5
155155
end
@@ -160,7 +160,7 @@ function Base.iterate(p::DNIrrepProdIterator{N}, state::Int = 1) where {N}
160160

161161
if a.j == b.j # != 0
162162
# B_i x B_j = A_{xor(i,j)}
163-
if iseven(N) && b.j == N >> 1
163+
if 2 * b.j == N
164164
return DNIrrep{N}(0, xor(a.isodd, b.isodd)), 5
165165
end
166166

@@ -169,7 +169,7 @@ function Base.iterate(p::DNIrrepProdIterator{N}, state::Int = 1) where {N}
169169
end
170170

171171
# rho_i x B_j = rho_{j-i}
172-
if iseven(N) && b.j == (N >> 1)
172+
if 2 * b.j == N
173173
return DNIrrep{N}(b.j - a.j, false), 5
174174
end
175175

@@ -179,7 +179,7 @@ function Base.iterate(p::DNIrrepProdIterator{N}, state::Int = 1) where {N}
179179
return DNIrrep{N}(0, true), 3
180180
elseif state == 3
181181
cj = a.j + b.j
182-
if iseven(N) && cj == (N >> 1)
182+
if 2 * cj == N
183183
return DNIrrep{N}(cj, false), 4
184184
end
185185
if cj > (N >> 1)
@@ -195,7 +195,7 @@ end
195195

196196
# Topological data
197197
# ----------------
198-
dim(a::DNIrrep{N}) where {N} = ifelse((a.j == 0) | (iseven(N) & (a.j == (N >> 1))), 1, 2)
198+
dim(a::DNIrrep{N}) where {N} = ifelse((a.j == 0) | (2 * a.j == N), 1, 2)
199199

200200
function Nsymbol(a::DNIrrep{N}, b::DNIrrep{N}, c::DNIrrep{N}) where {N}
201201
j_satisfied = (c.j == min(a.j + b.j, N - (a.j + b.j))) | (c.j == max(a.j, b.j) - min(a.j, b.j))
@@ -225,7 +225,7 @@ end
225225

226226
function Rsymbol(a::I, b::I, c::I) where {N, I <: DNIrrep{N}}
227227
R = convert(sectorscalartype(I), Nsymbol(a, b, c))
228-
return ifelse((c.j == 0) & c.isodd & !(a.j == b.j == 0) & !(iseven(N) && (a.j == b.j == (N >> 1))), -R, R)
228+
return ifelse((c.j == 0) & c.isodd & !(a.j == b.j == 0) & !((2 * a.j) == (2 * b.j) == N), -R, R)
229229
end
230230

231231

@@ -235,14 +235,14 @@ function fusiontensor(a::I, b::I, c::I) where {N, I <: DNIrrep{N}}
235235
Nsymbol(a, b, c) || return C
236236

237237
if c.j == 0
238-
if a.j == b.j == 0 || (iseven(N) && (a.j == b.j == (N >> 1)))
238+
if a.j == b.j == 0 || (2 * a.j == 2 * b.j == N)
239239
C[1, 1, 1] = 1
240240
else # a.j == b.j
241241
# 0\pm = 1/sqrt(2) (v_i^+ \otimes w_j^- \pm v_i^- \otimes w_j^+)
242242
C[1, 2, 1] = T(sqrt(2) / 2)
243243
C[2, 1, 1] = c.isodd ? -C[1, 2, 1] : C[1, 2, 1]
244244
end
245-
elseif iseven(N) && (c.j == (N >> 1))
245+
elseif 2 * c.j == N
246246
if (a.j == (N >> 1)) | (b.j == (N >> 1))
247247
C[1, 1, 1] = 1
248248
else
@@ -255,10 +255,10 @@ function fusiontensor(a::I, b::I, c::I) where {N, I <: DNIrrep{N}}
255255
elseif b.j == 0
256256
C[1, 1, 1] = 1
257257
C[2, 1, 2] = b.isodd ? -1 : 1
258-
elseif iseven(N) && (a.j == (N >> 1))
258+
elseif 2 * a.j == N
259259
C[1, 1, 2] = 1
260260
C[1, 2, 1] = a.isodd ? -1 : 1
261-
elseif iseven(N) && (b.j == (N >> 1))
261+
elseif 2 * b.j == N
262262
C[1, 1, 2] = 1
263263
C[2, 1, 1] = b.isodd ? -1 : 1
264264
# from here on everything is 2D --------------------

0 commit comments

Comments
 (0)