Skip to content

Commit d3a0dd0

Browse files
committed
add IsingBimodule spaces and help functions for fusiontree tests
1 parent f54f613 commit d3a0dd0

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

test/setup.jl

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module TestSetup
22

33
export smallset, randsector, hasfusiontensor, force_planar
4+
export random_fusiontree, safe_tensor_product
45
export sectorlist
5-
export Vtr, Vℤ₂, Vfℤ₂, Vℤ₃, VU₁, VfU₁, VCU₁, VSU₂, VfSU₂, VSU₂U₁, Vfib
6+
export Vtr, Vℤ₂, Vfℤ₂, Vℤ₃, VU₁, VfU₁, VCU₁, VSU₂, VfSU₂, VSU₂U₁, Vfib, VIB_diag, VIB_M
67

78
using Random
89
using TensorKit
@@ -75,6 +76,34 @@ function force_planar(tsrc::TensorMap{<:Any, <:GradedSpace})
7576
return tdst
7677
end
7778

79+
function random_fusiontree(I::Type{<:Sector}, N::Int) # for fusion tree tests
80+
in = nothing
81+
out = nothing
82+
while in === nothing
83+
out = ntuple(n -> randsector(I), N)
84+
try
85+
in = rand(collect((out...)))
86+
catch e
87+
if isa(e, ArgumentError)
88+
in = nothing
89+
else
90+
rethrow(e)
91+
end
92+
end
93+
end
94+
return out
95+
end
96+
97+
# for fusion tree merge test
98+
function safe_tensor_product(x::I, y::I) where {I<:Sector}
99+
tp = x y
100+
if isempty(tp)
101+
return nothing
102+
else
103+
return tp
104+
end
105+
end
106+
78107
sectorlist = (
79108
Z2Irrep, Z3Irrep, Z4Irrep, Z3Irrep Z4Irrep,
80109
U1Irrep, CU1Irrep, SU2Irrep,
@@ -160,6 +189,26 @@ Vfib = (
160189
Vect[FibonacciAnyon](:I => 2, => 3),
161190
Vect[FibonacciAnyon](:I => 2, => 2),
162191
)
163-
#TODO: add IsingBimodule spaces
192+
193+
C0, C1 = IsingBimodule(1, 1, 0), IsingBimodule(1, 1, 1)
194+
D0, D1 = IsingBimodule(2, 2, 0), IsingBimodule(2, 2, 1)
195+
M, Mop = IsingBimodule(1, 2, 0), IsingBimodule(2, 1, 0)
196+
VIB_diag = (
197+
Vect[IsingBimodule](C0 => 1, C1 => 2),
198+
Vect[IsingBimodule](C0 => 2, C1 => 1),
199+
Vect[IsingBimodule](C0 => 3, C1 => 1),
200+
Vect[IsingBimodule](C0 => 2, C1 => 3),
201+
Vect[IsingBimodule](C0 => 3, C1 => 2)
202+
)
203+
204+
# not a random ordering! designed to make V1 ⊗ V2 ← V3 ⊗ V4 ⊗ V5 work (tensors)
205+
# while V1 ⊗ V2 ← V4 isn't empty (factorizations)
206+
VIB_M = (
207+
Vect[IsingBimodule](C0 => 1, C1 => 2),
208+
Vect[IsingBimodule](M => 3),
209+
Vect[IsingBimodule](C0 => 2, C1 => 3),
210+
Vect[IsingBimodule](M => 4),
211+
Vect[IsingBimodule](D0 => 3, D1 => 4)
212+
)
164213

165214
end

0 commit comments

Comments
 (0)