@@ -13,7 +13,7 @@ using .TestSetup
1313@timedtestset " Fusion trees for $(TensorKit. type_repr (I)) " verbose = true for I in sectorlist
1414 Istr = TensorKit. type_repr (I)
1515 N = 5
16- out = random_fusion (I, N )
16+ out = random_fusion (I, Val (N) )
1717 isdual = ntuple (n -> rand (Bool), N)
1818 in = rand (collect (⊗ (out... )))
1919 numtrees = length (fusiontrees (out, in, isdual))
@@ -63,31 +63,30 @@ using .TestSetup
6363 @constinferred FusionTree ((u, u, u), u)
6464 if isa (UnitStyle (I), SimpleUnit)
6565 @constinferred FusionTree ((u, u, u, u))
66+ else
67+ @test_throws ArgumentError FusionTree ((u, u, u, u))
6668 end
6769 @test_throws MethodError FusionTree ((u, u), u, (false , false , false ))
6870 else
69- errstr = " fusion tree requires inner lines if `FusionStyle(I) <: MultipleFusion`"
70- @test_throws errstr FusionTree ((), u, ())
71- @test_throws errstr FusionTree ((u,), u, (false ,))
72- @test_throws errstr FusionTree ((u, u), u, (false , false ))
73- @test_throws errstr FusionTree ((u, u, u), u)
74- if isa (UnitStyle (I), SimpleUnit)
75- @test_throws errstr FusionTree ((u, u, u, u))
76- end
71+ @test_throws ArgumentError FusionTree ((), u, ())
72+ @test_throws ArgumentError FusionTree ((u,), u, (false ,))
73+ @test_throws ArgumentError FusionTree ((u, u), u, (false , false ))
74+ @test_throws ArgumentError FusionTree ((u, u, u), u)
75+ @test_throws ArgumentError FusionTree ((u, u, u, u))
7776 end
7877 end
7978 end
8079 @testset " Fusion tree $Istr : insertat" begin
8180 N = 4
82- out2 = random_fusion (I, N )
81+ out2 = random_fusion (I, Val (N) )
8382 in2 = rand (collect (⊗ (out2... )))
8483 isdual2 = ntuple (n -> rand (Bool), N)
8584 f2 = rand (collect (fusiontrees (out2, in2, isdual2)))
8685 for i in 1 : N
87- out1 = random_fusion (I, N ) # guaranteed good fusion
86+ out1 = random_fusion (I, Val (N) ) # guaranteed good fusion
8887 out1 = Base. setindex (out1, in2, i) # can lead to poor fusion
8988 while isempty (⊗ (out1... ))
90- out1 = random_fusion (I, N )
89+ out1 = random_fusion (I, Val (N) )
9190 out1 = Base. setindex (out1, in2, i)
9291 end
9392 in1 = rand (collect (⊗ (out1... )))
@@ -325,14 +324,14 @@ using .TestSetup
325324
326325 @testset " Fusion tree $Istr : merging" begin
327326 N = 3
328- out1 = random_fusion (I, N )
329- out2 = random_fusion (I, N )
327+ out1 = random_fusion (I, Val (N) )
328+ out2 = random_fusion (I, Val (N) )
330329 in1 = rand (collect (⊗ (out1... )))
331330 in2 = rand (collect (⊗ (out2... )))
332331 tp = ⊗ (in1, in2) # messy solution but it works
333332 while isempty (tp)
334- out1 = random_fusion (I, N )
335- out2 = random_fusion (I, N )
333+ out1 = random_fusion (I, Val (N) )
334+ out2 = random_fusion (I, Val (N) )
336335 in1 = rand (collect (⊗ (out1... )))
337336 in2 = rand (collect (⊗ (out2... )))
338337 tp = ⊗ (in1, in2)
@@ -409,22 +408,22 @@ using .TestSetup
409408 N = 4
410409 end
411410 if isa (UnitStyle (I), SimpleUnit)
412- out = random_fusion (I, N )
411+ out = random_fusion (I, Val (N) )
413412 numtrees = count (n -> true , fusiontrees ((out... , map (dual, out)... )))
414413 while ! (0 < numtrees < 100 )
415- out = random_fusion (I, N )
414+ out = random_fusion (I, Val (N) )
416415 numtrees = count (n -> true , fusiontrees ((out... , map (dual, out)... )))
417416 end
418417 incoming = rand (collect (⊗ (out... )))
419418 f1 = rand (collect (fusiontrees (out, incoming, ntuple (n -> rand (Bool), N))))
420419 f2 = rand (collect (fusiontrees (out[randperm (N)], incoming, ntuple (n -> rand (Bool), N))))
421420 else
422- out = random_fusion (I, N )
423- out2 = random_fusion (I, N )
421+ out = random_fusion (I, Val (N) )
422+ out2 = random_fusion (I, Val (N) )
424423 tp = ⊗ (out... )
425424 tp2 = ⊗ (out2... )
426425 while isempty (intersect (tp, tp2)) # guarantee fusion to same coloring
427- out2 = random_fusion (I, N )
426+ out2 = random_fusion (I, Val (N) )
428427 tp2 = ⊗ (out2... )
429428 end
430429 @test_throws ArgumentError fusiontrees ((out... , map (dual, out)... ))
0 commit comments