Numerics class

This class provides a number of useful numeric calculations with vectors and matrices, such as multiplication, transpose, invert. Some of the provided methods are based on the respective js MIT-licensed code of https://github.com/sloisel/numeric.

Constructors

Numerics()
Creates instance for accessing the methods

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addMM(List<List<double>> matr1, List<List<double>> matr2) → List<List<double>>
Returns pointwise sum of matr1 and matr2 in a new matrix.
addToM(List<Float64List> matr1, List<Float64List> matr2) → List<Float64List>
Adds matr2 to matr1 and returns the modified matr1. The matrices must have the same number of rows and colmuns.
addVV(List<double> vec1, List<double> vec2) → List<double>
Returns pointwise sum of vec1 and vec2 in a new vector.
cloneMatrix(List<List<double>> matrix) → List<List<double>>
Clones a matrix: Returns a new matrix with same contents.
compareMM(List<List<double>> mat1, List<List<double>> mat2, double epsilon) → String
Compares two matrices mat1 and mat2. If all elements are not different more than epsilon, the matrices are considered as equals, and null is returned. Otherwise, a String of the form "i, k, mat1k, mat2k" is returned showing the first encountered unequal matrix element.
createDiagMatrix(int n, double value) → List<List<double>>
Creates n x n diagonal matrix with value.
createMatrix(int nrows, int ncols, double value) → List<List<double>>
Returns a new nrows x ncols matrix. All elements are set to value.
dotCM(double c, List<List<double>> matr) → List<List<double>>
Returns new matrix, the pointwise multiplication of matr with c.
dotMM(List<List<double>> matr1, List<List<double>> matr2) → List<List<double>>
Returns product of matrices matr1 and matr2. Suitable sizes required!
dotMMbig(List<List<double>> x, List<List<double>> y) → List<List<double>>
Utility for dotMM
dotMMsmall(List<List<double>> x, List<List<double>> y) → List<List<double>>
Utility for dotMM
dotMV(List<List<double>> matr, List<double> vec) → List<double>
Returns product matr dot vec.
dotVV(List<double> vec1, List<double> vec2) → double
Returns scalar product vec1 dot vec2.
getDiag(List<List<double>> matr) → List<double>
Returns the diagonal of a matrix matr Its length is the minimum of the row or column size of matr.
invMatrix(List<List<double>> mat) → List<List<double>>
Computes and returns the inverse of an invertible matrix mat.
sqrtV(List<double> vec) → List<double>
Returns new vector, the pointwise square root of vec.
sumM(List<List<double>> matrix) → double
Returns the sum of all entries of matrix.
transpose(List<List<double>> matrix) → List<List<double>>
Transposes matrix: Returns a new matrix.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited