Skip to content

Commit 8e37a8b

Browse files
committed
format test
1 parent ad628dc commit 8e37a8b

File tree

1 file changed

+77
-65
lines changed

1 file changed

+77
-65
lines changed

test/test_A4.jl

Lines changed: 77 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ end
163163
objects = collect(values(I))
164164
for a in objects, b in objects
165165
a.j == b.i || continue # skip if not compatible
166-
@test triangle_equation(a, b; atol=1e-12, rtol=1e-12)
166+
@test triangle_equation(a, b; atol = 1.0e-12, rtol = 1.0e-12)
167167
end
168168
end
169169

@@ -176,7 +176,7 @@ end
176176
b.j == c.i || continue # skip if not compatible
177177
for d in objects
178178
c.j == d.i || continue # skip if not compatible
179-
@test pentagon_equation(a, b, c, d; atol=1e-12, rtol=1e-12)
179+
@test pentagon_equation(a, b, c, d; atol = 1.0e-12, rtol = 1.0e-12)
180180
end
181181
end
182182
end
@@ -303,7 +303,7 @@ println("---------------------------------")
303303
end
304304
end
305305

306-
d = Dict{I,Int}()
306+
d = Dict{I, Int}()
307307
for a in sectors(V), b in sectors(V)
308308
a.j == b.i || continue # skip if not compatible
309309
for c in a b
@@ -312,7 +312,7 @@ println("---------------------------------")
312312
end
313313
@test @constinferred(fuse(V, V)) == GradedSpace(d)
314314
@test @constinferred(flip(V)) ==
315-
Vect[I](conj(c) => dim(V, c) for c in sectors(V))'
315+
Vect[I](conj(c) => dim(V, c) for c in sectors(V))'
316316
@test flip(V) V
317317
@test flip(V) V
318318
@test flip(V) V
@@ -328,11 +328,13 @@ println("---------------------------------")
328328
end
329329

330330
@timedtestset "HomSpace with $(TK.type_repr(Vect[I])) involving ($i, $j)" for i in 1:r, j in 1:r
331-
V1, V2, V3, V4, V5 = (Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
332-
Vect[I]((i, j, label) => 1 for label in 1:MTK._numlabels(I, i, j)),
333-
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)), # same as V1
334-
Vect[I]((i, j, 1) => 3),
335-
Vect[I]((j, j, label) => 1 for label in 1:MTK._numlabels(I, j, j)))
331+
V1, V2, V3, V4, V5 = (
332+
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
333+
Vect[I]((i, j, label) => 1 for label in 1:MTK._numlabels(I, i, j)),
334+
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)), # same as V1
335+
Vect[I]((i, j, 1) => 3),
336+
Vect[I]((j, j, label) => 1 for label in 1:MTK._numlabels(I, j, j)),
337+
)
336338
W = HomSpace(V1 V2, V3 V4 V5)
337339

338340
@test W == (V3 V4 V5 V1 V2)
@@ -362,9 +364,9 @@ println("---------------------------------")
362364
@test_throws BoundsError insertleftunit(W, 0)
363365

364366
@test (V1 V2 rightunitspace(V2) V3 V4 V5) ==
365-
@constinferred(insertrightunit(W, 2))
367+
@constinferred(insertrightunit(W, 2))
366368
@test (V1 V2 leftunitspace(V3) V3 V4 V5) ==
367-
@constinferred(insertleftunit(W, 3))
369+
@constinferred(insertleftunit(W, 3))
368370
@test @constinferred(removeunit(insertleftunit(W, 3), 3)) == W
369371
@test_throws ArgumentError @constinferred(insertrightunit(one(V1) V1, 0)) # should I specify it's the other error?
370372
@test_throws ArgumentError insertleftunit(one(V1) V1, 0)
@@ -470,7 +472,7 @@ println("---------------------------------------")
470472
end
471473
end
472474
# no planar trace tests
473-
475+
474476
@testset "Fusion tree $Istr: elementary artin braid" begin
475477
N = length(out)
476478
isdual = ntuple(n -> rand(Bool), N)
@@ -488,14 +490,14 @@ println("---------------------------------------")
488490
d1 = d2
489491
d2 = empty(d1)
490492
for (f1, coeff1) in d1
491-
for (f2, coeff2) in TK.artin_braid(f1, 3; inv=true)
493+
for (f2, coeff2) in TK.artin_braid(f1, 3; inv = true)
492494
d2[f2] = get(d2, f2, zero(coeff1)) + coeff2 * coeff1
493495
end
494496
end
495497
d1 = d2
496498
d2 = empty(d1)
497499
for (f1, coeff1) in d1
498-
for (f2, coeff2) in TK.artin_braid(f1, 2; inv=true)
500+
for (f2, coeff2) in TK.artin_braid(f1, 2; inv = true)
499501
d2[f2] = get(d2, f2, zero(coeff1)) + coeff2 * coeff1
500502
end
501503
end
@@ -504,7 +506,7 @@ println("---------------------------------------")
504506
if f1 == f
505507
@test coeff1 1
506508
else
507-
@test isapprox(coeff1, 0; atol=1.0e-12, rtol=1.0e-12)
509+
@test isapprox(coeff1, 0; atol = 1.0e-12, rtol = 1.0e-12)
508510
end
509511
end
510512
end
@@ -529,9 +531,11 @@ println("---------------------------------------")
529531
f2 = rand(collect(fusiontrees(out2, in2)))
530532

531533

532-
@test dim(in1) * dim(in2) sum(abs2(coeff) * dim(c) for c in in1 in2
533-
for μ in 1:Nsymbol(in1, in2, c)
534-
for (f, coeff) in TK.merge(f1, f2, c, μ))
534+
@test dim(in1) * dim(in2) sum(
535+
abs2(coeff) * dim(c) for c in in1 in2
536+
for μ in 1:Nsymbol(in1, in2, c)
537+
for (f, coeff) in TK.merge(f1, f2, c, μ)
538+
)
535539
# no merge and braid interplay tests
536540
end
537541

@@ -554,8 +558,8 @@ println("---------------------------------------")
554558
for n in 0:(2 * N)
555559
d = @constinferred TK.repartition(f1, f2, $n)
556560
@test dim(incoming)
557-
sum(abs2(coef) * dim(f1.coupled) for ((f1, f2), coef) in d)
558-
d2 = Dict{typeof((f1, f2)),valtype(d)}()
561+
sum(abs2(coef) * dim(f1.coupled) for ((f1, f2), coef) in d)
562+
d2 = Dict{typeof((f1, f2)), valtype(d)}()
559563
for ((f1′, f2′), coeff) in d
560564
for ((f1′′, f2′′), coeff2) in TK.repartition(f1′, f2′, N)
561565
d2[(f1′′, f2′′)] = get(d2, (f1′′, f2′′), zero(coeff)) + coeff2 * coeff
@@ -565,7 +569,7 @@ println("---------------------------------------")
565569
if f1 == f1′ && f2 == f2′
566570
@test coeff2 1
567571
else
568-
@test isapprox(coeff2, 0; atol=1.0e-12, rtol=1.0e-12)
572+
@test isapprox(coeff2, 0; atol = 1.0e-12, rtol = 1.0e-12)
569573
end
570574
end
571575
end
@@ -586,8 +590,8 @@ println("---------------------------------------")
586590

