C# Class MathNet.Numerics.LinearAlgebra.Single.DenseMatrix

Inheritance: System.Matrix
Show file Open project: cdrnet/mathnet-numerics Class Usage Examples

Public Methods

Method Description
Cholesky ( ) : Cholesky
Create ( int rows, int columns, Func init ) : DenseMatrix

Create a new dense matrix and initialize each value using the provided init function.

Create ( int rows, int columns, float value ) : DenseMatrix

Create a new dense matrix and initialize each value to the same provided value.

CreateDiagonal ( int rows, int columns, float>.Func init ) : DenseMatrix

Create a new diagonal dense matrix and initialize each diagonal value using the provided init function.

CreateDiagonal ( int rows, int columns, float value ) : DenseMatrix

Create a new diagonal dense matrix and initialize each diagonal value to the same provided value.

CreateIdentity ( int order ) : DenseMatrix

Create a new square sparse identity matrix where each diagonal value is set to One.

CreateRandom ( int rows, int columns, IContinuousDistribution distribution ) : DenseMatrix

Create a new dense matrix with values sampled from the provided random distribution.

DenseMatrix ( DenseColumnMajorMatrixStorage storage ) : System

Create a new dense matrix straight from an initialized matrix storage instance. The storage is used directly without copying. Intended for advanced scenarios where you're working directly with storage for performance or interop reasons.

DenseMatrix ( int order ) : System

Create a new square dense matrix with the given number of rows and columns. All cells of the matrix will be initialized to zero. Zero-length matrices are not supported.

DenseMatrix ( int rows, int columns ) : System

Create a new dense matrix with the given number of rows and columns. All cells of the matrix will be initialized to zero. Zero-length matrices are not supported.

DenseMatrix ( int rows, int columns, float storage ) : System

Create a new dense matrix with the given number of rows and columns directly binding to a raw array. The array is assumed to be in column-major order (column by column) and is used directly without copying. Very efficient, but changes to the array and the matrix will affect each other.

Evd ( Symmetricity symmetricity = Symmetricity.Unknown ) : Evd
FrobeniusNorm ( ) : double

Calculates the entry-wise Frobenius norm of this matrix.

GramSchmidt ( ) : GramSchmidt
InfinityNorm ( ) : double

Calculates the induced infinity norm of this matrix.

IsSymmetric ( ) : bool

Evaluates whether this matrix is symmetric.

L1Norm ( ) : double

Calculates the induced L1 norm of this matrix.

LU ( ) : LU
OfArray ( float array ) : DenseMatrix

Create a new dense matrix as a copy of the given two-dimensional array. This new matrix will be independent from the provided array. A new memory block will be allocated for storing the matrix.

OfColumnArrays ( ) : DenseMatrix

Create a new dense matrix as a copy of the given column arrays. This new matrix will be independent from the arrays. A new memory block will be allocated for storing the matrix.

OfColumnArrays ( IEnumerable columns ) : DenseMatrix

Create a new dense matrix as a copy of the given column arrays. This new matrix will be independent from the arrays. A new memory block will be allocated for storing the matrix.

OfColumnMajor ( int rows, int columns, IEnumerable columnMajor ) : DenseMatrix

Create a new dense matrix as a copy of the given enumerable. The enumerable is assumed to be in column-major order (column by column). This new matrix will be independent from the enumerable. A new memory block will be allocated for storing the matrix.

OfColumnVectors ( ) : DenseMatrix

Create a new dense matrix as a copy of the given column vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.

OfColumnVectors ( IEnumerable columns ) : DenseMatrix

Create a new dense matrix as a copy of the given column vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.

OfColumns ( IEnumerable data ) : DenseMatrix

Create a new dense matrix as a copy of the given enumerable of enumerable columns. Each enumerable in the master enumerable specifies a column. This new matrix will be independent from the enumerables. A new memory block will be allocated for storing the matrix.

OfColumns ( int rows, int columns, IEnumerable data ) : DenseMatrix

