diff --git a/NDTensors/src/lib/GradedAxes/src/abstractgradedunitrange.jl b/NDTensors/src/lib/GradedAxes/src/abstractgradedunitrange.jl index 1953230045..8782ddfd61 100644 --- a/NDTensors/src/lib/GradedAxes/src/abstractgradedunitrange.jl +++ b/NDTensors/src/lib/GradedAxes/src/abstractgradedunitrange.jl @@ -81,7 +81,7 @@ function tensor_product( return fuse(isdual ? dual(l1) : l1, isdual ? dual(l2) : l2) end, ) - return gradedrange(a, nondual_sectors_a, isdual) + return gradedrange(nondual_sectors_a, a, isdual) end function Base.show(io::IO, mimetype::MIME"text/plain", a::AbstractGradedUnitRange) diff --git a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl index 8c6cb30535..ef0cc528c6 100644 --- a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl +++ b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl @@ -22,9 +22,9 @@ function gradedrange(sectors_lengths::Vector{<:Pair{<:Any,Int}}, isdual=false) return gradedrange(first.(sectors_lengths), last.(sectors_lengths), isdual) end -function gradedrange(a::BlockedUnitRange, nondual_sectors::Vector, isdual=false) - if length(nondual_sectors) != length(blocks(a)) - throw(DomainError("BlockedUnitRange and sectors lengths do not match")) +function gradedrange(nondual_sectors::Vector, a::BlockedUnitRange, isdual=false) + if length(nondual_sectors) != length(blocks(a)) != length(nondual_sectors) + throw(DomainError("Number of sectors and number of blocks do not match")) end return GradedUnitRange(a, nondual_sectors, isdual) end