Skip to content

Commit cbd1a17

Browse files
committed
Fix off diagonal slicing of BlockSparseArray with Diagonal blocks
1 parent 8436b23 commit cbd1a17

File tree

1 file changed

+3
-1
lines changed
  • NDTensors/src/lib/BlockSparseArrays/src/blocksparsearrayinterface

1 file changed

+3
-1
lines changed

NDTensors/src/lib/BlockSparseArrays/src/blocksparsearrayinterface/blockzero.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ end
2929
function (f::BlockZero)(arraytype::Type{<:AbstractArray}, I)
3030
# TODO: Make sure this works for sparse or block sparse blocks, immutable
3131
# blocks, diagonal blocks, etc.!
32-
return fill!(arraytype(undef, block_size(f.axes, Block(Tuple(I)))), false)
32+
blck_size = block_size(f.axes, Block(Tuple(I)))
33+
blck_type = similartype(arraytype, blck_size)
34+
return fill!(blck_type(undef, blck_size), false)
3335
end
3436

3537
# Fallback so that `SparseArray` with scalar elements works.

0 commit comments

Comments
 (0)