Echelon matrices over finite fields.¶
- sage.matrix.echelon_matrix.reduced_echelon_matrix_iterator(K, k, n, sparse=False, copy=True, set_immutable=False)[source]¶
An iterator over \((k,n)\) reduced echelon matrices over the finite field \(K\).
INPUT:
K
– a finite fieldk
– number of rows (or the size of the subspace)n
– number of columns (or the dimension of the ambient space)sparse
– boolean (default:False
)copy
– boolean (default:True
); if set toFalse
then iterator yields the same matrix over and over (but with different entries). Default isTrue
which is safer but might be slower.set_immutable
– boolean; if set toTrue
then the output matrices are immutable. This option automatically turnscopy
intoTrue
.
Note
We ensure that the iteration order is so that all matrices with given pivot columns are generated consecutively. Furthermore, the order in which the pivot columns appear is lexicographic.
It would be faster to generate the pivots columns following a Gray code. There would be only one pivot changing at a time, avoiding the possibly expensive
m0.__copy__()
. However that would modify the generation order some functions depend upon.EXAMPLES:
sage: from sage.matrix.echelon_matrix import reduced_echelon_matrix_iterator sage: it = reduced_echelon_matrix_iterator(GF(2), 2, 3) sage: for m in it: ....: print(m) ....: print(m.pivots()) ....: print("*******") [1 0 0] [0 1 0] (0, 1) ******* [1 0 0] [0 1 1] (0, 1) ******* [1 0 1] [0 1 0] (0, 1) ******* [1 0 1] [0 1 1] (0, 1) ******* [1 0 0] [0 0 1] (0, 2) ******* [1 1 0] [0 0 1] (0, 2) ******* [0 1 0] [0 0 1] (1, 2) *******
>>> from sage.all import * >>> from sage.matrix.echelon_matrix import reduced_echelon_matrix_iterator >>> it = reduced_echelon_matrix_iterator(GF(Integer(2)), Integer(2), Integer(3)) >>> for m in it: ... print(m) ... print(m.pivots()) ... print("*******") [1 0 0] [0 1 0] (0, 1) ******* [1 0 0] [0 1 1] (0, 1) ******* [1 0 1] [0 1 0] (0, 1) ******* [1 0 1] [0 1 1] (0, 1) ******* [1 0 0] [0 0 1] (0, 2) ******* [1 1 0] [0 0 1] (0, 2) ******* [0 1 0] [0 0 1] (1, 2) *******