ComplexMatrix class
A simple Dart implementation of an m x n
matrix whose data type is double.
final matrix = ComplexMatrix(
rowCount: 3,
columnCount: 4,
);
By default, the cells of a matrix are initialized with all zeroes. You can access elements of the matrix very conveniently with the following syntax:
final matrix = ComplexMatrix(
rowCount: 6,
columnCount: 6,
);
final value = matrix(2, 3);
final value = matrix.itemAt(2, 3);
Both versions return the same value but the first one is of course less
verbose and you should prefer it. In the example, we're retrieving the value
of the element at position (1, 3)
in the matrix.
Constructors
- ComplexMatrix({required int rows, required int columns, bool identity = false})
-
Creates a new
N x M
matrix whererows
isN
andcolumns
isM
. The matrix is filled with zeroes. -
ComplexMatrix.fromData({required int rows, required int columns, required List<
List< data})Complex> > -
Creates a new
N x M
matrix whererows
isN
andcolumns
isM
. The matrix is filled with values fromdata
. -
ComplexMatrix.fromFlattenedData({required int rows, required int columns, required List<
Complex> data}) -
Creates a new
N x M
matrix whererows
isN
andcolumns
isM
. The matrix is filled with values fromdata
.
Properties
- columnCount → int
-
The number of columns of the matrix.
finalinherited
-
flattenData
↔ List<
Complex> -
A flattened representation of the data of the matrix
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isSquareMatrix → bool
-
Determines whether the matrix is square
no setterinherited
- rowCount → int
-
The number of rows of the matrix.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
int row, int col) → Complex -
Use this method to retrieve the element at a given position in the matrix.
For example:
inherited
-
choleskyDecomposition(
) → List< ComplexMatrix> -
Uses the the Cholesky decomposition algorithm to factor the matrix into
the product of a lower triangular matrix and its conjugate transpose. In
particular, this method returns the
L
andL
T matrices of theoverride -
determinant(
) → Complex -
The determinant can only be computed if the matrix is square, meaning
that it must have the same number of columns and rows.
override
-
itemAt(
int row, int col) → Complex -
Use this method to retrieve the element at a given position in the matrix.
For example:
inherited
-
luDecomposition(
) → List< ComplexMatrix> -
Factors the matrix as the product of a lower triangular matrix
L
and an upper triangular matrixU
. The matrix must be square.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
qrDecomposition(
) → List< ComplexMatrix> -
Computes the
Q
andR
matrices of the QR decomposition algorithm. In particular, this method returns theQ
andR
matrices of the -
toList(
) → List< Complex> -
Returns a modifiable "flattened" view of the matrix as a
List<T>
object.inherited -
toListOfList(
) → List< List< Complex> > -
Returns a modifiable view of the matrix as a
List<List<T>>
object.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
trace(
) → Complex -
The trace can only be computed if the matrix is square, meaning that
it must have the same number of columns and rows.
override
-
transposedValue(
int row, int col) → Complex -
Returns the value at (
row
,col
) position as if this matrix were transposed. For example, let's say we have this matrix object:inherited
Operators
-
operator *(
Matrix< Complex> other) → Matrix<Complex> -
Returns the product of two matrices.
override
-
operator +(
Matrix< Complex> other) → Matrix<Complex> -
Returns the sum of two matrices.
override
-
operator -(
Matrix< Complex> other) → Matrix<Complex> -
Returns the difference of two matrices.
override
-
operator /(
Matrix< Complex> other) → Matrix<Complex> -
Returns the division of two matrices in
O(n)
complexity.override -
operator ==(
Object other) → bool -
The equality operator.
inherited