Create a new dense matrix as a copy of the given enumerable of enumerable columns. Each enumerable in the master enumerable specifies a column. This new matrix will be independent from the enumerables. A new memory block will be allocated for storing the matrix.

OfDiagonalArray ( float diagonal ) : DenseMatrix

Create a new dense matrix with the diagonal as a copy of the given array. This new matrix will be independent from the array. A new memory block will be allocated for storing the matrix.

OfDiagonalArray ( int rows, int columns, float diagonal ) : DenseMatrix

Create a new dense matrix with the diagonal as a copy of the given array. This new matrix will be independent from the array. A new memory block will be allocated for storing the matrix.

OfDiagonalVector ( Vector diagonal ) : DenseMatrix

Create a new dense matrix with the diagonal as a copy of the given vector. This new matrix will be independent from the vector. A new memory block will be allocated for storing the matrix.

OfDiagonalVector ( int rows, int columns, Vector diagonal ) : DenseMatrix

Create a new dense matrix with the diagonal as a copy of the given vector. This new matrix will be independent from the vector. A new memory block will be allocated for storing the matrix.

OfIndexed ( int rows, int columns, IEnumerable enumerable ) : DenseMatrix

Create a new dense matrix as a copy of the given indexed enumerable. Keys must be provided at most once, zero is assumed if a key is omitted. This new matrix will be independent from the enumerable. A new memory block will be allocated for storing the matrix.

OfMatrix ( Matrix matrix ) : DenseMatrix

Create a new dense matrix as a copy of the given other matrix. This new matrix will be independent from the other matrix. A new memory block will be allocated for storing the matrix.

OfRowArrays ( ) : DenseMatrix

Create a new dense matrix as a copy of the given row arrays. This new matrix will be independent from the arrays. A new memory block will be allocated for storing the matrix.

OfRowArrays ( IEnumerable rows ) : DenseMatrix

Create a new dense matrix as a copy of the given row arrays. This new matrix will be independent from the arrays. A new memory block will be allocated for storing the matrix.

OfRowVectors ( ) : DenseMatrix

Create a new dense matrix as a copy of the given row vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.

OfRowVectors ( IEnumerable rows ) : DenseMatrix

Create a new dense matrix as a copy of the given row vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.

OfRows ( IEnumerable data ) : DenseMatrix

Create a new dense matrix as a copy of the given enumerable of enumerable rows. Each enumerable in the master enumerable specifies a row. This new matrix will be independent from the enumerables. A new memory block will be allocated for storing the matrix.

OfRows ( int rows, int columns, IEnumerable data ) : DenseMatrix

Create a new dense matrix as a copy of the given enumerable of enumerable rows. Each enumerable in the master enumerable specifies a row. This new matrix will be independent from the enumerables. A new memory block will be allocated for storing the matrix.

QR ( QRMethod method = QRMethod.Thin ) : QR
Svd ( bool computeVectors = true ) : Svd
Trace ( ) : float

Computes the trace of this matrix.

operator ( ) : DenseMatrix

Multiplies a Matrix by a constant and returns the result.

operator ( ) : MathNet.Numerics.LinearAlgebra.Single.DenseVector

Multiplies a Matrix and a Vector.

Protected Methods

Method Description
DoAdd ( Matrix other, Matrix result ) : void

Adds another matrix to this matrix.

DoAdd ( float scalar, Matrix result ) : void

Add a scalar to each element of the matrix and stores the result in the result vector.

DoDivide ( float divisor, Matrix result ) : void

Divides each element of the matrix by a scalar and places results into the result matrix.

DoModulus ( float divisor, Matrix result ) : void

Computes the canonical modulus, where the result has the sign of the divisor, for the given divisor each element of the matrix.

DoModulusByThis ( float dividend, Matrix result ) : void

Computes the canonical modulus, where the result has the sign of the divisor, for the given dividend for each element of the matrix.

DoMultiply ( Matrix other, Matrix result ) : void

Multiplies this matrix with another matrix and places the results into the result matrix.

DoMultiply ( Vector rightSide, Vector result ) : void

Multiplies this matrix with a vector and places the results into the result vector.

