Skip to content

Commit 54c070a

Browse files
committed
pass tests
1 parent 64c6ac4 commit 54c070a

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/fusion_trees/fusiontree.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ end
187187

188188
# TODO move to GradedUnitRanges
189189
function nsymbol(s1::AbstractSector, s2::AbstractSector, s3::AbstractSector)
190-
full_space = tensor_product(s1, s2)
190+
full_space = to_gradedrange(s1 s2)
191191
x = findfirst(==(s3), blocklabels(full_space))
192192
isnothing(x) && return 0 # OR labelled(0, s3)?
193193
return Int(blocklengths(full_space)[x])

src/fusiontensor/array_cast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ end
7676

7777
function to_array(ft::FusionTensor)
7878
bounds = block_dimensions.((codomain_axes(ft)..., domain_axes(ft)...))
79-
bsa = BlockSparseArray{eltype(ft)}(blockedrange.(bounds))
79+
bsa = BlockSparseArray{eltype(ft)}(undef, blockedrange.(bounds))
8080
for (f1, f2) in keys(trees_block_mapping(ft))
8181
b = findblock(ft, f1, f2)
8282
bsa[b] = bsa[b] + contract_fusion_trees(ft, f1, f2) # init block when needed

src/permutedims/permutedims.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using BlockArrays: blocklengths
44
using Strided: Strided, @strided
55

6-
using TensorAlgebra: BlockedPermutation, blockedperm, blockpermute
6+
using TensorAlgebra: BlockedPermutation, permmortar, blockpermute
77

88
function naive_permutedims(ft, biperm::BlockedPermutation{2})
99
@assert ndims(ft) == length(biperm)
@@ -25,7 +25,7 @@ end
2525
function fusiontensor_permutedims(
2626
ft, new_codomain_indices::Tuple, new_domain_indices::Tuple
2727
)
28-
biperm = blockedperm(new_codomain_indices, new_domain_indices)
28+
biperm = permmortar((new_codomain_indices, new_domain_indices))
2929
return fusiontensor_permutedims(ft, biperm)
3030
end
3131

test/basics/test_permutedims.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using FusionTensors:
1313
to_fusiontensor
1414
using GradedUnitRanges: dual, gradedrange, space_isequal
1515
using SymmetrySectors: O2, U1, SectorProduct, SU2
16-
using TensorAlgebra: blockedperm, tuplemortar
16+
using TensorAlgebra: permmortar, tuplemortar
1717

1818
include("setup.jl")
1919

@@ -35,7 +35,7 @@ include("setup.jl")
3535
ft2 = permutedims(ft1, ((1, 2), (3, 4))) # trivial with tuple of 2 tuples
3636
@test ft2 === ft1 # same object
3737

38-
biperm = blockedperm((1, 2), (3, 4))
38+
biperm = permmortar(((1, 2), (3, 4)))
3939
ft2 = permutedims(ft1, biperm) # trivial with biperm
4040
@test ft2 === ft1 # same object
4141

@@ -66,7 +66,7 @@ include("setup.jl")
6666
arr[1:2, 4:5, 5:5, 1:2] .= 3.0
6767
arr[3:4, 4:5, 1:4, 3:3] .= 4.0
6868
ft = to_fusiontensor(arr, codomain_legs, domain_legs)
69-
biperm = blockedperm((3,), (2, 4, 1))
69+
biperm = permmortar(((3,), (2, 4, 1)))
7070

7171
ftp = permutedims(ft, biperm)
7272
@test ftp naive_permutedims(ft, biperm)
@@ -90,13 +90,13 @@ include("setup.jl")
9090
@test ft0p ft0
9191

9292
@test permutedims(ft0, ((), ())) isa FusionTensor{Float64,0}
93-
@test permutedims(ft0, blockedperm((), ())) isa FusionTensor{Float64,0}
93+
@test permutedims(ft0, permmortar(((), ()))) isa FusionTensor{Float64,0}
9494
end
9595

9696
g = gradedrange([U1(0) => 1, U1(1) => 2, U1(2) => 3])
9797
v = zeros((6,))
9898
v[1] = 1.0
99-
biperm = blockedperm((), (1,))
99+
biperm = permmortar(((), (1,)))
100100
ft1 = to_fusiontensor(v, (g,), ())
101101
ft2 = permutedims(ft1, biperm)
102102
@test isnothing(check_sanity(ft2))
@@ -137,7 +137,9 @@ end
137137
)
138138
g2b = dual(g2)
139139
for biperm in [
140-
blockedperm((2, 1), (3, 4)), blockedperm((3, 1), (2, 4)), blockedperm((3, 1, 4), (2,))
140+
permmortar(((2, 1), (3, 4))),
141+
permmortar(((3, 1), (2, 4))),
142+
permmortar(((3, 1, 4), (2,))),
141143
]
142144
ft = to_fusiontensor(sds22, (g2, g2), (g2b, g2b))
143145
@test permutedims(ft, biperm) naive_permutedims(ft, biperm)
@@ -147,7 +149,7 @@ end
147149
@test permutedims(ft, biperm) naive_permutedims(ft, biperm)
148150
@test permutedims(adjoint(ft), biperm) naive_permutedims(adjoint(ft), biperm)
149151
end
150-
for biperm in [blockedperm((1, 2, 3, 4), ()), blockedperm((), (3, 1, 2, 4))]
152+
for biperm in [permmortar(((1, 2, 3, 4), ())), permmortar(((), (3, 1, 2, 4)))]
151153
ft = to_fusiontensor(sds22, (g2, g2), (g2b, g2b))
152154
@test permutedims(ft, biperm) naive_permutedims(ft, biperm)
153155
end

0 commit comments

Comments
 (0)