# SparseEchelonMatrix(C, D)ΒΆ

jet.spad line 1286 [edit on github]

C: OrderedSet

D: Ring

`SparseEchelonMatrix(C, D)`

implements sparse matrices whose columns are enumerated by the OrderedSet `C`

and whose entries belong to the GcdDomain `D`

. The basic operation of this domain is the computation of an row echelon form. The algorithm used tries to maintain the sparsity and is especially adapted to matrices which are already close to a row echelon form.

- *: (Matrix D, %) -> %
`L*A`

implements left multiplication with a usual matrix.

- *: (Matrix Fraction D, %) -> % if D has IntegralDomain
`L*A`

implements left multiplication with a usual matrix over the quotient field of`D`

.

- allIndices: % -> List C
`allIndices(A)`

returns all indices used for enumerating the columns of the matrix`A`

.

- appendRow!: (%, Record(Indices: List C, Entries: List D)) -> Void
`appendRow!(A, r)`

appends the row`r`

at the end of the matrix`A`

.

- coerce: % -> Matrix D
`coerce(A)`

yields the matrix`A`

in the usual matrix type.- coerce: % -> OutputForm
from CoercibleTo OutputForm

- consRow!: (%, Record(Indices: List C, Entries: List D)) -> Void
`consRow!(A, r)`

inserts the row`r`

at the top of the matrix`A`

.

- copy: % -> %
`copy(A)`

returns a copy of the matrix`A`

.

- elimZeroCols!: % -> Void
`elimZeroCols!(A)`

removes columns which contain only zeros. This affects basically only the value of`allIndices(A)`

.

- elt: (%, Integer, C) -> D
`elt(A, i, c)`

returns the entry of the matrix`A`

in row`i`

and in the column with index`c`

.

- extract: (%, Integer, Integer) -> %
`extract(A, i1, i2)`

extracts the rows`i1`

to`i2`

and returns them as a new matrix.

- horizJoin: (%, %) -> %
`horizJoin(A, B)`

horizontally concats the matrices`A`

and`B`

. It is assumed that all indices of`B`

are smaller than those of`A`

.

- horizSplit: (%, C) -> Record(Left: %, Right: %)
`horizSplit(A, c)`

splits the matrix`A`

into two at the column given by`c`

. The first column of the right matrix is enumerated by the first index less or equal to`c`

.

- join: (%, %) -> %
`join(A, B)`

vertically concats the matrices`A`

and`B`

.

- ncols: % -> NonNegativeInteger
`ncols(A)`

returns the number of columns of the matrix`A`

.

- new: (List C, Integer) -> %
`new(inds, nrows)`

generates a new matrix with`nrows`

rows and columns enumerated by the indices`inds`

. The matrix is empty, i.e. the zero matrix.

- nrows: % -> NonNegativeInteger
`nrows(A)`

returns the number of rows of the matrix`A`

.

- pivot: (%, Integer) -> Record(Index: C, Entry: D)
`pivot(A, i)`

returns the leading entry of the`i`

`-`

th row of the matrix`A`

together with its index.

- pivots: % -> Record(Indices: List C, Entries: List D)
`pivots(A)`

returns all leading entries of the matrix`A`

together with their indices.

- primitiveRowEchelon: % -> Record(Ech: %, Lt: Matrix Fraction D, Pivots: List D, Rank: NonNegativeInteger) if D has GcdDomain
`primitiveRowEchelon(A)`

computes a row echelon form for the matrix`A`

. The algorithm used is fraction-free elimination. Every row is made primitive by division by the`gcd`

. The algorithm is especially adapted to matrices already close to row echelon form. The transformation matrix, the used pivots and the rank of the matrix are also returned.

- purge!: (%, C -> Boolean) -> Void
`purge!(A, crit)`

eliminates all columns belonging to an index`c`

such that`crit(c)`

yields`true`

.

- row: (%, Integer) -> Record(Indices: List C, Entries: List D)
`row(A, i)`

returns the`i`

`-`

th row of the matrix`A`

.

- rowEchelon: % -> Record(Ech: %, Lt: Matrix D, Pivots: List D, Rank: NonNegativeInteger)
`primitiveRowEchelon(A)`

computes a row echelon form for the matrix`A`

. The algorithm used is fraction-free elimination. It is especially adapted to matrices already close to row echelon form. The transformation matrix, the used pivots and the rank of the matrix are also returned.

- setelt!: (%, Integer, C, D) -> Void
`setelt!(A, i, c, d)`

sets the entry of the matrix`A`

in row`i`

and in the column with index`c`

to the value`d`

.

- setGcdMode: Symbol -> Symbol if D has GcdDomain
`setGcdMode(s)`

sets a new value for the flag deciding on the method used to compute gcd`s for lists. Possible values for`s`

are`iterated`

and`random`

.

- setRow!: (%, Integer, List C, List D) -> Void
`setRow!(A, i, ind, ent)`

sets the`i`

`-`

th row of the matrix`A`

. Its indices are`ind`

; the entries`ent`

.

- setRow!: (%, Integer, Record(Indices: List C, Entries: List D)) -> Void
`setRow!(A, i, ind, ent)`

sets the`i`

`-`

th row of the matrix`A`

to the value`r`

.