Skip to content

Commit

Permalink
Fix off diagonal slicing of BlockSparseArray with Diagonal blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Nov 5, 2024
1 parent 8436b23 commit cbd1a17
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ end
function (f::BlockZero)(arraytype::Type{<:AbstractArray}, I)
# TODO: Make sure this works for sparse or block sparse blocks, immutable
# blocks, diagonal blocks, etc.!
return fill!(arraytype(undef, block_size(f.axes, Block(Tuple(I)))), false)
blck_size = block_size(f.axes, Block(Tuple(I)))
blck_type = similartype(arraytype, blck_size)
return fill!(blck_type(undef, blck_size), false)
end

# Fallback so that `SparseArray` with scalar elements works.
Expand Down

0 comments on commit cbd1a17

Please sign in to comment.