@@ -7,7 +7,7 @@ function list_fusionrings()
77 m = match (r" FR_(?<R>\d +)_(?<M>\d +)_(?<N>\d +)_(?<I>\d +).txt" , file)
88 if ! isnothing (m)
99 R, M, N, I = parse .(Int, (m[:R ], m[:M ], m[:N ], m[:I ]))
10- push! (rings, FR{R,M,N, I})
10+ push! (rings, FR{R, M, N, I})
1111 else
1212 try
1313 push! (rings, eval (Meta. parse (splitext (file)[1 ])))
@@ -26,7 +26,7 @@ function list_fusioncategories()
2626 m = match (r" FR_(?<R>\d +)_(?<M>\d +)_(?<N>\d +)_(?<I>\d +)_(?<D>\d +).txt" , file)
2727 if ! isnothing (m)
2828 R, M, N, I, D = parse .(Int, (m[:R ], m[:M ], m[:N ], m[:I ], m[:D ]))
29- push! (categories, UFC{R,M,N,I, D})
29+ push! (categories, UFC{R, M, N, I, D})
3030 else
3131 try
3232 push! (categories, eval (Meta. parse (splitext (file)[1 ])))
@@ -42,11 +42,12 @@ function list_braidedcategories()
4242 foldername = joinpath (artifact_path, " Rsymbols" )
4343 categories = Vector {Type{<:BraidedCategory}} ()
4444 for file in readdir (foldername)
45- m = match (r" FR_(?<R>\d +)_(?<M>\d +)_(?<N>\d +)_(?<I>\d +)_(?<D1>\d +)_(?<D2>\d +).txt" ,
46- file)
45+ m = match (
46+ r" FR_(?<R>\d +)_(?<M>\d +)_(?<N>\d +)_(?<I>\d +)_(?<D1>\d +)_(?<D2>\d +).txt" , file
47+ )
4748 if ! isnothing (m)
4849 R, M, N, I, D₁, D₂ = parse .(Int, (m[:R ], m[:M ], m[:N ], m[:I ], m[:D1 ], m[:D2 ]))
49- push! (categories, PMFC{R,M,N,I, D₁,D₂})
50+ push! (categories, PMFC{R, M, N, I, D₁, D₂})
5051 else
5152 try
5253 push! (categories, eval (Meta. parse (splitext (file)[1 ])))
6162# Nsymbols
6263# --------
6364
64- function N_artifact (:: Type{F} ) where {F<: Union{FR,UFC,PMFC} }
65- return joinpath (artifact_path, " Nsymbols" ,
66- " FR_$(rank (F)) _$(multiplicity (F)) _$(selfduality (F)) _$(ring_index (F)) .txt" )
65+ function N_artifact (:: Type{F} ) where {F <: Union{FR, UFC, PMFC} }
66+ return joinpath (
67+ artifact_path, " Nsymbols" ,
68+ " FR_$(rank (F)) _$(multiplicity (F)) _$(selfduality (F)) _$(ring_index (F)) .txt"
69+ )
6770end
6871
6972const N_format = r" (?<a>\d +) (?<b>\d +) (?<c>\d +) (?<N>\d +)"
@@ -80,7 +83,7 @@ function parse_Nsymbol(line)
8083 return a, b, c, N
8184end
8285
83- function extract_Nsymbol (:: Type{F} ) where {F<: FusionRing }
86+ function extract_Nsymbol (:: Type{F} ) where {F <: FusionRing }
8487 R = rank (F)
8588 filename = N_artifact (F)
8689 isfile (filename) || throw (LoadError (filename, 0 , " Nsymbol file not found for $F " ))
@@ -92,8 +95,9 @@ function extract_Nsymbol(::Type{F}) where {F<:FusionRing}
9295 return N_array
9396end
9497
95- @generated function TensorKitSectors. Nsymbol (a:: Object{F} , b:: Object{F} ,
96- c:: Object{F} ) where {F<: FusionRing }
98+ @generated function TensorKitSectors. Nsymbol (
99+ a:: Object{F} , b:: Object{F} , c:: Object{F}
100+ ) where {F <: FusionRing }
97101 local N_array
98102 try
99103 N_array = extract_Nsymbol (F)
110114# Fsymbols
111115# --------
112116
113- function F_artifact (:: Type{F} ) where {F<: Union{UFC,PMFC} }
114- return joinpath (artifact_path, " Fsymbols" ,
115- " FR_$(rank (F)) _$(multiplicity (F)) _$(selfduality (F)) _$(ring_index (F)) _$(category_index (F)) .txt" )
117+ function F_artifact (:: Type{F} ) where {F <: Union{UFC, PMFC} }
118+ return joinpath (
119+ artifact_path, " Fsymbols" ,
120+ " FR_$(rank (F)) _$(multiplicity (F)) _$(selfduality (F)) _$(ring_index (F)) _$(category_index (F)) .txt"
121+ )
116122end
117123
118124const F_format = r" (?<a>\d +) (?<b>\d +) (?<c>\d +) (?<d>\d +) (?<α>\d +) (?<e>\d +) (?<β>\d +) (?<μ>\d +) (?<f>\d +) (?<ν>\d +) (?<re>-?\d +(\.\d +)?) (?<im>-?\d +(\.\d +)?)"
@@ -121,17 +127,17 @@ function parse_Fsymbol(line)
121127 m = match (F_format, line)
122128 local labels, val
123129 try
124- labels = parse .(Int,
125- (m[:a ], m[:b ], m[:c ], m[:d ], m[:α ], m[:e ], m[:β ], m[:μ ], m[:f ],
126- m[ :ν ]) )
130+ labels = parse .(
131+ Int, (m[:a ], m[:b ], m[:c ], m[:d ], m[:α ], m[:e ], m[:β ], m[:μ ], m[:f ], m[ :ν ])
132+ )
127133 val = complex (parse .(Float64, (m[:re ], m[:im ]))... )
128134 catch
129135 throw (Meta. ParseError (" invalid F pattern: $m " ))
130136 end
131137 return labels... , val
132138end
133139
134- function extract_Fsymbol (:: Type{F} ) where {F<: FusionCategory }
140+ function extract_Fsymbol (:: Type{F} ) where {F <: FusionCategory }
135141 R = rank (F)
136142 M = multiplicity (F)
137143 filename = F_artifact (F)
@@ -146,7 +152,7 @@ function extract_Fsymbol(::Type{F}) where {F<:FusionCategory}
146152 end
147153 return isreal (F_array) ? convert (SparseArray{Float64}, F_array) : F_array
148154 else
149- F_dict = Dict {Tuple{Int,Int,Int,Int,Int,Int},SparseArray{ComplexF64,4}} ()
155+ F_dict = Dict {Tuple{Int, Int, Int, Int, Int, Int}, SparseArray{ComplexF64, 4}} ()
150156 for line in eachline (filename)
151157 a, b, c, d, α, e, β, μ, f, ν, val = parse_Fsymbol (line)
152158 if ! Base. haskey (F_dict, (a, b, c, d, e, f))
@@ -158,20 +164,21 @@ function extract_Fsymbol(::Type{F}) where {F<:FusionCategory}
158164 end
159165end
160166
161- function generate_Farray (:: Type{F} , a :: Int , b :: Int , c :: Int , d :: Int , e :: Int ,
162- f :: Int ) where {F <: FusionCategory }
163- a, b, c, d, e, f = Object {F} (a), Object {F} (b), Object {F} (c), Object {F} (d),
164- Object {F} (e), Object {F} (f)
167+ function generate_Farray (
168+ :: Type{F} , a :: Int , b :: Int , c :: Int , d :: Int , e :: Int , f :: Int
169+ ) where {F <: FusionCategory }
170+ a, b, c, d, e, f = Object {F} (a), Object {F} (b), Object {F} (c), Object {F} (d), Object {F} (e), Object {F} (f)
165171 N1 = Nsymbol (a, b, e)
166172 N2 = Nsymbol (e, c, d)
167173 N3 = Nsymbol (b, c, f)
168174 N4 = Nsymbol (a, f, d)
169- return SparseArray {ComplexF64,4} (undef, (N1, N2, N3, N4))
175+ return SparseArray {ComplexF64, 4} (undef, (N1, N2, N3, N4))
170176end
171177
172- @generated function TensorKitSectors. Fsymbol (a:: Object{F} , b:: Object{F} , c:: Object{F} ,
173- d:: Object{F} , e:: Object{F} ,
174- f:: Object{F} ) where {F<: FusionCategory }
178+ @generated function TensorKitSectors. Fsymbol (
179+ a:: Object{F} , b:: Object{F} , c:: Object{F} ,
180+ d:: Object{F} , e:: Object{F} , f:: Object{F}
181+ ) where {F <: FusionCategory }
175182 local F_array
176183 try
177184 F_array = extract_Fsymbol (F)
192199 N4 = Nsymbol (a, f, d)
193200
194201 (N1 == 0 || N2 == 0 || N3 == 0 || N4 == 0 ) &&
195- return SparseArray {ComplexF64,4} (undef, (N1, N2, N3, N4))
202+ return SparseArray {ComplexF64, 4} (undef, (N1, N2, N3, N4))
196203
197204 return $ (F_array)[(a. id, b. id, c. id, d. id, e. id, f. id)]
198205 end
202209# Rsymbols
203210# --------
204211
205- function R_artifact (:: Type{F} ) where {F<: PMFC }
206- return joinpath (artifact_path, " Rsymbols" ,
207- " FR_$(rank (F)) _$(multiplicity (F)) _$(selfduality (F)) _$(ring_index (F)) _$(category_index (F)) _$(braid_index (F)) .txt" )
212+ function R_artifact (:: Type{F} ) where {F <: PMFC }
213+ return joinpath (
214+ artifact_path, " Rsymbols" ,
215+ " FR_$(rank (F)) _$(multiplicity (F)) _$(selfduality (F)) _$(ring_index (F)) _$(category_index (F)) _$(braid_index (F)) .txt"
216+ )
208217end
209218
210219const R_format = r" (?<a>\d +) (?<b>\d +) (?<c>\d +) (?<μ>\d +) (?<ν>\d +) (?<re>-?\d +(\.\d +)?) (?<im>-?\d +(\.\d +)?)"
@@ -221,7 +230,7 @@ function parse_Rsymbol(line)
221230 return labels... , val
222231end
223232
224- function extract_Rsymbol (:: Type{F} ) where {F<: BraidedCategory }
233+ function extract_Rsymbol (:: Type{F} ) where {F <: BraidedCategory }
225234 R = rank (F)
226235 filename = R_artifact (F)
227236 isfile (filename) || throw (LoadError (filename, 0 , " Rsymbol file not found for $F " ))
@@ -235,7 +244,7 @@ function extract_Rsymbol(::Type{F}) where {F<:BraidedCategory}
235244 end
236245 return isreal (R_array) ? convert (SparseArray{Float64}, R_array) : R_array
237246 else
238- R_dict = Dict {Tuple{Int,Int,Int},SparseArray{ComplexF64,2}} ()
247+ R_dict = Dict {Tuple{Int, Int, Int}, SparseArray{ComplexF64, 2}} ()
239248 for line in eachline (filename)
240249 a, b, c, μ, ν, val = parse_Rsymbol (line)
241250 if ! Base. haskey (R_dict, (a, b, c))
@@ -247,15 +256,16 @@ function extract_Rsymbol(::Type{F}) where {F<:BraidedCategory}
247256 end
248257end
249258
250- function generate_Rarray (:: Type{F} , a:: Int , b:: Int , c:: Int ) where {F<: BraidedCategory }
259+ function generate_Rarray (:: Type{F} , a:: Int , b:: Int , c:: Int ) where {F <: BraidedCategory }
251260 a, b, c = Object {F} (a), Object {F} (b), Object {F} (c)
252261 N1 = Nsymbol (a, b, c)
253262 N2 = Nsymbol (b, a, c)
254- return SparseArray {ComplexF64,2} (undef, (N1, N2))
263+ return SparseArray {ComplexF64, 2} (undef, (N1, N2))
255264end
256265
257- @generated function TensorKitSectors. Rsymbol (a:: Object{F} , b:: Object{F} ,
258- c:: Object{F} ) where {F<: BraidedCategory }
266+ @generated function TensorKitSectors. Rsymbol (
267+ a:: Object{F} , b:: Object{F} , c:: Object{F}
268+ ) where {F <: BraidedCategory }
259269 local R_array
260270 try
261271 R_array = extract_Rsymbol (F)
275285 N2 = Nsymbol (b, a, c)
276286
277287 (N1 == 0 || N2 == 0 ) &&
278- return SparseArray {ComplexF64,2} (undef, (N1, N2))
288+ return SparseArray {ComplexF64, 2} (undef, (N1, N2))
279289
280290 return $ (R_array)[(a. id, b. id, c. id)]
281291 end
287297
288298const fusionformat = r" (?<a>\d +) (?<b>\d +) (?<c>\d +) (?<m1>\d +) (?<m2>\d +) (?<m3>\d +) (?<μ>\d +) (?<re>-?\d +(\.\d +)?) (?<im>-?\d +(\.\d +)?)"
289299
290- function fusiontensor_artifact (:: Type{F} ) where {F<: PMFC }
291- return joinpath (artifact_path, " fusiontensors" ,
292- " FR_$(rank (F)) _$(multiplicity (F)) _$(selfduality (F)) _$(ring_index (F)) _$(category_index (F)) _$(braid_index (F)) .txt" )
300+ function fusiontensor_artifact (:: Type{F} ) where {F <: PMFC }
301+ return joinpath (
302+ artifact_path, " fusiontensors" ,
303+ " FR_$(rank (F)) _$(multiplicity (F)) _$(selfduality (F)) _$(ring_index (F)) _$(category_index (F)) _$(braid_index (F)) .txt"
304+ )
293305end
294306
295307function parse_fusiontensor (line)
@@ -304,11 +316,11 @@ function parse_fusiontensor(line)
304316 return labels... , val
305317end
306318
307- function extract_fusiontensor (:: Type{F} ) where {F<: BraidedCategory }
319+ function extract_fusiontensor (:: Type{F} ) where {F <: BraidedCategory }
308320 filename = fusiontensor_artifact (F)
309321 isfile (filename) || throw (LoadError (filename, 0 , " fusiontensor file not found for $F " ))
310322
311- fusiontensor_dict = Dict {Tuple{Int,Int,Int},SparseArray{ComplexF64,4}} ()
323+ fusiontensor_dict = Dict {Tuple{Int, Int, Int}, SparseArray{ComplexF64, 4}} ()
312324 for line in eachline (filename)
313325 a, b, c, m1, m2, m3, μ, val = parse_fusiontensor (line)
314326
@@ -323,18 +335,20 @@ function extract_fusiontensor(::Type{F}) where {F<:BraidedCategory}
323335 return fusiontensor_dict
324336end
325337
326- function generate_fusiontensor_array (:: Type{F} , a:: Int , b:: Int ,
327- c:: Int ) where {F<: BraidedCategory }
338+ function generate_fusiontensor_array (
339+ :: Type{F} , a:: Int , b:: Int , c:: Int
340+ ) where {F <: BraidedCategory }
328341 a, b, c = Object {F} (a), Object {F} (b), Object {F} (c)
329342 da = dim (a)
330343 db = dim (b)
331344 dc = dim (c)
332345 N = Nsymbol (a, b, c)
333- return SparseArray {ComplexF64,4} (undef, (da, db, dc, N))
346+ return SparseArray {ComplexF64, 4} (undef, (da, db, dc, N))
334347end
335348
336- @generated function TensorKitSectors. fusiontensor (a:: Object{F} , b:: Object{F} ,
337- c:: Object{F} ) where {F<: BraidedCategory }
349+ @generated function TensorKitSectors. fusiontensor (
350+ a:: Object{F} , b:: Object{F} , c:: Object{F}
351+ ) where {F <: BraidedCategory }
338352 local Fdict
339353 try
340354 Fdict = extract_fusiontensor (F)
351365 db = dim (b)
352366 dc = dim (c)
353367 N = Nsymbol (a, b, c)
354- N == 0 && return SparseArray {ComplexF64,4} (undef, (da, db, dc, N))
368+ N == 0 && return SparseArray {ComplexF64, 4} (undef, (da, db, dc, N))
355369 return $ (Fdict)[(a. id, b. id, c. id)]
356370 end
357371end
0 commit comments