gap
gap copied to clipboard
Add TriangulizedMat variant that omits zero rows resp. returns rank?
I've been cleaning up some code in various packages, and noticed that there seems to be a repeated need for variants of the existing functions like TriangulizedMat
and BaseMat
.
For the former, it seems quite some code calls TriangulizedMat
(or TriangulizeMat
) and then spends time getting rid of the zero rows at the end. Which is of course not hard, but usually the code that computes the triangulization can do it more efficiently, as it already knows the rank resp. which rows are (non-)zero.
So if we had a variant of TriangulizedMat
resp. TriangulizeMat
which simply removes zero rows from the result, then that would make quite some code I am looking at right now in several packages smoother.
A first version could just do a naive removal, but e.g. the kernel function TriangulizeListVec8Bits
already returns the rank in addition to performing the triangulization, and could easily be adapted to return the "reduced" result.
The hardest problem thus as always is to pick a good name. Perhaps...
-
ReducedTriangulizedMat
/ReduceTriangulizeMat
-
Triangulize(d)MatNoZeroRows
-
Triangulize(d)BaseMat
(as it really does the same asTriangulizedMat(BaseMat(m))
BTW this is related to MatrixObj in so far as it could sometimes return an "empty" matrix, which looses information about base domain and columns. But usually that shouldn't be a problem here.