From 77df75d79f92d3e1bf6ff794ae5e3cda698be371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Gauth=C3=A9?= Date: Fri, 11 Oct 2024 14:25:06 -0400 Subject: [PATCH] remove julia1.6 specific @inferred_latest --- .../test/test_sector_product.jl | 269 +++++++++--------- 1 file changed, 128 insertions(+), 141 deletions(-) diff --git a/NDTensors/src/lib/SymmetrySectors/test/test_sector_product.jl b/NDTensors/src/lib/SymmetrySectors/test/test_sector_product.jl index 8cee6c2d3f..fe73afacc2 100644 --- a/NDTensors/src/lib/SymmetrySectors/test/test_sector_product.jl +++ b/NDTensors/src/lib/SymmetrySectors/test/test_sector_product.jl @@ -18,56 +18,49 @@ using NDTensors.SymmetrySectors: using NDTensors.GradedAxes: dual, fusion_product, space_isequal, gradedrange using Test: @inferred, @test, @testset, @test_throws -macro inferred_latest(ex) - if VERSION < v"1.10" - return esc(:($ex)) - end - return esc(:(@inferred $ex)) -end - @testset "Test Ordered Products" begin @testset "Ordered Constructor" begin s = SectorProduct(U1(1)) @test length(product_sectors(s)) == 1 - @test (@inferred_latest quantum_dimension(s)) == 1 - @test (@inferred_latest dual(s)) == SectorProduct(U1(-1)) + @test (@inferred quantum_dimension(s)) == 1 + @test (@inferred dual(s)) == SectorProduct(U1(-1)) @test product_sectors(s)[1] == U1(1) - @test (@inferred_latest trivial(s)) == SectorProduct(U1(0)) + @test (@inferred trivial(s)) == SectorProduct(U1(0)) s = SectorProduct(U1(1), U1(2)) @test length(product_sectors(s)) == 2 - @test (@inferred_latest quantum_dimension(s)) == 1 - @test (@inferred_latest dual(s)) == SectorProduct(U1(-1), U1(-2)) + @test (@inferred quantum_dimension(s)) == 1 + @test (@inferred dual(s)) == SectorProduct(U1(-1), U1(-2)) @test product_sectors(s)[1] == U1(1) @test product_sectors(s)[2] == U1(2) - @test (@inferred_latest trivial(s)) == SectorProduct(U1(0), U1(0)) + @test (@inferred trivial(s)) == SectorProduct(U1(0), U1(0)) s = U1(1) × SU2(1//2) × U1(3) @test length(product_sectors(s)) == 3 - @test (@inferred_latest quantum_dimension(s)) == 2 - @test (@inferred_latest dual(s)) == U1(-1) × SU2(1//2) × U1(-3) + @test (@inferred quantum_dimension(s)) == 2 + @test (@inferred dual(s)) == U1(-1) × SU2(1//2) × U1(-3) @test product_sectors(s)[1] == U1(1) @test product_sectors(s)[2] == SU2(1//2) @test product_sectors(s)[3] == U1(3) - @test (@inferred_latest trivial(s)) == SectorProduct(U1(0), SU2(0), U1(0)) - @test (@inferred_latest recover_sector_product_type( + @test (@inferred trivial(s)) == SectorProduct(U1(0), SU2(0), U1(0)) + @test (@inferred recover_sector_product_type( typeof(product_sectors(s)), product_sectors(s) )) == s s = U1(3) × SU2(1//2) × Fib("τ") @test length(product_sectors(s)) == 3 - @test (@inferred_latest quantum_dimension(s)) == 1.0 + √5 + @test (@inferred quantum_dimension(s)) == 1.0 + √5 @test dual(s) == U1(-3) × SU2(1//2) × Fib("τ") @test product_sectors(s)[1] == U1(3) @test product_sectors(s)[2] == SU2(1//2) @test product_sectors(s)[3] == Fib("τ") - @test (@inferred_latest trivial(s)) == SectorProduct(U1(0), SU2(0), Fib("1")) + @test (@inferred trivial(s)) == SectorProduct(U1(0), SU2(0), Fib("1")) s = TrivialSector() × U1(3) × SU2(1 / 2) @test length(product_sectors(s)) == 3 - @test (@inferred_latest quantum_dimension(s)) == 2 + @test (@inferred quantum_dimension(s)) == 2 @test dual(s) == TrivialSector() × U1(-3) × SU2(1//2) - @test (@inferred_latest trivial(s)) == SectorProduct(TrivialSector(), U1(0), SU2(0)) + @test (@inferred trivial(s)) == SectorProduct(TrivialSector(), U1(0), SU2(0)) @test s > trivial(s) end @@ -92,7 +85,7 @@ end @testset "Quantum dimension and GradedUnitRange" begin g = gradedrange([(U1(0) × Z{2}(0)) => 1, (U1(1) × Z{2}(0)) => 2]) # abelian - @test (@inferred_latest quantum_dimension(g)) == 3 + @test (@inferred quantum_dimension(g)) == 3 g = gradedrange([ # non-abelian (SU2(0) × SU2(0)) => 1, @@ -100,29 +93,29 @@ end (SU2(0) × SU2(1)) => 1, (SU2(1) × SU2(1)) => 1, ]) - @test (@inferred_latest quantum_dimension(g)) == 16 - @test (@inferred_latest block_dimensions(g)) == [1, 3, 3, 9] + @test (@inferred quantum_dimension(g)) == 16 + @test (@inferred block_dimensions(g)) == [1, 3, 3, 9] # mixed group g = gradedrange([(U1(2) × SU2(0) × Z{2}(0)) => 1, (U1(2) × SU2(1) × Z{2}(0)) => 1]) - @test (@inferred_latest quantum_dimension(g)) == 4 - @test (@inferred_latest block_dimensions(g)) == [1, 3] + @test (@inferred quantum_dimension(g)) == 4 + @test (@inferred block_dimensions(g)) == [1, 3] g = gradedrange([(SU2(0) × U1(0) × SU2(1//2)) => 1, (SU2(0) × U1(1) × SU2(1//2)) => 1]) - @test (@inferred_latest quantum_dimension(g)) == 4 - @test (@inferred_latest block_dimensions(g)) == [2, 2] + @test (@inferred quantum_dimension(g)) == 4 + @test (@inferred block_dimensions(g)) == [2, 2] # NonGroupCategory g_fib = gradedrange([(Fib("1") × Fib("1")) => 1]) g_ising = gradedrange([(Ising("1") × Ising("1")) => 1]) - @test (@inferred_latest quantum_dimension((Fib("1") × Fib("1")))) == 1.0 - @test (@inferred_latest quantum_dimension(g_fib)) == 1.0 - @test (@inferred_latest quantum_dimension(g_ising)) == 1.0 - @test (@inferred_latest quantum_dimension((Ising("1") × Ising("1")))) == 1.0 - @test (@inferred_latest block_dimensions(g_fib)) == [1.0] - @test (@inferred_latest block_dimensions(g_ising)) == [1.0] + @test (@inferred quantum_dimension((Fib("1") × Fib("1")))) == 1.0 + @test (@inferred quantum_dimension(g_fib)) == 1.0 + @test (@inferred quantum_dimension(g_ising)) == 1.0 + @test (@inferred quantum_dimension((Ising("1") × Ising("1")))) == 1.0 + @test (@inferred block_dimensions(g_fib)) == [1.0] + @test (@inferred block_dimensions(g_ising)) == [1.0] - @test (@inferred_latest quantum_dimension(U1(1) × Fib("1"))) == 1.0 - @test (@inferred_latest quantum_dimension(gradedrange([U1(1) × Fib("1") => 1]))) == 1.0 + @test (@inferred quantum_dimension(U1(1) × Fib("1"))) == 1.0 + @test (@inferred quantum_dimension(gradedrange([U1(1) × Fib("1") => 1]))) == 1.0 # mixed product Abelian / NonAbelian / NonGroup g = gradedrange([ @@ -131,8 +124,8 @@ end (U1(2) × SU2(0) × Ising("ψ")) => 1, (U1(2) × SU2(1) × Ising("ψ")) => 1, ]) - @test (@inferred_latest quantum_dimension(g)) == 8.0 - @test (@inferred_latest block_dimensions(g)) == [1.0, 3.0, 1.0, 3.0] + @test (@inferred quantum_dimension(g)) == 8.0 + @test (@inferred block_dimensions(g)) == [1.0, 3.0, 1.0, 3.0] ϕ = (1 + √5) / 2 g = gradedrange([ @@ -141,36 +134,36 @@ end (Fib("τ") × SU2(0) × U1(2)) => 1, (Fib("τ") × SU2(1) × U1(2)) => 1, ]) - @test (@inferred_latest quantum_dimension(g)) == 4.0 + 4.0ϕ - @test (@inferred_latest block_dimensions(g)) == [1.0, 3.0, 1.0ϕ, 3.0ϕ] + @test (@inferred quantum_dimension(g)) == 4.0 + 4.0ϕ + @test (@inferred block_dimensions(g)) == [1.0, 3.0, 1.0ϕ, 3.0ϕ] end @testset "Fusion of Abelian products" begin p1 = SectorProduct(U1(1)) p2 = SectorProduct(U1(2)) - @test (@inferred_latest p1 ⊗ TrivialSector()) == p1 - @test (@inferred_latest TrivialSector() ⊗ p2) == p2 - @test (@inferred_latest p1 ⊗ p2) == SectorProduct(U1(3)) + @test (@inferred p1 ⊗ TrivialSector()) == p1 + @test (@inferred TrivialSector() ⊗ p2) == p2 + @test (@inferred p1 ⊗ p2) == SectorProduct(U1(3)) p11 = U1(1) × U1(1) - @test (@inferred_latest p11 ⊗ p11) == U1(2) × U1(2) + @test (@inferred p11 ⊗ p11) == U1(2) × U1(2) p123 = U1(1) × U1(2) × U1(3) - @test (@inferred_latest p123 ⊗ p123) == U1(2) × U1(4) × U1(6) + @test (@inferred p123 ⊗ p123) == U1(2) × U1(4) × U1(6) s1 = SectorProduct(U1(1), Z{2}(1)) s2 = SectorProduct(U1(0), Z{2}(0)) - @test (@inferred_latest s1 ⊗ s2) == U1(1) × Z{2}(1) + @test (@inferred s1 ⊗ s2) == U1(1) × Z{2}(1) end @testset "Fusion of NonAbelian products" begin p0 = SectorProduct(SU2(0)) ph = SectorProduct(SU2(1//2)) @test space_isequal( - (@inferred_latest p0 ⊗ TrivialSector()), gradedrange([SectorProduct(SU2(0)) => 1]) + (@inferred p0 ⊗ TrivialSector()), gradedrange([SectorProduct(SU2(0)) => 1]) ) @test space_isequal( - (@inferred_latest TrivialSector() ⊗ ph), gradedrange([SectorProduct(SU2(1//2)) => 1]) + (@inferred TrivialSector() ⊗ ph), gradedrange([SectorProduct(SU2(1//2)) => 1]) ) phh = SU2(1//2) × SU2(1//2) @@ -184,7 +177,7 @@ end ]), ) @test space_isequal( - (@inferred_latest phh ⊗ phh), + (@inferred phh ⊗ phh), gradedrange([ (SU2(0) × SU2(0)) => 1, (SU2(1) × SU2(0)) => 1, @@ -198,11 +191,11 @@ end ı = Fib("1") τ = Fib("τ") s = ı × ı - @test space_isequal((@inferred_latest s ⊗ s), gradedrange([s => 1])) + @test space_isequal((@inferred s ⊗ s), gradedrange([s => 1])) s = τ × τ @test space_isequal( - (@inferred_latest s ⊗ s), + (@inferred s ⊗ s), gradedrange([(ı × ı) => 1, (τ × ı) => 1, (ı × τ) => 1, (τ × τ) => 1]), ) @@ -212,20 +205,19 @@ end g = gradedrange([ (ı × Ising("1")) => 1, (τ × Ising("1")) => 1, (ı × ψ) => 1, (τ × ψ) => 1 ]) - @test space_isequal((@inferred_latest s ⊗ s), g) + @test space_isequal((@inferred s ⊗ s), g) end @testset "Fusion of mixed Abelian and NonAbelian products" begin p2h = U1(2) × SU2(1//2) p1h = U1(1) × SU2(1//2) @test space_isequal( - (@inferred_latest p2h ⊗ p1h), - gradedrange([(U1(3) × SU2(0)) => 1, (U1(3) × SU2(1)) => 1]), + (@inferred p2h ⊗ p1h), gradedrange([(U1(3) × SU2(0)) => 1, (U1(3) × SU2(1)) => 1]) ) p1h1 = U1(1) × SU2(1//2) × Z{2}(1) @test space_isequal( - (@inferred_latest p1h1 ⊗ p1h1), + (@inferred p1h1 ⊗ p1h1), gradedrange([(U1(2) × SU2(0) × Z{2}(0)) => 1, (U1(2) × SU2(1) × Z{2}(0)) => 1]), ) end @@ -233,7 +225,7 @@ end @testset "Fusion of fully mixed products" begin s = U1(1) × SU2(1//2) × Ising("σ") @test space_isequal( - (@inferred_latest s ⊗ s), + (@inferred s ⊗ s), gradedrange([ (U1(2) × SU2(0) × Ising("1")) => 1, (U1(2) × SU2(1) × Ising("1")) => 1, @@ -246,7 +238,7 @@ end τ = Fib("τ") s = SU2(1//2) × U1(1) × τ @test space_isequal( - (@inferred_latest s ⊗ s), + (@inferred s ⊗ s), gradedrange([ (SU2(0) × U1(2) × ı) => 1, (SU2(1) × U1(2) × ı) => 1, @@ -257,7 +249,7 @@ end s = U1(1) × ı × τ @test space_isequal( - (@inferred_latest s ⊗ s), gradedrange([(U1(2) × ı × ı) => 1, (U1(2) × ı × τ) => 1]) + (@inferred s ⊗ s), gradedrange([(U1(2) × ı × ı) => 1, (U1(2) × ı × τ) => 1]) ) end @@ -265,16 +257,16 @@ end @test SectorProduct(U1(1) × U1(0)) ⊗ SectorProduct(U1(1)) == SectorProduct(U1(2) × U1(0)) @test space_isequal( - (@inferred_latest SectorProduct(SU2(0) × SU2(0)) ⊗ SectorProduct(SU2(1))), + (@inferred SectorProduct(SU2(0) × SU2(0)) ⊗ SectorProduct(SU2(1))), gradedrange([SectorProduct(SU2(1) × SU2(0)) => 1]), ) @test space_isequal( - (@inferred_latest SectorProduct(SU2(1) × U1(1)) ⊗ SectorProduct(SU2(0))), + (@inferred SectorProduct(SU2(1) × U1(1)) ⊗ SectorProduct(SU2(0))), gradedrange([SectorProduct(SU2(1) × U1(1)) => 1]), ) @test space_isequal( - (@inferred_latest SectorProduct(U1(1) × SU2(1)) ⊗ SectorProduct(U1(2))), + (@inferred SectorProduct(U1(1) × SU2(1)) ⊗ SectorProduct(U1(2))), gradedrange([SectorProduct(U1(3) × SU2(1)) => 1]), ) @@ -290,7 +282,7 @@ end g1 = gradedrange([s1 => 2]) g2 = gradedrange([s2 => 1]) @test space_isequal( - (@inferred_latest fusion_product(g1, g2)), + (@inferred fusion_product(g1, g2)), gradedrange([U1(1) × SU2(0) × Ising("σ") => 2, U1(1) × SU2(1) × Ising("σ") => 2]), ) end @@ -302,18 +294,18 @@ end @test length(product_sectors(s)) == 2 @test product_sectors(s)[:A] == U1(1) @test product_sectors(s)[:B] == Z{2}(0) - @test (@inferred_latest quantum_dimension(s)) == 1 - @test (@inferred_latest dual(s)) == (A=U1(-1),) × (B=Z{2}(0),) - @test (@inferred_latest trivial(s)) == (A=U1(0),) × (B=Z{2}(0),) + @test (@inferred quantum_dimension(s)) == 1 + @test (@inferred dual(s)) == (A=U1(-1),) × (B=Z{2}(0),) + @test (@inferred trivial(s)) == (A=U1(0),) × (B=Z{2}(0),) s = (A=U1(1),) × (B=SU2(2),) @test length(product_sectors(s)) == 2 @test product_sectors(s)[:A] == U1(1) @test product_sectors(s)[:B] == SU2(2) - @test (@inferred_latest quantum_dimension(s)) == 5 - @test (@inferred_latest dual(s)) == (A=U1(-1),) × (B=SU2(2),) - @test (@inferred_latest trivial(s)) == (A=U1(0),) × (B=SU2(0),) - @test (@inferred_latest recover_sector_product_type( + @test (@inferred quantum_dimension(s)) == 5 + @test (@inferred dual(s)) == (A=U1(-1),) × (B=SU2(2),) + @test (@inferred trivial(s)) == (A=U1(0),) × (B=SU2(0),) + @test (@inferred recover_sector_product_type( typeof(product_sectors(s)), Tuple(product_sectors(s)) )) == s @test s == (B=SU2(2),) × (A=U1(1),) @@ -321,8 +313,8 @@ end s = s × (C=Ising("ψ"),) @test length(product_sectors(s)) == 3 @test product_sectors(s)[:C] == Ising("ψ") - @test (@inferred_latest quantum_dimension(s)) == 5.0 - @test (@inferred_latest dual(s)) == (A=U1(-1),) × (B=SU2(2),) × (C=Ising("ψ"),) + @test (@inferred quantum_dimension(s)) == 5.0 + @test (@inferred dual(s)) == (A=U1(-1),) × (B=SU2(2),) × (C=Ising("ψ"),) s1 = (A=U1(1),) × (B=Z{2}(0),) s2 = (A=U1(1),) × (C=Z{2}(0),) @@ -334,15 +326,15 @@ end @test length(product_sectors(s)) == 1 @test product_sectors(s)[:A] == U1(2) @test s == SectorProduct(; A=U1(2)) - @test (@inferred_latest quantum_dimension(s)) == 1 - @test (@inferred_latest dual(s)) == SectorProduct("A" => U1(-2)) - @test (@inferred_latest trivial(s)) == SectorProduct(; A=U1(0)) + @test (@inferred quantum_dimension(s)) == 1 + @test (@inferred dual(s)) == SectorProduct("A" => U1(-2)) + @test (@inferred trivial(s)) == SectorProduct(; A=U1(0)) s = SectorProduct("B" => Ising("ψ"), :C => Z{2}(1)) @test length(product_sectors(s)) == 2 @test product_sectors(s)[:B] == Ising("ψ") @test product_sectors(s)[:C] == Z{2}(1) - @test (@inferred_latest quantum_dimension(s)) == 1.0 + @test (@inferred quantum_dimension(s)) == 1.0 end @testset "Comparisons with unspecified labels" begin @@ -370,7 +362,7 @@ end g = gradedrange([ SectorProduct(; A=U1(0), B=Z{2}(0)) => 1, SectorProduct(; A=U1(1), B=Z{2}(0)) => 2 ]) # abelian - @test (@inferred_latest quantum_dimension(g)) == 3 + @test (@inferred quantum_dimension(g)) == 3 g = gradedrange([ # non-abelian SectorProduct(; A=SU2(0), B=SU2(0)) => 1, @@ -378,25 +370,25 @@ end SectorProduct(; A=SU2(0), B=SU2(1)) => 1, SectorProduct(; A=SU2(1), B=SU2(1)) => 1, ]) - @test (@inferred_latest quantum_dimension(g)) == 16 + @test (@inferred quantum_dimension(g)) == 16 # mixed group g = gradedrange([ SectorProduct(; A=U1(2), B=SU2(0), C=Z{2}(0)) => 1, SectorProduct(; A=U1(2), B=SU2(1), C=Z{2}(0)) => 1, ]) - @test (@inferred_latest quantum_dimension(g)) == 4 + @test (@inferred quantum_dimension(g)) == 4 g = gradedrange([ SectorProduct(; A=SU2(0), B=Z{2}(0), C=SU2(1//2)) => 1, SectorProduct(; A=SU2(0), B=Z{2}(1), C=SU2(1//2)) => 1, ]) - @test (@inferred_latest quantum_dimension(g)) == 4 + @test (@inferred quantum_dimension(g)) == 4 # non group sectors g_fib = gradedrange([SectorProduct(; A=Fib("1"), B=Fib("1")) => 1]) g_ising = gradedrange([SectorProduct(; A=Ising("1"), B=Ising("1")) => 1]) - @test (@inferred_latest quantum_dimension(g_fib)) == 1.0 - @test (@inferred_latest quantum_dimension(g_ising)) == 1.0 + @test (@inferred quantum_dimension(g_fib)) == 1.0 + @test (@inferred quantum_dimension(g_ising)) == 1.0 # mixed product Abelian / NonAbelian / NonGroup g = gradedrange([ @@ -405,7 +397,7 @@ end SectorProduct(; A=U1(2), B=SU2(0), C=Ising("ψ")) => 1, SectorProduct(; A=U1(2), B=SU2(1), C=Ising("ψ")) => 1, ]) - @test (@inferred_latest quantum_dimension(g)) == 8.0 + @test (@inferred quantum_dimension(g)) == 8.0 g = gradedrange([ SectorProduct(; A=Fib("1"), B=SU2(0), C=U1(2)) => 1, @@ -413,7 +405,7 @@ end SectorProduct(; A=Fib("τ"), B=SU2(0), C=U1(2)) => 1, SectorProduct(; A=Fib("τ"), B=SU2(1), C=U1(2)) => 1, ]) - @test (@inferred_latest quantum_dimension(g)) == 4.0 + 4.0quantum_dimension(Fib("τ")) + @test (@inferred quantum_dimension(g)) == 4.0 + 4.0quantum_dimension(Fib("τ")) end @testset "Fusion of Abelian products" begin @@ -422,19 +414,19 @@ end q01 = SectorProduct(; B=U1(1)) q11 = SectorProduct(; A=U1(1), B=U1(1)) - @test (@inferred_latest q10 ⊗ q10) == SectorProduct(; A=U1(2)) - @test (@inferred_latest q01 ⊗ q00) == q01 - @test (@inferred_latest q00 ⊗ q01) == q01 - @test (@inferred_latest q10 ⊗ q01) == q11 - @test (@inferred_latest q11 ⊗ q11) == SectorProduct(; A=U1(2), B=U1(2)) + @test (@inferred q10 ⊗ q10) == SectorProduct(; A=U1(2)) + @test (@inferred q01 ⊗ q00) == q01 + @test (@inferred q00 ⊗ q01) == q01 + @test (@inferred q10 ⊗ q01) == q11 + @test (@inferred q11 ⊗ q11) == SectorProduct(; A=U1(2), B=U1(2)) s11 = SectorProduct(; A=U1(1), B=Z{2}(1)) s10 = SectorProduct(; A=U1(1)) s01 = SectorProduct(; B=Z{2}(1)) - @test (@inferred_latest s01 ⊗ q00) == s01 - @test (@inferred_latest q00 ⊗ s01) == s01 - @test (@inferred_latest s10 ⊗ s01) == s11 - @test (@inferred_latest s11 ⊗ s11) == SectorProduct(; A=U1(2), B=Z{2}(0)) + @test (@inferred s01 ⊗ q00) == s01 + @test (@inferred q00 ⊗ s01) == s01 + @test (@inferred s10 ⊗ s01) == s11 + @test (@inferred s11 ⊗ s11) == SectorProduct(; A=U1(2), B=Z{2}(0)) end @testset "Fusion of NonAbelian products" begin @@ -444,15 +436,15 @@ end phab = SectorProduct(; A=SU2(1//2), B=SU2(1//2)) @test space_isequal( - (@inferred_latest pha ⊗ pha), + (@inferred pha ⊗ pha), gradedrange([SectorProduct(; A=SU2(0)) => 1, SectorProduct(; A=SU2(1)) => 1]), ) - @test space_isequal((@inferred_latest pha ⊗ p0), gradedrange([pha => 1])) - @test space_isequal((@inferred_latest p0 ⊗ phb), gradedrange([phb => 1])) - @test space_isequal((@inferred_latest pha ⊗ phb), gradedrange([phab => 1])) + @test space_isequal((@inferred pha ⊗ p0), gradedrange([pha => 1])) + @test space_isequal((@inferred p0 ⊗ phb), gradedrange([phb => 1])) + @test space_isequal((@inferred pha ⊗ phb), gradedrange([phab => 1])) @test space_isequal( - (@inferred_latest phab ⊗ phab), + (@inferred phab ⊗ phab), gradedrange([ SectorProduct(; A=SU2(0), B=SU2(0)) => 1, SectorProduct(; A=SU2(1), B=SU2(0)) => 1, @@ -466,11 +458,11 @@ end ı = Fib("1") τ = Fib("τ") s = SectorProduct(; A=ı, B=ı) - @test space_isequal((@inferred_latest s ⊗ s), gradedrange([s => 1])) + @test space_isequal((@inferred s ⊗ s), gradedrange([s => 1])) s = SectorProduct(; A=τ, B=τ) @test space_isequal( - (@inferred_latest s ⊗ s), + (@inferred s ⊗ s), gradedrange([ SectorProduct(; A=ı, B=ı) => 1, SectorProduct(; A=τ, B=ı) => 1, @@ -488,7 +480,7 @@ end SectorProduct(; A=ı, B=ψ) => 1, SectorProduct(; A=τ, B=ψ) => 1, ]) - @test space_isequal((@inferred_latest s ⊗ s), g) + @test space_isequal((@inferred s ⊗ s), g) end @testset "Fusion of mixed Abelian and NonAbelian products" begin @@ -502,18 +494,16 @@ end q21 = (N=U1(2),) × (J=SU2(1),) q22 = (N=U1(2),) × (J=SU2(2),) - @test space_isequal((@inferred_latest q1h ⊗ q1h), gradedrange([q20 => 1, q21 => 1])) - @test space_isequal((@inferred_latest q10 ⊗ q1h), gradedrange([q2h => 1])) - @test space_isequal((@inferred_latest q0h ⊗ q1h), gradedrange([q10 => 1, q11 => 1])) - @test space_isequal( - (@inferred_latest q11 ⊗ q11), gradedrange([q20 => 1, q21 => 1, q22 => 1]) - ) + @test space_isequal((@inferred q1h ⊗ q1h), gradedrange([q20 => 1, q21 => 1])) + @test space_isequal((@inferred q10 ⊗ q1h), gradedrange([q2h => 1])) + @test space_isequal((@inferred q0h ⊗ q1h), gradedrange([q10 => 1, q11 => 1])) + @test space_isequal((@inferred q11 ⊗ q11), gradedrange([q20 => 1, q21 => 1, q22 => 1])) end @testset "Fusion of fully mixed products" begin s = SectorProduct(; A=U1(1), B=SU2(1//2), C=Ising("σ")) @test space_isequal( - (@inferred_latest s ⊗ s), + (@inferred s ⊗ s), gradedrange([ SectorProduct(; A=U1(2), B=SU2(0), C=Ising("1")) => 1, SectorProduct(; A=U1(2), B=SU2(1), C=Ising("1")) => 1, @@ -526,7 +516,7 @@ end τ = Fib("τ") s = SectorProduct(; A=SU2(1//2), B=U1(1), C=τ) @test space_isequal( - (@inferred_latest s ⊗ s), + (@inferred s ⊗ s), gradedrange([ SectorProduct(; A=SU2(0), B=U1(2), C=ı) => 1, SectorProduct(; A=SU2(1), B=U1(2), C=ı) => 1, @@ -537,7 +527,7 @@ end s = SectorProduct(; A=τ, B=U1(1), C=ı) @test space_isequal( - (@inferred_latest s ⊗ s), + (@inferred s ⊗ s), gradedrange([ SectorProduct(; B=U1(2), A=ı, C=ı) => 1, SectorProduct(; B=U1(2), A=τ, C=ı) => 1 ]), @@ -550,16 +540,14 @@ end g2 = gradedrange([s2 => 1]) s3 = SectorProduct(; A=U1(1), B=SU2(0), C=Ising("σ")) s4 = SectorProduct(; A=U1(1), B=SU2(1), C=Ising("σ")) - @test space_isequal( - (@inferred_latest fusion_product(g1, g2)), gradedrange([s3 => 2, s4 => 2]) - ) + @test space_isequal((@inferred fusion_product(g1, g2)), gradedrange([s3 => 2, s4 => 2])) sA = SectorProduct(; A=U1(1)) sB = SectorProduct(; B=SU2(1//2)) sAB = SectorProduct(; A=U1(1), B=SU2(1//2)) gA = gradedrange([sA => 2]) gB = gradedrange([sB => 1]) - @test space_isequal((@inferred_latest fusion_product(gA, gB)), gradedrange([sAB => 2])) + @test space_isequal((@inferred fusion_product(gA, gB)), gradedrange([sAB => 2])) end end @@ -568,39 +556,38 @@ end @test s == TrivialSector() @test s == SectorProduct(()) @test s == SectorProduct((;)) - @test (@inferred_latest dual(s)) == s - @test (@inferred_latest s × s) == s - @test (@inferred_latest s ⊗ s) == s - @test (@inferred_latest quantum_dimension(s)) == 1 - @test (@inferred_latest trivial(s)) == s + @test (@inferred dual(s)) == s + @test (@inferred s × s) == s + @test (@inferred s ⊗ s) == s + @test (@inferred quantum_dimension(s)) == 1 + @test (@inferred trivial(s)) == s g0 = gradedrange([s => 2]) - @test space_isequal((@inferred_latest fusion_product(g0, g0)), gradedrange([s => 4])) - - @test (@inferred_latest s × U1(1)) == SectorProduct(U1(1)) - @test (@inferred_latest s × SectorProduct(U1(1))) == SectorProduct(U1(1)) - @test (@inferred_latest s × SectorProduct(; A=U1(1))) == SectorProduct(; A=U1(1)) - @test (@inferred_latest U1(1) × s) == SectorProduct(U1(1)) - @test (@inferred_latest SectorProduct(U1(1)) × s) == SectorProduct(U1(1)) - @test (@inferred_latest SectorProduct(; A=U1(1)) × s) == SectorProduct(; A=U1(1)) - - @test (@inferred_latest U1(1) ⊗ s) == SectorProduct(U1(1)) - @test (@inferred_latest SU2(0) ⊗ s) == gradedrange([SectorProduct(SU2(0)) => 1]) - @test (@inferred_latest Fib("τ") ⊗ s) == gradedrange([SectorProduct(Fib("τ")) => 1]) - @test (@inferred_latest s ⊗ U1(1)) == SectorProduct(U1(1)) - @test (@inferred_latest s ⊗ SU2(0)) == gradedrange([SectorProduct(SU2(0)) => 1]) - @test (@inferred_latest s ⊗ Fib("τ")) == gradedrange([SectorProduct(Fib("τ")) => 1]) - - @test (@inferred_latest SectorProduct(U1(1)) ⊗ s) == SectorProduct(U1(1)) - @test (@inferred_latest SectorProduct(SU2(0)) ⊗ s) == - gradedrange([SectorProduct(SU2(0)) => 1]) - @test (@inferred_latest SectorProduct(Fib("τ"), SU2(1), U1(2)) ⊗ s) == + @test space_isequal((@inferred fusion_product(g0, g0)), gradedrange([s => 4])) + + @test (@inferred s × U1(1)) == SectorProduct(U1(1)) + @test (@inferred s × SectorProduct(U1(1))) == SectorProduct(U1(1)) + @test (@inferred s × SectorProduct(; A=U1(1))) == SectorProduct(; A=U1(1)) + @test (@inferred U1(1) × s) == SectorProduct(U1(1)) + @test (@inferred SectorProduct(U1(1)) × s) == SectorProduct(U1(1)) + @test (@inferred SectorProduct(; A=U1(1)) × s) == SectorProduct(; A=U1(1)) + + @test (@inferred U1(1) ⊗ s) == SectorProduct(U1(1)) + @test (@inferred SU2(0) ⊗ s) == gradedrange([SectorProduct(SU2(0)) => 1]) + @test (@inferred Fib("τ") ⊗ s) == gradedrange([SectorProduct(Fib("τ")) => 1]) + @test (@inferred s ⊗ U1(1)) == SectorProduct(U1(1)) + @test (@inferred s ⊗ SU2(0)) == gradedrange([SectorProduct(SU2(0)) => 1]) + @test (@inferred s ⊗ Fib("τ")) == gradedrange([SectorProduct(Fib("τ")) => 1]) + + @test (@inferred SectorProduct(U1(1)) ⊗ s) == SectorProduct(U1(1)) + @test (@inferred SectorProduct(SU2(0)) ⊗ s) == gradedrange([SectorProduct(SU2(0)) => 1]) + @test (@inferred SectorProduct(Fib("τ"), SU2(1), U1(2)) ⊗ s) == gradedrange([SectorProduct(Fib("τ"), SU2(1), U1(2)) => 1]) - @test (@inferred_latest SectorProduct(; A=U1(1)) ⊗ s) == SectorProduct(; A=U1(1)) - @test (@inferred_latest SectorProduct(; A=SU2(0)) ⊗ s) == + @test (@inferred SectorProduct(; A=U1(1)) ⊗ s) == SectorProduct(; A=U1(1)) + @test (@inferred SectorProduct(; A=SU2(0)) ⊗ s) == gradedrange([SectorProduct(; A=SU2(0)) => 1]) - @test (@inferred_latest SectorProduct(; A=Fib("τ"), B=SU2(1), C=U1(2)) ⊗ s) == + @test (@inferred SectorProduct(; A=Fib("τ"), B=SU2(1), C=U1(2)) ⊗ s) == gradedrange([SectorProduct(; A=Fib("τ"), B=SU2(1), C=U1(2)) => 1]) # Empty behaves as empty NamedTuple