MatD class

Defines a matrix structure for holding double-precision values with data in row-major order (i.e. index = row*ncols + col).

nrows and ncols are 1-based counts with the exception that a scalar (non-matrix) is represented with nrows=0 and/or ncols=0.

Constructors

MatD(int nrows, int ncols, {List<double>? data})
Creates a double matrix with the given number of rows and columns (or a scalar in the case where rows=0 and/or cols=0). All data elements will be initialized to zero. It is the caller's responsibility to call matd_destroy() on the returned matrix.
MatD.identity(int dim)
Creates a square identity matrix with the given number of rows (and therefore columns), or a scalar with value 1 in the case where dim=0. It is the caller's responsibility to call matd_destroy() on the returned matrix.
factory
MatD.scalar(double value)
Creates a scalar with the supplied value 'v'. It is the caller's responsibility to call matd_destroy() on the returned matrix.
factory

Properties

data List<double>
Data buffer holding the matrix values.
final
hashCode int
The hash code for this object.
no setterinherited
isScalar bool
Determines whether the supplied matrix 'a' is a scalar (positive return) or not (zero return, indicating a matrix of dimensions at least 1x1).
no setter
isVector bool
Determines whether the supplied matrix 'a' is a row or column vector (positive return) or not (zero return, indicating either 'a' is a scalar or a matrix with at least one dimension > 1).
no setter
ncols int
Number of columns in the matrix.
final
nrows int
Number of rows in the matrix.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toNative Pointer<matd_t>
no setter

Methods

copy() MatD
Creates an exact copy of the supplied matrix 'm'. It is the caller's responsibility to call matd_destroy() on the returned matrix.
get(int row, int col) double
Retrieves the cell value for matrix 'm' at the given zero-based row and column index. Performs more thorough validation checking than MATD_EL().
getSclar() double
Retrieves the scalar value of the given element ('m' must be a scalar). Performs more thorough validation checking than MATD_EL().
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(int row, int col, double value) → void
Assigns the given value to the matrix cell at the given zero-based row and column index. Performs more thorough validation checking than MATD_EL().
putScalar(double value) → void
Assigns the given value to the supplied scalar element ('m' must be a scalar). Performs more thorough validation checking than MATD_EL().
scale(double s, {bool inplace = false}) MatD
Scales all cell values of matrix 'a' by the given scale factor 's' and returns the result as a new matrix of the same dimensions. It is the caller's responsibility to call matd_destroy() on the returned matrix.
toString() String
A string representation of this object.
inherited
transpose() MatD
Creates a matrix which is the transpose of the supplied matrix 'a'. It is the caller's responsibility to call matd_destroy() on the returned matrix.

Operators

operator *(MatD b) MatD
Multiplies the two supplied matrices together, per the standard matrix multiplication rules. The number of columns in the first matrix must equal the number of rows in the second matrix. It is the caller's responsibility to call matd_destroy() on the returned matrix.
operator +(MatD b) MatD
Adds the two supplied matrices together, cell-by-cell, and returns the results as a new matrix of the same dimensions. The supplied matrices must have identical dimensions. It is the caller's responsibility to call matd_destroy() on the returned matrix.
operator -(MatD b) MatD
Subtracts matrix 'b' from matrix 'a', cell-by-cell, and returns the results as a new matrix of the same dimensions. The supplied matrices must have identical dimensions. It is the caller's responsibility to call matd_destroy() on the returned matrix.
operator ==(Object other) bool
The equality operator.
inherited