DoMultiply ( float scalar, Matrix result ) : void

Multiplies each element of the matrix by a scalar and places results into the result matrix.

DoNegate ( Matrix result ) : void

Negate each element of this matrix and place the results into the result matrix.

DoPointwiseDivide ( Matrix divisor, Matrix result ) : void

Pointwise divide this matrix by another matrix and stores the result into the result matrix.

DoPointwiseMultiply ( Matrix other, Matrix result ) : void

Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.

DoRemainder ( float divisor, Matrix result ) : void

Computes the remainder (% operator), where the result has the sign of the dividend, for the given divisor each element of the matrix.

DoRemainderByThis ( float dividend, Matrix result ) : void

Computes the remainder (% operator), where the result has the sign of the dividend, for the given dividend for each element of the matrix.

DoSubtract ( Matrix other, Matrix result ) : void

Subtracts another matrix from this matrix.

DoSubtract ( float scalar, Matrix result ) : void

Subtracts a scalar from each element of the matrix and stores the result in the result vector.

DoTransposeAndMultiply ( Matrix other, Matrix result ) : void

Multiplies this matrix with transpose of another matrix and places the results into the result matrix.

DoTransposeThisAndMultiply ( Matrix other, Matrix result ) : void

Multiplies the transpose of this matrix with another matrix and places the results into the result matrix.

DoTransposeThisAndMultiply ( Vector rightSide, Vector result ) : void

Multiplies the transpose of this matrix with a vector and places the results into the result vector.

Method Details

Cholesky() public method

public Cholesky ( ) : Cholesky
return Cholesky

Create() public static method

Create a new dense matrix and initialize each value using the provided init function.
public static Create ( int rows, int columns, Func init ) : DenseMatrix
rows int
columns int
init Func
return DenseMatrix

Create() public static method

Create a new dense matrix and initialize each value to the same provided value.
public static Create ( int rows, int columns, float value ) : DenseMatrix
rows int
columns int
value float
return DenseMatrix

CreateDiagonal() public static method

Create a new diagonal dense matrix and initialize each diagonal value using the provided init function.
public static CreateDiagonal ( int rows, int columns, float>.Func init ) : DenseMatrix
rows int
columns int
init float>.Func
return DenseMatrix

CreateDiagonal() public static method

Create a new diagonal dense matrix and initialize each diagonal value to the same provided value.
public static CreateDiagonal ( int rows, int columns, float value ) : DenseMatrix
rows int
columns int
value float
return DenseMatrix

CreateIdentity() public static method

Create a new square sparse identity matrix where each diagonal value is set to One.
public static CreateIdentity ( int order ) : DenseMatrix
order int
return DenseMatrix

CreateRandom() public static method

Create a new dense matrix with values sampled from the provided random distribution.
public static CreateRandom ( int rows, int columns, IContinuousDistribution distribution ) : DenseMatrix
rows int
columns int
distribution IContinuousDistribution
return DenseMatrix

DenseMatrix() public method

Create a new dense matrix straight from an initialized matrix storage instance. The storage is used directly without copying. Intended for advanced scenarios where you're working directly with storage for performance or interop reasons.
public DenseMatrix ( DenseColumnMajorMatrixStorage storage ) : System
storage DenseColumnMajorMatrixStorage
return System

DenseMatrix() public method

Create a new square dense matrix with the given number of rows and columns. All cells of the matrix will be initialized to zero. Zero-length matrices are not supported.
If the order is less than one.
public DenseMatrix ( int order ) : System
order int
return System

DenseMatrix() public method

Create a new dense matrix with the given number of rows and columns. All cells of the matrix will be initialized to zero. Zero-length matrices are not supported.
If the row or column count is less than one.
public DenseMatrix ( int rows, int columns ) : System
rows int
columns int
return System

DenseMatrix() public method

Create a new dense matrix with the given number of rows and columns directly binding to a raw array. The array is assumed to be in column-major order (column by column) and is used directly without copying. Very efficient, but changes to the array and the matrix will affect each other.
public DenseMatrix ( int rows, int columns, float storage ) : System
rows int
columns int
storage float
return System

DoAdd() protected method

Adds another matrix to this matrix.
If the other matrix is . If the two matrices don't have the same dimensions.
protected DoAdd ( Matrix other, Matrix result ) : void
other Matrix The matrix to add to this matrix.
result Matrix The matrix to store the result of add
return void

DoAdd() protected method

Add a scalar to each element of the matrix and stores the result in the result vector.
protected DoAdd ( float scalar, Matrix result ) : void
scalar float The scalar to add.
result Matrix The matrix to store the result of the addition.
return void

DoDivide() protected method

Divides each element of the matrix by a scalar and places results into the result matrix.
protected DoDivide ( float divisor, Matrix result ) : void
divisor float The scalar to divide the matrix with.
result Matrix The matrix to store the result of the division.
return void

DoModulus() protected method

Computes the canonical modulus, where the result has the sign of the divisor, for the given divisor each element of the matrix.
protected DoModulus ( float divisor, Matrix result ) : void
divisor float The scalar denominator to use.
result Matrix Matrix to store the results in.
return void

DoModulusByThis() protected method

Computes the canonical modulus, where the result has the sign of the divisor, for the given dividend for each element of the matrix.
protected DoModulusByThis ( float dividend, Matrix result ) : void
dividend float The scalar numerator to use.
result Matrix A vector to store the results in.
return void

DoMultiply() protected method

Multiplies this matrix with another matrix and places the results into the result matrix.
protected DoMultiply ( Matrix other, Matrix result ) : void
other Matrix The matrix to multiply with.
result Matrix The result of the multiplication.
return void

DoMultiply() protected method

Multiplies this matrix with a vector and places the results into the result vector.
protected DoMultiply ( Vector rightSide, Vector result ) : void
rightSide Vector The vector to multiply with.
result Vector The result of the multiplication.
return void

DoMultiply() protected method

Multiplies each element of the matrix by a scalar and places results into the result matrix.
protected DoMultiply ( float scalar, Matrix result ) : void
scalar float The scalar to multiply the matrix with.
result Matrix The matrix to store the result of the multiplication.
return void

DoNegate() protected method

Negate each element of this matrix and place the results into the result matrix.
protected DoNegate ( Matrix result ) : void
result Matrix The result of the negation.
return void

DoPointwiseDivide() protected method

Pointwise divide this matrix by another matrix and stores the result into the result matrix.
protected DoPointwiseDivide ( Matrix divisor, Matrix result ) : void
divisor Matrix The matrix to pointwise divide this one by.
result Matrix The matrix to store the result of the pointwise division.
return void

DoPointwiseMultiply() protected method

Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.
protected DoPointwiseMultiply ( Matrix other, Matrix result ) : void
other Matrix The matrix to pointwise multiply with this one.
result Matrix The matrix to store the result of the pointwise multiplication.
return void

DoRemainder() protected method

Computes the remainder (% operator), where the result has the sign of the dividend, for the given divisor each element of the matrix.
protected DoRemainder ( float divisor, Matrix result ) : void
divisor float The scalar denominator to use.
result Matrix Matrix to store the results in.
return void

DoRemainderByThis() protected method

Computes the remainder (% operator), where the result has the sign of the dividend, for the given dividend for each element of the matrix.
protected DoRemainderByThis ( float dividend, Matrix result ) : void
dividend float The scalar numerator to use.
result Matrix A vector to store the results in.
return void

DoSubtract() protected method

Subtracts another matrix from this matrix.
protected DoSubtract ( Matrix other, Matrix result ) : void
other Matrix The matrix to subtract.
result Matrix The matrix to store the result of the subtraction.
return void

DoSubtract() protected method

Subtracts a scalar from each element of the matrix and stores the result in the result vector.
protected DoSubtract ( float scalar, Matrix result ) : void
scalar float The scalar to subtract.
result Matrix The matrix to store the result of the subtraction.
return void

DoTransposeAndMultiply() protected method

