Matrix<T> class abstract mixin

Abstract matrix type.

Available Extensions

Constructors

Matrix(DataType<T> dataType, int rowCount, int columnCount, {MatrixFormat? format})
Constructs a default matrix of the desired dataType, the provided rowCount and columnCount, and possibly a custom format.
factory
Matrix.concatHorizontal(DataType<T> dataType, Iterable<Matrix<T>> matrices, {MatrixFormat? format})
Returns the horizontal concatenation of matrices.
factory
Matrix.concatVertical(DataType<T> dataType, Iterable<Matrix<T>> matrices, {MatrixFormat? format})
Returns the vertical concatenation of matrices.
factory
Matrix.constant(DataType<T> dataType, int rowCount, int columnCount, {T? value, MatrixFormat? format})
Returns a matrix with a constant value.
factory
Matrix.fromColumns(DataType<T> dataType, List<List<T>> source, {MatrixFormat? format})
Constructs a matrix from a nested list of columns.
factory
Matrix.fromPackedColumns(DataType<T> dataType, int rowCount, int columnCount, List<T> source, {MatrixFormat? format})
Constructs a matrix from a packed list of columns.
factory
Matrix.fromPackedRows(DataType<T> dataType, int rowCount, int columnCount, List<T> source, {MatrixFormat? format})
Constructs a matrix from a packed list of rows.
factory
Matrix.fromRows(DataType<T> dataType, List<List<T>> source, {MatrixFormat? format})
Constructs a matrix from a nested list of rows.
factory
Matrix.generate(DataType<T> dataType, int rowCount, int columnCount, MatrixGeneratorCallback<T> callback, {MatrixFormat? format})
Generates a matrix from calling a callback on every value.
factory
Matrix.identity(DataType<T> dataType, int rowCount, int columnCount, {T? value, MatrixFormat? format})
Returns an identity matrix with the constant value.
factory
Matrix.vandermonde(DataType<T> dataType, Vector<T> data, int columnCount, {MatrixFormat? format})
Returns a Vandermonde matrix, a matrix with the terms of a geometric progression in each row.
factory

Properties

colCount int
Returns the number of columns in the matrix.
no setter
dataType DataType<T>
Returns the data type of this matrix.
no setter
hashCode int
The hash code for this object.
no setterinherited
rowCount int
Returns the number of rows in the matrix.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape List<int>
Returns the shape of this matrix.
no setter
storage Set<Storage>
Returns the underlying storage containers of this object.
no setterinherited

Methods

copyInto(Matrix<T> target) Matrix<T>
Returns the target matrix with all elements of this matrix copied into it.
forEach(void callback(int row, int col, T value)) → void
Iterates over each value in the matrix. Skips over default values, which can be done very efficiently on sparse matrices.
format({Printer<T>? valuePrinter, Printer<String>? paddingPrinter, Printer<String>? ellipsesPrinter, bool limit = true, int leadingItems = 3, int trailingItems = 3, String horizontalSeparator = ' ', String verticalSeparator = '\n', String horizontalEllipses = '\u2026', String verticalEllipses = '\u22ee', String diagonalEllipses = '\u22f1'}) String
Returns a human readable representation of the matrix.
get(int row, int col) → T
Returns the scalar at the provided row and col index. Throws a RangeError if row or col are outside of bounds.
getUnchecked(int row, int col) → T
Returns the scalar at the provided row and col index. The behavior is undefined if row or col are outside of bounds.
isWithinBounds(int row, int col) bool
Tests if row and col are within the bounds of this matrix.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(int row, int col, T value) → void
Sets the scalar at the provided row and col index to value. Throws a RangeError if row or col are outside of bounds.
setUnchecked(int row, int col, T value) → void
Sets the scalar at the provided row and col index to value. The behavior is undefined if row or col are outside of bounds.
toMatrix({MatrixFormat? format}) Matrix<T>
Creates a new Matrix containing the same elements as this one.
toString() String
Returns the string representation of this matrix.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int row) Vector<T>
Returns a mutable row vector of this matrix. Convenience method to read matrix values using row and column indexes: matrix[row][col].