Skip to content

Commit 5034b2f

Browse files
committed
blocksparsezeros with Float64 default
1 parent 37b5183 commit 5034b2f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BlockSparseArrays"
22
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.7.11"
4+
version = "0.7.12"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/blocksparsearray/blocksparsearray.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ end
250250
function blocksparsezeros(elt::Type, axes...)
251251
return BlockSparseArray{elt}(undef, axes...)
252252
end
253+
function blocksparsezeros(axes...)
254+
return blocksparsezeros(Float64, axes...)
255+
end
253256
function blocksparsezeros(::BlockType{A}, axes...) where {A<:AbstractArray}
254257
# TODO: Use:
255258
# ```julia

test/test_basics.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ arrayts = (Array, JLArray)
159159
end
160160

161161
# Convenient constructors.
162+
a = blocksparsezeros([2, 3], [2, 3])
163+
@test iszero(a)
164+
@test iszero(blockstoredlength(a))
165+
@test a isa BlockSparseMatrix{Float64,Matrix{Float64}}
166+
@test blocktype(a) == Matrix{Float64}
167+
@test blockstype(a) <: SparseMatrixDOK{Matrix{Float64}}
168+
@test blocksize(a) == (2, 2)
169+
@test blocksizes(a) == [(2, 2) (2, 3); (3, 2) (3, 3)]
170+
162171
a = blocksparsezeros(elt, [2, 3], [2, 3])
163172
@test iszero(a)
164173
@test iszero(blockstoredlength(a))

0 commit comments

Comments
 (0)