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.
In GAP we have an API
PositionNonZeroInRow(mat, row)which returns the index of the first entry in the rowrow, or if the row only consists of zeros, then it returnsncols(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
MatElemcan be based on, e.g. foris_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.