Matrix class
The class for (1,1) tensor of rank 2 (matrix)
Constructors:
Matrix({int n, int m, int? seed}) /// create n⨯m matrix with He-Normal initialized values
Matrix.column(List<double> column) /// create [column.length]⨯1 column-vector matrix
Matrix.row(List<double> row) /// create 1⨯[column.length] row-vector matrix
Matrix.fromLists(List<List<double>> matrix) /// create matrix from given values in the [matrix]
Matrix.zero({int n, int m}) /// create n⨯m matrix full of zeros
Matrix.identity({int order}) /// create [order]⨯[order] identity square matrix
Matrix.diag({List<double> diag}) /// create [diag.length]⨯[diag.length] square matrix with diagonal elements from [diag]
Matrix.reshapeFromList(List<double> data, {int n, int m}) /// create n⨯m matrix from [data] filled by rows
Constructors
- Matrix({required int n, required int m, int? seed})
-
Matrix.column(List<
double> column) -
Matrix.diag({required List<
double> diag}) -
Matrix.fromLists(List<
List< matrix)double> > - Matrix.identity({required int order})
-
Matrix.reshapeFromList(List<
double> data, {required int n, required int m}) -
Matrix.row(List<
double> row) - Matrix.zero({required int n, required int m})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isVector → bool
-
Returns
true
if Matrix is column-vector or row-vectorno setter - m ↔ int
-
The column count
latefinal
-
matrix
→ List<
List< double> > -
The
List<List<double>>
representation of matrixno setter - n ↔ int
-
The row count
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- T → Matrix
-
The transposed matrix of this
no setter
Methods
-
addedScalar(
double scalar) → Matrix -
Return copy of this with added
scalar
to every element -
addScalar(
double scalar) → void - Add scalar to every element of this
-
apply(
double function(double)) → Matrix -
Return a copy of this where
function
was applied to every element -
flattenColumn(
) → Matrix - Return Matrix.column with all elements of this taken by rows
-
flattenList(
) → List< double> - Return List with all elements of this taken by rows
-
flattenRow(
) → Matrix - Return Matrix.row with all elements of this taken by rows
-
getColumn(
int index) → Matrix -
Return Matrix.column of
index
column of this -
getRow(
int index) → Matrix -
Return Matrix.row of
index
row of this -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reduceMean(
) → double - Return mean of all elements of this
-
reduceMeanByAxis(
int axis) → Matrix -
Return Matrix.column of means of the elements of this
reduced by
rows
(ifaxis
is 0) orcolumns
(ifaxis
is 1) -
reduceSum(
) → double - Return sum of all elements of this
-
reduceSumByAxis(
int axis) → Matrix -
Return Matrix.column of sums of the elements of this
reduced by
rows
(ifaxis
is 0) orcolumns
(ifaxis
is 1) -
scale(
double scalar) → void -
Scale every element of this by
scalar
-
scaled(
double scalar) → Matrix -
Return copy of this with scaled elements by
scalar
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator %(
Matrix other) → Matrix - Matrices Hadamard product operator
-
operator *(
Matrix other) → Matrix - Matrices multiplication operator
-
operator +(
Matrix other) → Matrix - Matrices elementwise addition operator
-
operator -(
Matrix other) → Matrix - Matrices elementwise subtraction operator
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → List< double> -
operator unary-(
) → Matrix - Negative matrix operator