Skip to content

Add API for finding the first non-zero entry in a matrix row #2417

Description

@fingolfin

In GAP we have an API PositionNonZeroInRow(mat, row) which returns the index of the first entry in the row row, or if the row only consists of zeros, then it returns ncols(mat)+1.

I think we should have a similar API in AA (it could do something different for zero rows, and e.g. return nothing).

It is a useful primitive on which various other efficient baseline methods for MatElem can be based on, e.g. for is_zero_row, is_zero, is_one, is_diagonal, is_upper_triangular, is_lower_triangular, ...

I.e. these methods would not have to fetch each entry (materializing matrix entries can cause allocations), and for e.g. compressed GF(2) matrices (where each entry is stored as a bit) they can scan entire machine words at once, instead of going bit-by-bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions