Skip to content

Commit 77bb1c1

Browse files
committed
some cleanup
1 parent 022c368 commit 77bb1c1

File tree

3 files changed

+43
-45
lines changed

3 files changed

+43
-45
lines changed

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const sectorlist = (
4040
include("testsuite.jl")
4141
using .SectorTestSuite
4242

43-
foreach(SectorTestSuite.test, sectorlist)
43+
foreach(SectorTestSuite.test_sector, sectorlist)
4444

4545
@testset "Deligne product" begin
4646
sectorlist′ = (Trivial, sectorlist...)

test/sectors.jl

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using .TestSetup: smallset, randsector, hasfusiontensor
2-
using .SectorTestSuite: @testsuite
3-
using TensorKitSectors
41
using TensorOperations
52
using LinearAlgebra
63

@@ -55,49 +52,51 @@ end
5552
end
5653
end
5754

58-
@testsuite "fusion tensor and F-move and R-move" I -> begin
59-
if BraidingStyle(I) isa Bosonic && hasfusiontensor(I)
60-
for a in smallset(I), b in smallset(I)
61-
for c in (a, b)
62-
X1 = permutedims(fusiontensor(a, b, c), (2, 1, 3, 4))
63-
X2 = fusiontensor(b, a, c)
64-
l = dim(a) * dim(b) * dim(c)
65-
R = LinearAlgebra.transpose(Rsymbol(a, b, c))
66-
sz = (l, convert(Int, Nsymbol(a, b, c)))
67-
@test reshape(X1, sz) reshape(X2, sz) * R
68-
end
69-
end
70-
for a in smallset(I), b in smallset(I), c in smallset(I)
71-
for e in (a, b), f in (b, c)
72-
for d in intersect((e, c), (a, f))
73-
X1 = fusiontensor(a, b, e)
74-
X2 = fusiontensor(e, c, d)
75-
Y1 = fusiontensor(b, c, f)
76-
Y2 = fusiontensor(a, f, d)
77-
@tensor f1[-1, -2, -3, -4] := conj(Y2[a, f, d, -4]) *
78-
conj(Y1[b, c, f, -3]) * X1[a, b, e, -1] * X2[e, c, d, -2]
79-
if FusionStyle(I) isa MultiplicityFreeFusion
80-
f2 = fill(Fsymbol(a, b, c, d, e, f) * dim(d), (1, 1, 1, 1))
81-
else
82-
f2 = Fsymbol(a, b, c, d, e, f) * dim(d)
83-
end
84-
@test isapprox(f1, f2; atol = 1.0e-12, rtol = 1.0e-12)
55+
@testsuite "fusion tensor and F-move" I -> begin
56+
(BraidingStyle(I) isa Bosonic && hasfusiontensor(I)) || return nothing
57+
for a in smallset(I), b in smallset(I), c in smallset(I)
58+
for e in (a, b), f in (b, c)
59+
for d in intersect((e, c), (a, f))
60+
X1 = fusiontensor(a, b, e)
61+
X2 = fusiontensor(e, c, d)
62+
Y1 = fusiontensor(b, c, f)
63+
Y2 = fusiontensor(a, f, d)
64+
@tensor f1[-1, -2, -3, -4] := conj(Y2[a, f, d, -4]) *
65+
conj(Y1[b, c, f, -3]) * X1[a, b, e, -1] * X2[e, c, d, -2]
66+
if FusionStyle(I) isa MultiplicityFreeFusion
67+
f2 = fill(Fsymbol(a, b, c, d, e, f) * dim(d), (1, 1, 1, 1))
68+
else
69+
f2 = Fsymbol(a, b, c, d, e, f) * dim(d)
8570
end
71+
@test isapprox(f1, f2; atol = 1.0e-12, rtol = 1.0e-12)
8672
end
8773
end
8874
end
8975
end
9076

77+
@testsuite "fusion tensor and F-move and R-move" I -> begin
78+
(BraidingStyle(I) isa Bosonic && hasfusiontensor(I)) || return nothing
79+
for a in smallset(I), b in smallset(I)
80+
for c in (a, b)
81+
X1 = permutedims(fusiontensor(a, b, c), (2, 1, 3, 4))
82+
X2 = fusiontensor(b, a, c)
83+
l = dim(a) * dim(b) * dim(c)
84+
R = LinearAlgebra.transpose(Rsymbol(a, b, c))
85+
sz = (l, convert(Int, Nsymbol(a, b, c)))
86+
@test reshape(X1, sz) reshape(X2, sz) * R
87+
end
88+
end
89+
end
90+
9191
@testsuite "Orthogonality of fusiontensors" I -> begin
92-
if hasfusiontensor(I)
93-
for a in smallset(I), b in smallset(I)
94-
cs = vec(collect(a b))
95-
CGCs = map(c -> reshape(fusiontensor(a, b, c), :, dim(c)), cs)
96-
M = map(Iterators.product(CGCs, CGCs)) do (cgc1, cgc2)
97-
return LinearAlgebra.norm(cgc1' * cgc2)
98-
end
99-
@test isapprox(M' * M, LinearAlgebra.Diagonal(dim.(cs)); atol = 1.0e-12)
92+
hasfusiontensor(I) || return nothing
93+
for a in smallset(I), b in smallset(I)
94+
cs = vec(collect(a b))
95+
CGCs = map(c -> reshape(fusiontensor(a, b, c), :, dim(c)), cs)
96+
M = map(Iterators.product(CGCs, CGCs)) do (cgc1, cgc2)
97+
return LinearAlgebra.norm(cgc1' * cgc2)
10098
end
99+
@test isapprox(M' * M, LinearAlgebra.Diagonal(dim.(cs)); atol = 1.0e-12)
101100
end
102101
end
103102

@@ -135,9 +134,8 @@ end
135134
end
136135

137136
@testsuite "Hexagon equation" I -> begin
138-
if BraidingStyle(I) isa HasBraiding
139-
for a in smallset(I), b in smallset(I), c in smallset(I)
140-
@test hexagon_equation(a, b, c; atol = 1.0e-12, rtol = 1.0e-12)
141-
end
137+
BraidingStyle(I) isa HasBraiding || return nothing
138+
for a in smallset(I), b in smallset(I), c in smallset(I)
139+
@test hexagon_equation(a, b, c; atol = 1.0e-12, rtol = 1.0e-12)
142140
end
143141
end

test/testsuite.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ end
5858
5959
Runs the entire TensorKitSectors test suite on sector type `I`.
6060
"""
61-
function test_sectortype(I::Type)
62-
return @testset "$(TKS.type_repr(I))" begin
61+
function test_sector(I::Type)
62+
return @testset "$(type_repr(I))" begin
6363
for (name, fun) in tests
6464
code = quote
6565
$fun($I)

0 commit comments

Comments
 (0)