From ade335c37b4b06973daa117bced85d2a96cc431f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Gauth=C3=A9?= Date: Sat, 9 Mar 2024 18:06:07 -0500 Subject: [PATCH] fix throw --- NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl index ef0cc528c6..256ddf74b9 100644 --- a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl +++ b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl @@ -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} @@ -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)