Skip to content

Commit d7e3a8d

Browse files
committed
reduce diff
1 parent 5c5abd6 commit d7e3a8d

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

NDTensors/src/lib/GradedAxes/src/fusion.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,13 @@ end
7979
# Used by `TensorAlgebra.splitdims` in `BlockSparseArraysGradedAxesExt`.
8080
# Get the permutation for sorting, then group by common elements.
8181
# groupsortperm([2, 1, 2, 3]) == [[2], [1, 3], [4]]
82-
blockmergesort(g::AbstractUnitRange) = g
8382
function blockmergesortperm(a::AbstractUnitRange)
84-
return Block.(groupsortperm(blocklabels(a)))
83+
return Block.(groupsortperm(blocklabels(nondual(a))))
8584
end
8685

8786
# Used by `TensorAlgebra.splitdims` in `BlockSparseArraysGradedAxesExt`.
8887
invblockperm(a::Vector{<:Block{1}}) = Block.(invperm(Int.(a)))
8988

90-
function blockmergesortperm(a::GradedUnitRangeDual)
91-
return Block.(groupsortperm(blocklabels(nondual(a))))
92-
end
93-
9489
function blockmergesort(g::AbstractGradedUnitRange)
9590
glabels = blocklabels(g)
9691
gblocklengths = blocklengths(g)
@@ -101,6 +96,7 @@ function blockmergesort(g::AbstractGradedUnitRange)
10196
end
10297

10398
blockmergesort(g::GradedUnitRangeDual) = flip(blockmergesort(flip(g)))
99+
blockmergesort(g::AbstractUnitRange) = g
104100

105101
# fusion_product produces a sorted, non-dual GradedUnitRange
106102
function fusion_product(g1, g2)

NDTensors/src/lib/TensorAlgebra/ext/TensorAlgebraGradedAxesExt/test/test_contract.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22
using BlockArrays: Block, blocksize
33
using Compat: Returns
44
using NDTensors.BlockSparseArrays: BlockSparseArray
5-
using NDTensors.GradedAxes: GradedAxes, gradedrange
5+
using NDTensors.GradedAxes: gradedrange
66
using NDTensors.SparseArrayInterface: densearray
77
using NDTensors.SymmetrySectors: U1
88
using NDTensors.TensorAlgebra: contract
99
using Random: randn!
1010
using Test: @test, @testset
1111

12-
#TODO remove once fuse_labels is defined in Sectors
13-
GradedAxes.fuse_labels(m::U1, n::U1) = U1(m.n + n.n)
14-
1512
function randn_blockdiagonal(elt::Type, axes::Tuple)
1613
a = BlockSparseArray{elt}(axes)
1714
blockdiaglength = minimum(blocksize(a))

0 commit comments

Comments
 (0)