587591
d = @constinferred transpose(f1, f2, p1, p2)
588592
@test dim(incoming)
589-
sum(abs2(coef) * dim(f1.coupled) for ((f1, f2), coef) in d)
590-
d2 = Dict{typeof((f1, f2)),valtype(d)}()
593+
sum(abs2(coef) * dim(f1.coupled) for ((f1, f2), coef) in d)
594+
d2 = Dict{typeof((f1, f2)), valtype(d)}()
591595
for ((f1′, f2′), coeff) in d
592596
d′ = transpose(f1′, f2′, ip1, ip2)
593597
for ((f1′′, f2′′), coeff2) in d′
@@ -603,16 +607,18 @@ println("---------------------------------------")
603607
end
604608
end
605609
end
606-
610+
607611
@testset "Double fusion tree $Istr: planar trace" begin
608612
d1 = transpose(f1, f1, (N + 1, 1:N..., ((2N):-1:(N + 3))...), (N + 2,))
609613
f1front, = TK.split(f1, N - 1)
610614
T = sectorscalartype(I)
611-
d2 = Dict{typeof((f1front, f1front)),T}()
615+
d2 = Dict{typeof((f1front, f1front)), T}()
612616
for ((f1′, f2′), coeff′) in d1
613617
for ((f1′′, f2′′), coeff′′) in
614-
TK.planar_trace(f1′, f2′, (2:N...,), (1, ((2N):-1:(N + 3))...), (N + 1,),
615-
(N + 2,))
618+
TK.planar_trace(
619+
f1′, f2′, (2:N...,), (1, ((2N):-1:(N + 3))...), (N + 1,),
620+
(N + 2,)
621+
)
616622
coeff = coeff′ * coeff′′
617623
d2[(f1′′, f2′′)] = get(d2, (f1′′, f2′′), zero(coeff)) + coeff
618624
end
@@ -816,27 +822,30 @@ println("---------------------------------------")
816822
@timedtestset "Tensors with symmetry involving $Istr ($i, $j)" verbose = true for i in 1:r, j in 1:r
817823
isdiag = i == j
818824

819-
VC = (Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
820-
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1), # avoids OOMs?
821-
Vect[I](unit(I(i, i, 1)) => 2, rand_object(I, i, i) => 1),
822-
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
823-
Vect[I](unit(I(i, i, 1)) => 2, rand_object(I, i, i) => 3)
824-
)
825+
VC = (
826+
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
827+
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1), # avoids OOMs?
828+
Vect[I](unit(I(i, i, 1)) => 2, rand_object(I, i, i) => 1),
829+
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
830+
Vect[I](unit(I(i, i, 1)) => 2, rand_object(I, i, i) => 3),
831+
)
825832

826-
VM = Vect[I]((i, j, label) => 1 for label in 1:MTK._numlabels(I, i, j)) # all module objects
833+
VM = Vect[I]((i, j, label) => 1 for label in 1:MTK._numlabels(I, i, j)) # all module objects
827834

828-
VM1 = (Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1), # written so V1 ⊗ V2 ← V3 ⊗ V4 ⊗ V5 works
829-
Vect[I](rand_object(I, i, j) => 2), # generally less blocksectors
830-
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1),
831-
VM, # important that V4 is module-graded
832-
Vect[I](unit(I(j, j, 1)) => 2, rand_object(I, j, j) => 1)
835+
VM1 = (
836+
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1), # written so V1 ⊗ V2 ← V3 ⊗ V4 ⊗ V5 works
837+
Vect[I](rand_object(I, i, j) => 2), # generally less blocksectors
838+
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1),
839+
VM, # important that V4 is module-graded
840+
Vect[I](unit(I(j, j, 1)) => 2, rand_object(I, j, j) => 1),
833841
)
834842

835-
VM2 = (Vect[I](rand_object(I, i, j) => 2), # second set where module is V1 here
836-
Vect[I](unit(I(j, j, 1)) => 1, rand_object(I, j, j) => 1),
837-
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1),
838-
VM,
839-
Vect[I](unit(I(j, j, 1)) => 2, rand_object(I, j, j) => 1)
843+
VM2 = (
844+
Vect[I](rand_object(I, i, j) => 2), # second set where module is V1 here
845+
Vect[I](unit(I(j, j, 1)) => 1, rand_object(I, j, j) => 1),
846+
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1),
847+
VM,
848+
Vect[I](unit(I(j, j, 1)) => 2, rand_object(I, j, j) => 1),
840849
)
841850