Multiplies this matrix with transpose of another matrix and places the results into the result matrix.
protected DoTransposeAndMultiply ( Matrix other, Matrix result ) : void
other Matrix The matrix to multiply with.
result Matrix The result of the multiplication.
return void

DoTransposeThisAndMultiply() protected method

Multiplies the transpose of this matrix with another matrix and places the results into the result matrix.
protected DoTransposeThisAndMultiply ( Matrix other, Matrix result ) : void
other Matrix The matrix to multiply with.
result Matrix The result of the multiplication.
return void

DoTransposeThisAndMultiply() protected method

Multiplies the transpose of this matrix with a vector and places the results into the result vector.
protected DoTransposeThisAndMultiply ( Vector rightSide, Vector result ) : void
rightSide Vector The vector to multiply with.
result Vector The result of the multiplication.
return void

Evd() public method

public Evd ( Symmetricity symmetricity = Symmetricity.Unknown ) : Evd
symmetricity Symmetricity
return Evd

FrobeniusNorm() public method

Calculates the entry-wise Frobenius norm of this matrix.
public FrobeniusNorm ( ) : double
return double

GramSchmidt() public method

public GramSchmidt ( ) : GramSchmidt
return GramSchmidt

InfinityNorm() public method

Calculates the induced infinity norm of this matrix.
public InfinityNorm ( ) : double
return double

IsSymmetric() public method

Evaluates whether this matrix is symmetric.
public IsSymmetric ( ) : bool
return bool

L1Norm() public method

Calculates the induced L1 norm of this matrix.
public L1Norm ( ) : double
return double

LU() public method

public LU ( ) : LU
return LU

OfArray() public static method

Create a new dense matrix as a copy of the given two-dimensional array. This new matrix will be independent from the provided array. A new memory block will be allocated for storing the matrix.
public static OfArray ( float array ) : DenseMatrix
array float
return DenseMatrix

OfColumnArrays() public static method

Create a new dense matrix as a copy of the given column arrays. This new matrix will be independent from the arrays. A new memory block will be allocated for storing the matrix.
public static OfColumnArrays ( ) : DenseMatrix
return DenseMatrix

OfColumnArrays() public static method

Create a new dense matrix as a copy of the given column arrays. This new matrix will be independent from the arrays. A new memory block will be allocated for storing the matrix.
public static OfColumnArrays ( IEnumerable columns ) : DenseMatrix
columns IEnumerable
return DenseMatrix

OfColumnMajor() public static method

Create a new dense matrix as a copy of the given enumerable. The enumerable is assumed to be in column-major order (column by column). This new matrix will be independent from the enumerable. A new memory block will be allocated for storing the matrix.
public static OfColumnMajor ( int rows, int columns, IEnumerable columnMajor ) : DenseMatrix
rows int
columns int
columnMajor IEnumerable
return DenseMatrix

OfColumnVectors() public static method

Create a new dense matrix as a copy of the given column vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.
public static OfColumnVectors ( ) : DenseMatrix
return DenseMatrix

OfColumnVectors() public static method

Create a new dense matrix as a copy of the given column vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.
public static OfColumnVectors ( IEnumerable columns ) : DenseMatrix
columns IEnumerable
return DenseMatrix

OfColumns() public static method

Create a new dense matrix as a copy of the given enumerable of enumerable columns. Each enumerable in the master enumerable specifies a column. This new matrix will be independent from the enumerables. A new memory block will be allocated for storing the matrix.
public static OfColumns ( IEnumerable data ) : DenseMatrix
data IEnumerable
return DenseMatrix

OfColumns() public static method

Create a new dense matrix as a copy of the given enumerable of enumerable columns. Each enumerable in the master enumerable specifies a column. This new matrix will be independent from the enumerables. A new memory block will be allocated for storing the matrix.
public static OfColumns ( int rows, int columns, IEnumerable data ) : DenseMatrix
rows int
columns int
data IEnumerable
return DenseMatrix

OfDiagonalArray() public static method

Create a new dense matrix with the diagonal as a copy of the given array. This new matrix will be independent from the array. A new memory block will be allocated for storing the matrix.
public static OfDiagonalArray ( float diagonal ) : DenseMatrix
diagonal float
return DenseMatrix

