Skip to content

Commit

Permalink
Fix last label (#6)
Browse files Browse the repository at this point in the history
* Fix last label

* Bump to v0.1.1
  • Loading branch information
ogauthe authored Dec 17, 2024
1 parent 625665d commit 59e2fe6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GradedUnitRanges"
uuid = "e2de450a-8a67-46c7-b59c-01d5a3d041c5"
authors = ["ITensor developers <[email protected]> and contributors"]
version = "0.1.0"
version = "0.1.1"

[deps]
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
Expand Down
4 changes: 3 additions & 1 deletion src/gradedunitrange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ function BlockArrays.blockedrange(lblocklengths::AbstractVector{<:LabelledIntege
return gradedrange(lblocklengths)
end

Base.last(a::AbstractGradedUnitRange) = isempty(a.lasts) ? first(a) - 1 : last(a.lasts)
function Base.last(a::AbstractGradedUnitRange)
return isempty(a.lasts) ? labelled(first(a) - 1, label(first(a))) : last(a.lasts)
end

function gradedrange(lblocklengths::AbstractVector{<:Pair{<:Any,<:Integer}})
return gradedrange(labelled.(last.(lblocklengths), first.(lblocklengths)))
Expand Down

0 comments on commit 59e2fe6

Please sign in to comment.