842851
Vcol = isdiag ? (VC,) : (VM1, VM2) # avoid duplicate runs
@@ -862,7 +871,7 @@ println("---------------------------------------")
862871
next = @constinferred Nothing iterate(bs, state)
863872
b2 = @constinferred block(t, first(blocksectors(t)))
864873
@test b1 == b2
865-
@test eltype(bs) === Pair{typeof(c),typeof(b1)}
874+
@test eltype(bs) === Pair{typeof(c), typeof(b1)}
866875
@test typeof(b1) === TK.blocktype(t)
867876
@test typeof(c) === sectortype(t)
868877
end
@@ -1059,8 +1068,8 @@ println("---------------------------------------")
10591068
for T in (Float32, ComplexF64)
10601069
tA = rand(T, V1 V2, V1 V2) # rewritten for modules
10611070
tB = rand(T, V4 V5, V4 V5)
1062-
tA = 3 // 2 * leftorth(tA; alg=TK.Polar())[1]
1063-
tB = 1 // 5 * leftorth(tB; alg=TK.Polar())[1]
1071+
tA = 3 // 2 * leftorth(tA; alg = TK.Polar())[1]
1072+
tB = 1 // 5 * leftorth(tB; alg = TK.Polar())[1]
10641073
tC = rand(T, V1 V2, V4 V5)
10651074
t = @constinferred sylvester(tA, tB, tC)
10661075
@test codomain(t) == V1 V2
@@ -1146,27 +1155,30 @@ println("---------------------------------------")
11461155
@timedtestset "Factorizations with symmetry involving $Istr ($i, $j)" verbose = true for i in 1:r, j in 1:r
11471156
isdiag = i == j
11481157

1149-
VC = (Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
1150-
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1), # avoids OOMs?
1151-
Vect[I](unit(I(i, i, 1)) => 2, rand_object(I, i, i) => 1),
1152-
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
1153-
Vect[I](unit(I(i, i, 1)) => 2, rand_object(I, i, i) => 3)
1154-
)
1158+
VC = (
1159+
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
1160+
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1), # avoids OOMs?
1161+
Vect[I](unit(I(i, i, 1)) => 2, rand_object(I, i, i) => 1),
1162+
Vect[I]((i, i, label) => 1 for label in 1:MTK._numlabels(I, i, i)),
1163+
Vect[I](unit(I(i, i, 1)) => 2, rand_object(I, i, i) => 3),
1164+
)
11551165

1156-
VM = Vect[I]((i, j, label) => 1 for label in 1:MTK._numlabels(I, i, j)) # all module objects
1166+
VM = Vect[I]((i, j, label) => 1 for label in 1:MTK._numlabels(I, i, j)) # all module objects
11571167

1158-
VM1 = (Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1), # written so V1 ⊗ V2 ← V3 ⊗ V4 ⊗ V5 works
1159-
Vect[I](rand_object(I, i, j) => 2), # generally less blocksectors
1160-
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1),
1161-
VM, # important that V4 is module-graded
1162-
Vect[I](unit(I(j, j, 1)) => 2, rand_object(I, j, j) => 1)
1168+
VM1 = (
1169+
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1), # written so V1 ⊗ V2 ← V3 ⊗ V4 ⊗ V5 works
1170+
Vect[I](rand_object(I, i, j) => 2), # generally less blocksectors
1171+
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1),
1172+
VM, # important that V4 is module-graded
1173+
Vect[I](unit(I(j, j, 1)) => 2, rand_object(I, j, j) => 1),
11631174
)
11641175

1165-
VM2 = (Vect[I](rand_object(I, i, j) => 2), # second set where module is V1 here
1166-
Vect[I](unit(I(j, j, 1)) => 1, rand_object(I, j, j) => 1),
1167-
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1),
1168-
VM,
1169-
Vect[I](unit(I(j, j, 1)) => 2, rand_object(I, j, j) => 1)
1176+
VM2 = (
1177+
Vect[I](rand_object(I, i, j) => 2), # second set where module is V1 here
1178+
Vect[I](unit(I(j, j, 1)) => 1, rand_object(I, j, j) => 1),
1179+
Vect[I](unit(I(i, i, 1)) => 1, rand_object(I, i, i) => 1),
1180+
VM,
1181+
Vect[I](unit(I(j, j, 1)) => 2, rand_object(I, j, j) => 1),
11701182
)
11711183

11721184
Vs = isdiag ? (VC,) : (VM1, VM2) # avoid duplicate runs
@@ -1618,4 +1630,4 @@ println("---------------------------------------")
16181630
end
16191631
end
16201632
end
1621-
end
1633+
end

0 commit comments

Comments
 (0)