From 34cf39f8e267f8dfcc83ae701769bf5aafd44d48 Mon Sep 17 00:00:00 2001 From: lkdvos Date: Wed, 4 Oct 2023 17:34:59 +0200 Subject: [PATCH] Add `Object{E6}` to testcases --- Project.toml | 7 ++----- test/fusiontrees.jl | 8 ++++---- test/sectors.jl | 31 +++++++++++++++++-------------- test/utility.jl | 13 ++++++++++--- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Project.toml b/Project.toml index 97b3824e..457e3120 100644 --- a/Project.toml +++ b/Project.toml @@ -32,17 +32,14 @@ WignerSymbols = "1,2" julia = "1.6" [extras] +CategoryData = "8fccf25a-f50e-468c-8fba-3cb130506274" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a" Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000" -HalfIntegers = "f0d1745a-41c9-11e9-1dd9-e5d34d218721" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a" -WignerSymbols = "9f57e263-0b3d-5e2e-b1be-24f2bb48858b" [targets] -test = ["Combinatorics", "HalfIntegers", "LinearAlgebra", "Random", "TensorOperations", "Test", "TestExtras", "WignerSymbols", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences"] +test = ["Combinatorics", "Random", "Test", "TestExtras", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "CategoryData"] diff --git a/test/fusiontrees.jl b/test/fusiontrees.jl index 34840f0c..2259d195 100644 --- a/test/fusiontrees.jl +++ b/test/fusiontrees.jl @@ -53,6 +53,7 @@ include("utility.jl") @test c′ == one(c′) return t′ end + BraidingStyle(I) isa NoBraiding && continue braid_i_to_1 = braid(f1, levels, (i, (1:(i - 1))..., ((i + 1):N)...)) trees2 = Dict(_reinsert_partial_tree(t, f2) => c for (t, c) in braid_i_to_1) trees3 = empty(trees2) @@ -175,7 +176,7 @@ include("utility.jl") end end end - @testset "elementy artin braid" begin + BraidingStyle(I) isa NoBraiding || @testset "elementy artin braid" begin N = length(out) isdual = ntuple(n -> rand(Bool), N) for in in ⊗(out...) @@ -231,7 +232,7 @@ include("utility.jl") end end end - @testset "braiding and permuting" begin + BraidingStyle(I) isa NoBraiding || @testset "braiding and permuting" begin f = rand(collect(fusiontrees(out, in, isdual))) p = tuple(randperm(N)...) ip = invperm(p) @@ -281,8 +282,7 @@ include("utility.jl") @test dim(in1) * dim(in2) ≈ sum(abs2(coeff) * dim(c) for c in in1 ⊗ in2 for μ in 1:Nsymbol(in1, in2, c) for (f, coeff) in TensorKit.merge(f1, f2, c, μ)) - - for c in in1 ⊗ in2 + BraidingStyle(I) isa NoBraiding || for c in in1 ⊗ in2 R = Rsymbol(in1, in2, c) for μ in 1:Nsymbol(in1, in2, c) μ′ = FusionStyle(I) isa GenericFusion ? μ : nothing diff --git a/test/sectors.jl b/test/sectors.jl index a2e08ae0..5fb6ff40 100644 --- a/test/sectors.jl +++ b/test/sectors.jl @@ -18,7 +18,7 @@ include("utility.jl") @constinferred dim(s[1]) @constinferred frobeniusschur(s[1]) @constinferred Nsymbol(s...) - @constinferred Rsymbol(s...) + BraidingStyle(I) isa NoBraiding || @constinferred Rsymbol(s...) @constinferred Bsymbol(s...) @constinferred Fsymbol(s..., s...) it = @constinferred s[1] ⊗ s[2] @@ -82,9 +82,11 @@ include("utility.jl") @test pentagon_equation(a, b, c, d; atol=1e-12, rtol=1e-12) end end - @testset "Hexagon equation" begin - for a in smallset(I), b in smallset(I), c in smallset(I) - @test hexagon_equation(a, b, c; atol=1e-12, rtol=1e-12) + if !(BraidingStyle(I) isa NoBraiding) + @testset "Hexagon equation" begin + for a in smallset(I), b in smallset(I), c in smallset(I) + @test hexagon_equation(a, b, c; atol=1e-12, rtol=1e-12) + end end end @@ -110,16 +112,17 @@ include("utility.jl") end end end - - @testset "Fusion tensor and R-move" begin - for a in smallset(I), b in smallset(I) - for c in ⊗(a, b) - X1 = permutedims(fusiontensor(a, b, c), (2, 1, 3, 4)) - X2 = fusiontensor(b, a, c) - l = dim(a) * dim(b) * dim(c) - R = LinearAlgebra.transpose(Rsymbol(a, b, c)) - sz = (l, convert(Int, Nsymbol(a, b, c))) - @test reshape(X1, sz) ≈ reshape(X2, sz) * R + if !(BraidingStyle(I) isa NoBraiding) + @testset "Fusion tensor and R-move" begin + for a in smallset(I), b in smallset(I) + for c in ⊗(a, b) + X1 = permutedims(fusiontensor(a, b, c), (2, 1, 3, 4)) + X2 = fusiontensor(b, a, c) + l = dim(a) * dim(b) * dim(c) + R = LinearAlgebra.transpose(Rsymbol(a, b, c)) + sz = (l, convert(Int, Nsymbol(a, b, c))) + @test reshape(X1, sz) ≈ reshape(X2, sz) * R + end end end end diff --git a/test/utility.jl b/test/utility.jl index ce532728..167f1449 100644 --- a/test/utility.jl +++ b/test/utility.jl @@ -1,12 +1,13 @@ using Base.Iterators: take, product using TensorKit using TensorKit: ProductSector, Trivial, fusiontensor -using TensorKit: pentagon_equation, hexagon_equation +using TensorKit: pentagon_equation, hexagon_equation, NoBraiding using TensorOperations using Test, TestExtras using Random using LinearAlgebra: LinearAlgebra using Combinatorics +using CategoryData Random.seed!(1234) @@ -18,7 +19,7 @@ sectorlist = (Z2Irrep, Z3Irrep, Z4Irrep, U1Irrep, CU1Irrep, SU2Irrep, NewSU2Irre FibonacciAnyon, IsingAnyon, FermionParity, FermionNumber, FermionSpin, Z3Irrep ⊠ Z4Irrep, FermionParity ⊠ U1Irrep ⊠ SU2Irrep, FermionParity ⊠ SU2Irrep ⊠ SU2Irrep, NewSU2Irrep ⊠ NewSU2Irrep, - Z2Irrep ⊠ FibonacciAnyon ⊠ FibonacciAnyon) + Z2Irrep ⊠ FibonacciAnyon ⊠ FibonacciAnyon, Object{E6}) spacelist = Dict(Trivial => (ℂ^3, (ℂ^4)', ℂ^5, ℂ^6, (ℂ^7)'), Z2Irrep => (ℂ[Z2Irrep](0 => 1, 1 => 1), ℂ[Z2Irrep](0 => 1, 1 => 2)', @@ -57,7 +58,13 @@ spacelist = Dict(Trivial => (ℂ^3, (ℂ^4)', ℂ^5, ℂ^6, (ℂ^7)'), ℂ[FermionSpin](0 => 2, 1 => 1), ℂ[FermionSpin](1 // 2 => 1, 1 => 1)', ℂ[FermionSpin](0 => 2, 1 // 2 => 2), - ℂ[FermionSpin](0 => 1, 1 // 2 => 1, 3 // 2 => 1)')) + ℂ[FermionSpin](0 => 1, 1 // 2 => 1, 3 // 2 => 1)'), + Object{E6} => (ℂ[Object{E6}](1 => 1, 3 => 1), + ℂ[Object{E6}](2 => 1, 3 => 1)', + ℂ[Object{E6}](1 => 1, 3 => 1), + ℂ[Object{E6}](1 => 1, 3 => 1), + ℂ[Object{E6}](1 => 1, 2 => 1, 3 => 1)' + )) smallset(::Type{I}) where {I<:Sector} = take(values(I), 5) function smallset(::Type{ProductSector{Tuple{I1,I2}}}) where {I1,I2}