Elementary Properties
The following functions yield elementary properties of matrices and may be applied to matrices of any type, including vectors.
- NumberOfRows(A): Mtrx -> RngIntElt
- Nrows(A): Mtrx -> RngIntElt
Given an \(m \times n\) matrix \(A\), return \(m\), the number of rows of \(A\).
- NumberOfColumns(A): Mtrx -> RngIntElt
- Ncols(A): Mtrx -> RngIntElt
Given an \(m \times n\) matrix \(A\), return \(n\), the number of columns of \(A\).
- NumberOfNonZeroEntries(A): Mtrx -> RngIntElt
- NNZEntries(A): Mtrx -> RngIntElt
Given a matrix \(A\), return the number of non-zero entries in \(A\).
- Density(A): Mtrx -> FldRe
Given a matrix \(A\), return the density of \(A\) as a real number, which is the number of non-zero entries in \(A\) divided by the product of the number of rows of \(A\) and the number of columns of \(A\) (or zero if \(A\) has zero rows or columns).
- BaseRing(A): Mtrx -> Rng
- CoefficientRing(A): Mtrx -> Rng
Given a matrix \(A\) with entries lying in a ring \(R\), return \(R\).