Skip to content

dropzeros! for SubArray #286

Open
Open
@btmit

Description

@btmit

It would be awesome if dropzeros! were extended so the following pattern worked:

# create a sparse array
a = rand(4, 3)
as = sparse(a)

# loop over columns
for c in eachcol(as)
    # do something that creates some nonstructural zeros
    c[rand(1:4)] = 0
    # drop zeros per column subarray
    # dropzeros!(c)  # fails due to missing method
end

Obviously in this example I could call dropzeros! on the entire matrix at the end, but in other cases it may be more natural to nest it in a per-loop function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions