@@ -10,15 +10,15 @@ struct BimoduleSector{Name} <: Sector
1010 i <= size (BimoduleSector{Name}) && j <= size (BimoduleSector{Name}) ||
1111 throw (DomainError (" object outside the matrix $Name " ))
1212 return label <= _numlabels (BimoduleSector{Name}, i, j) ? new {Name} (i, j, label) :
13- throw (DomainError (" label outside category $Name ($i , $j )" ))
13+ throw (DomainError (" label outside category $Name ($i , $j )" ))
1414 end
1515end
1616
17- BimoduleSector {Name} (data:: NTuple{3,Int} ) where {Name} = BimoduleSector {Name} (data... )
17+ BimoduleSector {Name} (data:: NTuple{3, Int} ) where {Name} = BimoduleSector {Name} (data... )
1818BimoduleSectorName (:: Type{BimoduleSector{Name}} ) where {Name} = Name
1919const A4Object = BimoduleSector{:A4 }
2020
21- Base. convert (:: Type{<:BimoduleSector{Name}} , labels:: NTuple{3,Int} ) where {Name} = BimoduleSector {Name} (labels... )
21+ Base. convert (:: Type{<:BimoduleSector{Name}} , labels:: NTuple{3, Int} ) where {Name} = BimoduleSector {Name} (labels... )
2222
2323function Base. show (io:: IO , a:: BimoduleSector{Name} ) where {Name}
2424 if get (io, :typeinfo , nothing ) === typeof (a)
3131
3232# Utility implementations
3333# -----------------------
34- function Base. isless (a:: I , b:: I ) where {I<: BimoduleSector }
34+ function Base. isless (a:: I , b:: I ) where {I <: BimoduleSector }
3535 return isless ((a. i, a. j, a. label), (b. i, b. j, b. label))
3636end
3737Base. hash (a:: BimoduleSector , h:: UInt ) = hash (a. i, hash (a. j, hash (a. label, h)))
38- function Base. convert (:: Type{BimoduleSector{Name}} , d:: NTuple{3,Int} ) where {Name}
38+ function Base. convert (:: Type{BimoduleSector{Name}} , d:: NTuple{3, Int} ) where {Name}
3939 return BimoduleSector {Name} (d... )
4040end
4141
4242Base. size (:: Type{A4Object} ) = 7
4343
4444Base. IteratorSize (:: Type{<:SectorValues{<:BimoduleSector}} ) = Base. SizeUnknown ()
4545
46- function Base. iterate (iter:: SectorValues{<:BimoduleSector} , (I, label)= (1 , 1 ))
46+ function Base. iterate (iter:: SectorValues{<:BimoduleSector} , (I, label) = (1 , 1 ))
4747 A = eltype (iter)
4848 s = size (A)
4949 I > s * s && return nothing
@@ -56,7 +56,7 @@ function Base.iterate(iter::SectorValues{<:BimoduleSector}, (I, label)=(1, 1))
5656 end
5757end
5858
59- function Base. length (:: SectorValues{I} ) where {I<: BimoduleSector }
59+ function Base. length (:: SectorValues{I} ) where {I <: BimoduleSector }
6060 s = size (I)
6161 return sum (_numlabels (I, i, j) for i in 1 : s, j in 1 : s)
6262end
@@ -65,15 +65,16 @@ TensorKitSectors.FusionStyle(::Type{A4Object}) = GenericFusion()
6565TensorKitSectors. BraidingStyle (:: Type{<:BimoduleSector} ) = NoBraiding ()
6666TensorKitSectors. sectorscalartype (:: Type{A4Object} ) = ComplexF64
6767
68- function TensorKitSectors.:⊗ (a:: I , b:: I ) where {I<: BimoduleSector }
68+ function TensorKitSectors.:⊗ (a:: I , b:: I ) where {I <: BimoduleSector }
6969 @assert a. j == b. i
7070 Ncache = _get_Ncache (I)[a. i, a. j, b. j]
71- return I[I (a. i, b. j, c_l)
72- for (a_l, b_l, c_l) in keys (Ncache)
73- if (a_l == a. label && b_l == b. label)]
71+ return I[
72+ I (a. i, b. j, c_l) for (a_l, b_l, c_l) in keys (Ncache)
73+ if (a_l == a. label && b_l == b. label)
74+ ]
7475end
7576
76- function _numlabels (:: Type{T} , i, j) where {T<: BimoduleSector }
77+ function _numlabels (:: Type{T} , i, j) where {T <: BimoduleSector }
7778 return length (_get_dual_cache (T)[2 ][i, j])
7879end
7980
@@ -91,37 +92,36 @@ function extract_Nsymbol(::Type{I}) where {I <: BimoduleSector}
9192 isfile (filename) || throw (LoadError (filename, 0 , " Nsymbol file not found for $name " ))
9293 Narray = readdlm (filename) # matrix with 7 columns
9394
94- data_dict = Dict {NTuple{3,Int},Dict{NTuple{3,Int},Int}} ()
95+ data_dict = Dict {NTuple{3, Int}, Dict{NTuple{3, Int}, Int}} ()
9596 for row in eachrow (Narray)
9697 i, j, k, a, b, c, N = Int .(@view (row[1 : size (I)]))
97- colordict = get! (data_dict, (i, j, k), Dict {NTuple{3,Int},Int} ())
98+ colordict = get! (data_dict, (i, j, k), Dict {NTuple{3, Int}, Int} ())
9899 push! (colordict, (a, b, c) => N)
99100 end
100101
101102 return data_dict
102103end
103104
104- const Ncache = IdDict{Type{<: BimoduleSector },
105- Dict{NTuple{3 ,Int},Dict{NTuple{3 ,Int},Int}}}()
105+ const Ncache = IdDict{Type{<: BimoduleSector }, Dict{NTuple{3 , Int}, Dict{NTuple{3 , Int}, Int}}}()
106106
107- function _get_Ncache (:: Type{T} ) where {T<: BimoduleSector }
107+ function _get_Ncache (:: Type{T} ) where {T <: BimoduleSector }
108108 global Ncache
109109 return get! (Ncache, T) do
110110 return extract_Nsymbol (T)
111111 end
112112end
113113
114- function TensorKitSectors. Nsymbol (a:: I , b:: I , c:: I ) where {I<: BimoduleSector }
114+ function TensorKitSectors. Nsymbol (a:: I , b:: I , c:: I ) where {I <: BimoduleSector }
115115 # TODO : should this error or return 0?
116116 (a. j == b. i && a. i == c. i && b. j == c. j) ||
117117 throw (ArgumentError (" invalid fusion channel" ))
118118 i, j, k = a. i, a. j, b. j
119119 return get (_get_Ncache (I)[i, j, k], (a. label, b. label, c. label), 0 )
120120end
121121
122- const Dualcache = IdDict{Type{<: BimoduleSector },Tuple{Vector{Int64},Matrix{Vector{Int64}}}}()
122+ const Dualcache = IdDict{Type{<: BimoduleSector }, Tuple{Vector{Int64}, Matrix{Vector{Int64}}}}()
123123
124- function _get_dual_cache (:: Type{T} ) where {T<: BimoduleSector }
124+ function _get_dual_cache (:: Type{T} ) where {T <: BimoduleSector }
125125 global Dualcache
126126 return get! (Dualcache, T) do
127127 return extract_dual (T)
@@ -171,7 +171,7 @@ function extract_dual(::Type{I}) where {I <: BimoduleSector}
171171 allduals[i, j] = Int[]
172172
173173 nobjj = maximum (first, keys (N[j, j, j]))
174- # the nested vectors contain the duals of the objects in 𝒞_ij, which are in C_ji
174+ # the nested vectors contain the duals of the objects in 𝒞_ij, which are in C_ji
175175 Niji = N[i, j, i] # 𝒞_ij x 𝒞_ji -> C_ii
176176 Njij = N[j, i, j] # 𝒞_ji x 𝒞_ij -> C_jj
177177 for i_ob in 1 : nobji, j_ob in 1 : nobjj
@@ -211,22 +211,22 @@ function TensorKitSectors.dual(a::BimoduleSector)
211211end
212212
213213function extract_Fsymbol (:: Type{I} ) where {I <: BimoduleSector }
214- result = Dict {NTuple{4,Int},Dict{NTuple{6,Int},Array{ComplexF64,4}}} ()
214+ result = Dict {NTuple{4, Int}, Dict{NTuple{6, Int}, Array{ComplexF64, 4}}} ()
215215 name = string (BimoduleSectorName (I))
216216 filename = joinpath (artifact_path, name, " Fsymbol.txt" )
217217 @assert isfile (filename) " cannot find $filename "
218+
218219 Farray = readdlm (filename)
219220 for ((i, j, k, l), colordict) in convert_Fs (Farray)
220- result[(i, j, k, l)] = Dict {NTuple{6,Int},Array{ComplexF64,4}} ()
221+ result[(i, j, k, l)] = Dict {NTuple{6, Int}, Array{ComplexF64, 4}} ()
221222 for ((a, b, c, d, e, f), Fvals) in colordict
222- a_ob, b_ob, c_ob, d_ob, e_ob, f_ob = I .(((i, j, a), (j, k, b),
223- (k, l, c), (i, l, d),
224- (i, k, e), (j, l, f)))
225- result[(i, j, k, l)][(a, b, c, d, e, f)] = zeros (ComplexF64,
226- Nsymbol (a_ob, b_ob, e_ob),
227- Nsymbol (e_ob, c_ob, d_ob),
228- Nsymbol (b_ob, c_ob, f_ob),
229- Nsymbol (a_ob, f_ob, d_ob))
223+ a_ob, b_ob, c_ob, d_ob, e_ob, f_ob = I .(
224+ ((i, j, a), (j, k, b), (k, l, c), (i, l, d), (i, k, e), (j, l, f))
225+ )
226+ result[(i, j, k, l)][(a, b, c, d, e, f)] = zeros (
227+ ComplexF64, Nsymbol (a_ob, b_ob, e_ob), Nsymbol (e_ob, c_ob, d_ob),
228+ Nsymbol (b_ob, c_ob, f_ob), Nsymbol (a_ob, f_ob, d_ob)
229+ )
230230 for (K, v) in Fvals
231231 result[(i, j, k, l)][(a, b, c, d, e, f)][K] = v
232232 end
@@ -236,35 +236,34 @@ function extract_Fsymbol(::Type{I}) where {I <: BimoduleSector}
236236end
237237
238238function convert_Fs (Farray_part:: Matrix{Float64} ) # Farray_part is a matrix with 16 columns
239- data_dict = Dict{NTuple{4 ,Int},
240- Dict{NTuple{6 ,Int},Vector{Pair{CartesianIndex{4 },ComplexF64}}}}()
241- # want to make a Dict with keys (i,j,k,l) and vals
242- # a Dict with keys (a,b,c,d,e,f) and vals
239+ data_dict = Dict{NTuple{4 , Int}, Dict{NTuple{6 , Int}, Vector{Pair{CartesianIndex{4 }, ComplexF64}}}}()
240+ # want to make a Dict with keys (i,j,k,l) and vals
241+ # a Dict with keys (a,b,c,d,e,f) and vals
243242 # a pair of (mu, nu, rho, sigma) and the F value
244243 for row in eachrow (Farray_part)
245244 i, j, k, l, a, b, c, d, e, f, mu, nu, rho, sigma = Int .(@view (row[1 : 14 ]))
246245 v = complex (row[15 ], row[16 ])
247- colordict = get! (data_dict, (i, j, k, l),
248- Dict{NTuple{6 ,Int},Vector{Pair{CartesianIndex{4 },ComplexF64}}}())
249- Fdict = get! (colordict, (a, b, c, d, e, f),
250- Vector {Pair{CartesianIndex{4},ComplexF64}} ())
246+ colordict = get! (
247+ data_dict, (i, j, k, l), Dict{NTuple{6 , Int}, Vector{Pair{CartesianIndex{4 }, ComplexF64}}}()
248+ )
249+ Fdict = get! (
250+ colordict, (a, b, c, d, e, f), Vector {Pair{CartesianIndex{4}, ComplexF64}} ()
251+ )
251252 push! (Fdict, CartesianIndex (mu, nu, rho, sigma) => v)
252253 end
253254 return data_dict
254255end
255256
256- const Fcache = IdDict{Type{<: BimoduleSector },
257- Dict{NTuple{4 ,Int64},Dict{NTuple{6 ,Int64},Array{ComplexF64,4 }}}}()
257+ const Fcache = IdDict{Type{<: BimoduleSector }, Dict{NTuple{4 , Int64}, Dict{NTuple{6 , Int64}, Array{ComplexF64, 4 }}}}()
258258
259- function _get_Fcache (:: Type{T} ) where {T<: BimoduleSector }
259+ function _get_Fcache (:: Type{T} ) where {T <: BimoduleSector }
260260 global Fcache
261261 return get! (Fcache, T) do
262262 return extract_Fsymbol (T)
263263 end
264264end
265265
266- function TensorKitSectors. Fsymbol (a:: I , b:: I , c:: I , d:: I , e:: I ,
267- f:: I ) where {I<: BimoduleSector }
266+ function TensorKitSectors. Fsymbol (a:: I , b:: I , c:: I , d:: I , e:: I , f:: I ) where {I <: BimoduleSector }
268267 # required to keep track of multiplicities where F-move is partially unallowed
269268 # also deals with invalid fusion channels
270269 Nabe = Nsymbol (a, b, e)
285284# -----------------------------------------
286285
287286# TODO : can remove this once the otimes assert is removed
288- function TensorKit. fuse (V₁:: GradedSpace{I} , V₂:: GradedSpace{I} ) where {I<: BimoduleSector }
289- dims = TensorKit. SectorDict {I,Int} ()
287+ function TensorKit. fuse (V₁:: GradedSpace{I} , V₂:: GradedSpace{I} ) where {I <: BimoduleSector }
288+ dims = TensorKit. SectorDict {I, Int} ()
290289 for a in sectors (V₁), b in sectors (V₂)
291290 a. j == b. i || continue # skip if not compatible
292291 for c in a ⊗ b
312311# function leftunitspace(S::SumSpace{<:GradedSpace{<:BimoduleSector}})
313312# @assert !isempty(S) "Cannot determine type of empty space"
314313# return SumSpace(leftunitspace(first(S.spaces)))
315- # end
314+ # end
0 commit comments