Skip to content

Commit

Permalink
fix throw
Browse files Browse the repository at this point in the history
  • Loading branch information
ogauthe committed Mar 9, 2024
1 parent 31bc1ba commit ade335c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BlockArrays: BlockArrays, Block, BlockRange, BlockedUnitRange, blockedrange
using BlockArrays:
BlockArrays, Block, BlockRange, BlockedUnitRange, blockedrange, blocklength

struct GradedUnitRange{T,S} <: AbstractGradedUnitRange{T,S}
blockedrange::BlockedUnitRange{T}
Expand All @@ -23,7 +24,7 @@ function gradedrange(sectors_lengths::Vector{<:Pair{<:Any,Int}}, isdual=false)
end

function gradedrange(nondual_sectors::Vector, a::BlockedUnitRange, isdual=false)
if length(nondual_sectors) != length(blocks(a)) != length(nondual_sectors)
if length(nondual_sectors) != blocklength(a)
throw(DomainError("Number of sectors and number of blocks do not match"))
end
return GradedUnitRange(a, nondual_sectors, isdual)
Expand Down

0 comments on commit ade335c

Please sign in to comment.