The Matrix class represents a mathematical matrix, and provides methods for creating special-case matrices (zero, identity, diagonal, singular, vector), operating on them arithmetically and algebraically, and determining their mathematical properties (trace, rank, inverse, determinant).
Note that although matrices should theoretically be rectangular, this is not enforced by the class.
Also note that the determinant of integer matrices may be incorrectly calculated unless you also require 'mathn'. This may be fixed in the future.
Method Catalogue
To create a matrix:
-
Matrix.[](*rows)
-
Matrix.rows(rows, copy = true)
-
Matrix.columns(columns)
-
Matrix.diagonal(*values)
-
Matrix.scalar(n, value)
-
Matrix.scalar(n, value)
-
Matrix.identity(n)
-
Matrix.unit(n)
-
Matrix.I(n)
-
Matrix.zero(n)
-
Matrix.row_vector(row)
-
Matrix.column_vector(column)
To access Matrix elements/columns/rows/submatrices/properties:
-
[](i, j)
-
#row(i)
-
#column(j)
-
#minor(*param)
Properties of a matrix:
Matrix arithmetic:
Matrix functions:
Conversion to other data types:
-
#coerce(other)
String representations:
Aliases
- identity
- identity