OfDiagonalArray() public static method

Create a new dense matrix with the diagonal as a copy of the given array. This new matrix will be independent from the array. A new memory block will be allocated for storing the matrix.
public static OfDiagonalArray ( int rows, int columns, float diagonal ) : DenseMatrix
rows int
columns int
diagonal float
return DenseMatrix

OfDiagonalVector() public static method

Create a new dense matrix with the diagonal as a copy of the given vector. This new matrix will be independent from the vector. A new memory block will be allocated for storing the matrix.
public static OfDiagonalVector ( Vector diagonal ) : DenseMatrix
diagonal Vector
return DenseMatrix

OfDiagonalVector() public static method

Create a new dense matrix with the diagonal as a copy of the given vector. This new matrix will be independent from the vector. A new memory block will be allocated for storing the matrix.
public static OfDiagonalVector ( int rows, int columns, Vector diagonal ) : DenseMatrix
rows int
columns int
diagonal Vector
return DenseMatrix

OfIndexed() public static method

Create a new dense matrix as a copy of the given indexed enumerable. Keys must be provided at most once, zero is assumed if a key is omitted. This new matrix will be independent from the enumerable. A new memory block will be allocated for storing the matrix.
public static OfIndexed ( int rows, int columns, IEnumerable enumerable ) : DenseMatrix
rows int
columns int
enumerable IEnumerable
return DenseMatrix

OfMatrix() public static method

Create a new dense matrix as a copy of the given other matrix. This new matrix will be independent from the other matrix. A new memory block will be allocated for storing the matrix.
public static OfMatrix ( Matrix matrix ) : DenseMatrix
matrix Matrix
return DenseMatrix

OfRowArrays() public static method

Create a new dense matrix as a copy of the given row arrays. This new matrix will be independent from the arrays. A new memory block will be allocated for storing the matrix.
public static OfRowArrays ( ) : DenseMatrix
return DenseMatrix

OfRowArrays() public static method

Create a new dense matrix as a copy of the given row arrays. This new matrix will be independent from the arrays. A new memory block will be allocated for storing the matrix.
public static OfRowArrays ( IEnumerable rows ) : DenseMatrix
rows IEnumerable
return DenseMatrix

OfRowVectors() public static method

Create a new dense matrix as a copy of the given row vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.
public static OfRowVectors ( ) : DenseMatrix
return DenseMatrix

OfRowVectors() public static method

Create a new dense matrix as a copy of the given row vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.
public static OfRowVectors ( IEnumerable rows ) : DenseMatrix
rows IEnumerable
return DenseMatrix

OfRows() public static method

Create a new dense matrix as a copy of the given enumerable of enumerable rows. Each enumerable in the master enumerable specifies a row. This new matrix will be independent from the enumerables. A new memory block will be allocated for storing the matrix.
public static OfRows ( IEnumerable data ) : DenseMatrix
data IEnumerable
return DenseMatrix

OfRows() public static method

Create a new dense matrix as a copy of the given enumerable of enumerable rows. Each enumerable in the master enumerable specifies a row. This new matrix will be independent from the enumerables. A new memory block will be allocated for storing the matrix.
public static OfRows ( int rows, int columns, IEnumerable data ) : DenseMatrix
rows int
columns int
data IEnumerable
return DenseMatrix

QR() public method

public QR ( QRMethod method = QRMethod.Thin ) : QR
method QRMethod
return QR

Svd() public method

public Svd ( bool computeVectors = true ) : Svd
computeVectors bool
return Svd

Trace() public method

Computes the trace of this matrix.
If the matrix is not square
public Trace ( ) : float
return float

operator() public static method

Multiplies a Matrix by a constant and returns the result.
If is .
public static operator ( ) : DenseMatrix
return DenseMatrix

operator() public static method

Multiplies a Matrix and a Vector.
If or is .
public static operator ( ) : MathNet.Numerics.LinearAlgebra.Single.DenseVector
return MathNet.Numerics.LinearAlgebra.Single.DenseVector