Matrix class

The Matrix class

Most of the class code is not optimized for high performance but for readability. You should be able to read the functions and understand what is going on with basic linear algebra knowledge.

For more reading see the page about Matrix Math at Wikipedia(Matrix

final Matrix a = Matrix([[1, 2], [3, 4]]);
final Vector b = Vector.column([2, 3]);
final Matrix e = Matrix([[8], [18]]);
Matrix result = a * b;
print(result == e);

This prints

[[8.0], [18.0]]


Matrix(List<List<double>> _values)
Constructs a matrix from a List<List> value. [...]
Matrix.eye(int size)
Constructs an identity matrix of size
Matrix.fill(int m, int n, [ double fill = 0.0 ])
Constructs a mxn (rows x cols) Matrix fill with fill=0.0. [...]


hashCode → int
Returns the hashCode for the matrix.
m → int
Returns the number of rows
n → int
Returns the number of columns
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


coFactors() Matrix
Calculates the Cofactors of the matrix. [...]
columnVector(int column) Vector
Returns a column from the matrix as a vector. [...]
copy() Matrix
Returns a deep copy of the Matrix.
cut(int m, int n) Matrix
Cuts the given column m and row n from the matrix and returns the remainder. [...]
det() → double
Calculates the determinant of the matrix. [...]
inverse() Matrix
Calculates the matrix inverse. [...]
map(MatrixMapFunc f) Matrix
Calls f for each element in the matrix and stores the result in a new matrix. [...]
rowVector(int row, [ bool deepCopy = true ]) Vector
Returns a row from the matrix as a vector. [...]
toString() → String
Prints the content of the matrix.
toVector([bool deepCopy = true ]) Vector
Returns the Vector representation of this Matrix if one of it's dimensions is 1. [...]
trace() → double
Calculates the trace of the Matrix. [...]
transpose() Matrix
Transposes the matrix [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.


operator *(dynamic other) Matrix
Multiply an Matrix with a Matrix or a scalar [...]
operator +(Matrix other) Matrix
Add two matrices of same dimensions. [...]
operator -(Matrix other) Matrix
Subtract two matrices of same dimensions. [...]
operator ==(dynamic other) → bool
Equality check for each element in the matrix.
operator [](int m) → List<double>
Access a row of data from the matrix [...]
operator ~() Matrix
Negate all values [...]