Skip to content

Commit 072502d

Browse files
committed
More generalizations for generic block types
1 parent 51fceec commit 072502d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
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.9"
4+
version = "0.7.10"
55

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

src/blocksparsearray/blocksparsearray.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using BlockArrays:
66
blockedrange,
77
blocklength,
88
undef_blocks
9-
using DerivableInterfaces: @interface
9+
using DerivableInterfaces: @interface, similartype
1010
using Dictionaries: Dictionary
1111
using SparseArraysBase: SparseArrayDOK
1212

@@ -173,7 +173,9 @@ end
173173
function BlockSparseArray{T,N}(
174174
::UndefInitializer, axes::Tuple{Vararg{AbstractUnitRange{<:Integer},N}}
175175
) where {T,N}
176-
return BlockSparseArray{T,N,Array{T,N}}(undef, axes)
176+
axt = Tuple{blockaxistype.(axes)...}
177+
A = similartype(Array{T}, axt)
178+
return BlockSparseArray{T,N,A}(undef, axes)
177179
end
178180

179181
function BlockSparseArray{T,N}(

0 commit comments

Comments
 (0)