Skip to content

Commit 5acb295

Browse files
committed
Make similar with graded axes more generic
1 parent b8ca93e commit 5acb295

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ext/BlockSparseArraysGradedUnitRangesExt/BlockSparseArraysGradedUnitRangesExt.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module BlockSparseArraysGradedUnitRangesExt
22

33
using BlockSparseArrays: AnyAbstractBlockSparseArray, BlockSparseArray, blocktype
44
using GradedUnitRanges: AbstractGradedUnitRange
5-
using TypeParameterAccessors: set_eltype, set_ndims, unwrap_array_type
5+
using TypeParameterAccessors: similartype, unwrap_array_type
66

77
# A block spare array similar to the input (dense) array.
88
# TODO: Make `BlockSparseArrays.blocksparse_similar` more general and use that,
@@ -15,9 +15,7 @@ function similar_blocksparse(
1515
# TODO: Probably need to unwrap the type of `a` in certain cases
1616
# to make a proper block type.
1717
return BlockSparseArray{
18-
elt,
19-
length(axes),
20-
set_eltype(set_ndims(unwrap_array_type(blocktype(a)), length(axes)), elt),
18+
elt,length(axes),similartype(unwrap_array_type(blocktype(a)), elt, axes)
2119
}(
2220
axes
2321
)

0 commit comments

Comments
 (0)