Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to DualSector #45

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BlockSparseArrays"
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
authors = ["ITensor developers <[email protected]> and contributors"]
version = "0.2.19"
version = "0.2.20"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down Expand Up @@ -38,7 +38,7 @@ DiagonalArrays = "0.2.2"
Dictionaries = "0.4.3"
FillArrays = "1.13.0"
GPUArraysCore = "0.1.0, 0.2"
GradedUnitRanges = "0.1.0"
GradedUnitRanges = "0.2.0"
LabelledNumbers = "0.1.0"
LinearAlgebra = "1.10"
MacroTools = "0.5.13"
Expand Down
23 changes: 8 additions & 15 deletions test/test_gradedunitrangesext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ using BlockArrays:
using BlockSparseArrays:
BlockSparseArray, BlockSparseMatrix, BlockSparseVector, blockstoredlength
using GradedUnitRanges:
GradedUnitRanges,
GradedOneTo,
GradedUnitRange,
GradedUnitRangeDual,
blocklabels,
dual,
gradedrange,
isdual
GradedUnitRanges, GradedOneTo, GradedUnitRange, blocklabels, dual, gradedrange, isdual
using LabelledNumbers: label
using SparseArraysBase: storedlength
using SymmetrySectors: U1
Expand Down Expand Up @@ -216,8 +209,8 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
@test blockstoredlength(b) == 2
@test Array(b) == 2 * Array(a)
for i in 1:2
@test axes(b, i) isa GradedUnitRangeDual
@test axes(a[:, :], i) isa GradedUnitRangeDual
@test isdual(axes(b, i))
@test isdual(axes(a[:, :], i))
end
I = [Block(1)[1:1]]
@test a[I, :] isa AbstractBlockArray
Expand All @@ -241,8 +234,8 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
@test blockstoredlength(b) == 2
@test Array(b) == 2 * Array(a)
for i in 1:2
@test axes(b, i) isa GradedUnitRangeDual
@test axes(a[:, :], i) isa GradedUnitRangeDual
@test isdual(axes(b, i))
@test isdual(axes(a[:, :], i))
end

I = [Block(1)[1:1]]
Expand Down Expand Up @@ -340,7 +333,7 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
@test iszero(b[Block(2, 1)])
@test iszero(b[Block(1, 2)])
@test b[Block(2, 2)] == a2
@test all(GradedUnitRanges.space_isequal.(axes(b), (r, dual(r))))
@test all(GradedUnitRanges.labelled_isequal.(axes(b), (r, dual(r))))

# Regression test for Vector, which caused
# an ambiguity error with Base.
Expand All @@ -354,7 +347,7 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
@test blockstoredlength(b) == 1
@test b[Block(1)] == a1
@test iszero(b[Block(2)])
@test all(GradedUnitRanges.space_isequal.(axes(b), (r,)))
@test all(GradedUnitRanges.labelled_isequal.(axes(b), (r,)))

# Regression test for BitArray
r = gradedrange([U1(0) => 2, U1(1) => 3])
Expand All @@ -369,7 +362,7 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
@test iszero(b[Block(2, 1)])
@test iszero(b[Block(1, 2)])
@test b[Block(2, 2)] == a2
@test all(GradedUnitRanges.space_isequal.(axes(b), (r, dual(r))))
@test all(GradedUnitRanges.labelled_isequal.(axes(b), (r, dual(r))))
end
end
end
Loading