@@ -234,94 +234,92 @@ using .TestSetup
234234 end
235235 end
236236 end
237- if isa (UnitStyle (I), SimpleUnit)
238- @testset " Fusion tree $Istr : elementary artin braid" begin
239- N = length (out)
240- isdual = ntuple (n -> rand (Bool), N)
241- for in in ⊗ (out... )
242- for i in 1 : (N - 1 )
243- for f in fusiontrees (out, in, isdual)
244- d1 = @constinferred TK. artin_braid (f, i) # braid between random objects
245- @test norm (values (d1)) ≈ 1
246- d2 = empty (d1)
247- for (f1, coeff1) in d1
248- for (f2, coeff2) in TK. artin_braid (f1, i; inv = true )
249- d2[f2] = get (d2, f2, zero (coeff1)) + coeff2 * coeff1
250- end
237+ (UnitStyle (I) == SimpleUnit) && @testset " Fusion tree $Istr : elementary artin braid" begin
238+ N = length (out)
239+ isdual = ntuple (n -> rand (Bool), N)
240+ for in in ⊗ (out... )
241+ for i in 1 : (N - 1 )
242+ for f in fusiontrees (out, in, isdual)
243+ d1 = @constinferred TK. artin_braid (f, i) # braid between random objects
244+ @test norm (values (d1)) ≈ 1
245+ d2 = empty (d1)
246+ for (f1, coeff1) in d1
247+ for (f2, coeff2) in TK. artin_braid (f1, i; inv = true )
248+ d2[f2] = get (d2, f2, zero (coeff1)) + coeff2 * coeff1
251249 end
252- for (f2, coeff2) in d2
253- if f2 == f
254- @test coeff2 ≈ 1
255- else
256- @test isapprox (coeff2, 0 ; atol = 1.0e-12 , rtol = 1.0e-12 )
257- end
250+ end
251+ for (f2, coeff2) in d2
252+ if f2 == f
253+ @test coeff2 ≈ 1
254+ else
255+ @test isapprox (coeff2, 0 ; atol = 1.0e-12 , rtol = 1.0e-12 )
258256 end
259257 end
260258 end
261259 end
260+ end
262261
263- f = rand (collect (it))
264- d1 = TK. artin_braid (f, 2 )
265- d2 = empty (d1)
266- for (f1, coeff1) in d1
267- for (f2, coeff2) in TK. artin_braid (f1, 3 )
268- d2[f2] = get (d2, f2, zero (coeff1)) + coeff2 * coeff1
269- end
262+ f = rand (collect (it))
263+ d1 = TK. artin_braid (f, 2 )
264+ d2 = empty (d1)
265+ for (f1, coeff1) in d1
266+ for (f2, coeff2) in TK. artin_braid (f1, 3 )
267+ d2[f2] = get (d2, f2, zero (coeff1)) + coeff2 * coeff1
270268 end
271- d1 = d2
272- d2 = empty (d1)
273- for (f1, coeff1) in d1
274- for (f2, coeff2 ) in TK . artin_braid (f1, 3 ; inv = true )
275- d2[f2] = get (d2, f2, zero (coeff1)) + coeff2 * coeff1
276- end
269+ end
270+ d1 = d2
271+ d2 = empty (d1)
272+ for (f1, coeff1 ) in d1
273+ for ( f2, coeff2) in TK . artin_braid (f1, 3 ; inv = true )
274+ d2[f2] = get (d2, f2, zero (coeff1)) + coeff2 * coeff1
277275 end
278- d1 = d2
279- d2 = empty (d1)
280- for (f1, coeff1) in d1
281- for (f2, coeff2 ) in TK . artin_braid (f1, 2 ; inv = true )
282- d2[f2] = get (d2, f2, zero (coeff1)) + coeff2 * coeff1
283- end
276+ end
277+ d1 = d2
278+ d2 = empty (d1)
279+ for (f1, coeff1 ) in d1
280+ for ( f2, coeff2) in TK . artin_braid (f1, 2 ; inv = true )
281+ d2[f2] = get (d2, f2, zero (coeff1)) + coeff2 * coeff1
284282 end
285- d1 = d2
286- for (f1, coeff1) in d1
287- if f1 == f
288- @test coeff1 ≈ 1
289- else
290- @test isapprox (coeff1, 0 ; atol = 1.0e-12 , rtol = 1.0e-12 )
291- end
283+ end
284+ d1 = d2
285+ for (f1, coeff1) in d1
286+ if f1 == f
287+ @test coeff1 ≈ 1
288+ else
289+ @test isapprox (coeff1, 0 ; atol = 1.0e-12 , rtol = 1.0e-12 )
292290 end
293291 end
294- @testset " Fusion tree $Istr : braiding and permuting " begin
295- f = rand ( collect (it))
296- p = tuple ( randperm (N) ... )
297- ip = invperm (p )
298-
299- levels = ntuple (identity, N)
300- d = @constinferred braid (f, levels, p )
301- d2 = Dict {typeof(f), valtype(d)} ( )
302- levels2 = p
303- for (f2, coeff) in d
304- for (f1, coeff2 ) in braid (f2, levels2, ip)
305- d2[f1] = get (d2, f1, zero (coeff)) + coeff2 * coeff
306- end
292+ end
293+ ( UnitStyle (I) == SimpleUnit) && @testset " Fusion tree $Istr : braiding and permuting " begin
294+ f = rand ( collect (it) )
295+ p = tuple ( randperm (N) ... )
296+ ip = invperm (p)
297+
298+ levels = ntuple (identity, N )
299+ d = @constinferred braid (f, levels, p )
300+ d2 = Dict {typeof(f), valtype(d)} ()
301+ levels2 = p
302+ for (f2, coeff ) in d
303+ for ( f1, coeff2) in braid (f2, levels2, ip)
304+ d2[f1] = get (d2, f1, zero (coeff)) + coeff2 * coeff
307305 end
308- for (f1, coeff2) in d2
309- if f1 == f
310- @test coeff2 ≈ 1
311- else
312- @test isapprox (coeff2, 0 ; atol = 1.0e-12 , rtol = 1.0e-12 )
313- end
306+ end
307+ for (f1, coeff2) in d2
308+ if f1 == f
309+ @test coeff2 ≈ 1
310+ else
311+ @test isapprox (coeff2, 0 ; atol = 1.0e-12 , rtol = 1.0e-12 )
314312 end
313+ end
315314
316- if (BraidingStyle (I) isa Bosonic) && hasfusiontensor (I)
317- Af = convert (Array, f)
318- Afp = permutedims (Af, (p... , N + 1 ))
319- Afp2 = zero (Afp)
320- for (f1, coeff) in d
321- Afp2 .+ = coeff .* convert (Array, f1)
322- end
323- @test Afp ≈ Afp2
315+ if (BraidingStyle (I) isa Bosonic) && hasfusiontensor (I)
316+ Af = convert (Array, f)
317+ Afp = permutedims (Af, (p... , N + 1 ))
318+ Afp2 = zero (Afp)
319+ for (f1, coeff) in d
320+ Afp2 .+ = coeff .* convert (Array, f1)
324321 end
322+ @test Afp ≈ Afp2
325323 end
326324 end
327325
0 commit comments