Namespaces

Types

Type Matrix

Namespace MathNet.Numerics.LinearAlgebra

Interfaces IMatrix<T>, ICloneable

Methods

Properties

Public instance methods

void Add(IMatrix<T> m)

Parameters
IMatrix<T> m

void ArrayDivide(IMatrix<T> m)

Parameters
IMatrix<T> m

void ArrayMap(Converter<double, double> mapping)

Parameters
Converter<double, double> mapping

void ArrayMultiply(IMatrix<T> m)

Parameters
IMatrix<T> m

void ArrayPower(double exponent)

In place element-by-element raise to power, A[i,j] = A[i,j]^exponent.
Parameters
double exponent

CholeskyDecomposition chol()

Cholesky Decomposition
Parameters
return CholeskyDecomposition

Matrix Clone()

Returns a deep copy of this instance.
Parameters
return Matrix

double Condition()

Matrix condition (2 norm)
Parameters
return double

Double[,] CopyToArray()

Copies the internal data structure to a 2-dimensional array.
Parameters
return Double[,]

Double[][] CopyToJaggedArray()

Copies the internal data structure to a jagged rectangular array.
Parameters
return Double[][]

double Determinant()

Matrix determinant
Parameters
return double

EigenvalueDecomposition Eigen()

Eigenvalue Decomposition
Parameters
return EigenvalueDecomposition

bool Equals(object obj)

Parameters
return bool
object obj

Double[][] GetArray()

Returns the internal data structure array.
Parameters
return Double[][]

Vector GetColumnVector(int columnIndex)

Copies a specified column of this matrix to a new vector.
Parameters
return Vector
int columnIndex

int GetHashCode()

Parameters
return int

Matrix GetMatrix(int i0, int i1, int j0, int j1)

Gets a submatrix.
Parameters
return Matrix
int i0 First row index.
int i1 Last row index (inclusive).
int j0 First column index.
int j1 Last column index (inclusive).

Matrix GetMatrix(Int32[] r, Int32[] c)

Parameters
return Matrix
Int32[] r
Int32[] c

Matrix GetMatrix(int i0, int i1, Int32[] c)

Parameters
return Matrix
int i0
int i1
Int32[] c

Matrix GetMatrix(Int32[] r, int j0, int j1)

Parameters
return Matrix
Int32[] r
int j0
int j1

Vector GetRowVector(int rowIndex)

Copies a specified row of this matrix to a new vector.
Parameters
return Vector
int rowIndex

Type GetType()

Parameters
return Type

Matrix Inverse()

Matrix inverse or pseudoinverse.
Parameters
return Matrix

LUDecomposition LUD()

LU Decomposition
Parameters
return LUDecomposition

void Multiply(double s)

Multiplies in place this Matrix by a scalar.
Parameters
double s

Matrix Multiply(Matrix B)

Linear algebraic matrix multiplication, A * B
Parameters
return Matrix
Matrix B

void Multiply(Double[] diagonal)

Parameters
Double[] diagonal

double Norm1()

One norm
Parameters
return double

double Norm2()

Two norm
Parameters
return double

double NormF()

Frobenius norm
Parameters
return double

double NormInf()

Infinity norm
Parameters
return double

QRDecomposition QRD()

QR Decomposition
Parameters
return QRDecomposition

int Rank()

Matrix rank
Parameters
return int

void ResetComputations()

Reset various internal computations. Call this method after you made changes directly on the the internal double[][] data structure.

void SetColumnVector(IVector<T> columnVector, int columnIndex)

Parameters
IVector<T> columnVector
int columnIndex

void SetMatrix(Int32[] r, Int32[] c, IMatrix<T> X)

Parameters
Int32[] r
Int32[] c
IMatrix<T> X

void SetMatrix(int i0, int i1, Int32[] c, IMatrix<T> X)

Parameters
int i0
int i1
Int32[] c
IMatrix<T> X

void SetMatrix(int i0, int i1, int j0, int j1, IMatrix<T> X)

Parameters
int i0
int i1
int j0
int j1
IMatrix<T> X

void SetMatrix(Int32[] r, int j0, int j1, IMatrix<T> X)

Parameters
Int32[] r
int j0
int j1
IMatrix<T> X

void SetRowVector(IVector<T> rowVector, int rowIndex)

Parameters
IVector<T> rowVector
int rowIndex

Matrix Solve(Matrix B)

Solve A*X = B against a Least Square (L2) criterion.
Parameters
return Matrix
Matrix B right hand side

Matrix SolveRobust(Matrix B)

Solve A*X = B against a Least Absolute Deviation (L1) criterion.
Parameters
return Matrix
Matrix B right hand side

Matrix SolveTranspose(Matrix B)

Solve X*A = B, which is also A'*X' = B'
Parameters
return Matrix
Matrix B right hand side

void Subtract(IMatrix<T> m)

Parameters
IMatrix<T> m

SingularValueDecomposition SVD()

Singular Value Decomposition
Parameters
return SingularValueDecomposition

Matrix TensorMultiply(Matrix B)

Tensor Product (Kronecker) of this and another matrix.
Parameters
return Matrix
Matrix B The matrix to operate on.

string ToString()

Formats this matrix to a human-readable string
Parameters
return string

double Trace()

Matrix trace.
Parameters
return double

void Transpose()

In place transposition of this Matrix.
In case of non-quadratic matrices, this operation replaces the internal data structure. Hence, if you hold a reference to it for faster access, you'll need to get a new reference to it using GetArray.

void UnaryMinus()

In place unary minus of the Matrix.

Public static methods

bool AlmostEqual(Matrix X, Matrix Y, double relativeAccuracy)

Returns true if two matrices are almost equal (with some given relative accuracy).
Parameters
return bool
Matrix X
Matrix Y
double relativeAccuracy

bool AlmostEqual(Matrix X, Matrix Y)

Returns true if two matrices are almost equal.
Parameters
return bool
Matrix X
Matrix Y

Matrix ArrayDivide(IMatrix<T> m1, IMatrix<T> m2)

Parameters
return Matrix
IMatrix<T> m1
IMatrix<T> m2

Matrix ArrayMap(IMatrix<T> m, Converter<double, double> mapping)

Parameters
return Matrix
IMatrix<T> m
Converter<double, double> mapping

Matrix ArrayMultiply(IMatrix<T> m1, IMatrix<T> m2)

Parameters
return Matrix
IMatrix<T> m1
IMatrix<T> m2

Matrix ArrayPower(IMatrix<T> m, double exponent)

Parameters
return Matrix
IMatrix<T> m
double exponent

Double[][] CloneMatrixData(Double[][] data)

Parameters
return Double[][]
Double[][] data

Matrix Create(Double[,] A)

Parameters
return Matrix
Double[,] A

Matrix Create(Double[][] A)

Parameters
return Matrix
Double[][] A

Matrix CreateFromColumns(IList<Vector> columnVectors)

Parameters
return Matrix
IList<Vector> columnVectors

Matrix CreateFromRows(IList<Vector> rowVectors)

Parameters
return Matrix
IList<Vector> rowVectors

Double[][] CreateMatrixData(int m, int n)

Create the internal matrix data structure for a matrix of the given size. Initializing matrices directly on the internal structure may be faster than accessing the cells through the matrix class.
Parameters
return Double[][]
int m Number of rows.
int n Number of columns.

Matrix Diagonal(IVector<T> diagonalVector, int m, int n)

Parameters
return Matrix
IVector<T> diagonalVector
int m
int n

Matrix Diagonal(IVector<T> diagonalVector)

Parameters
return Matrix
IVector<T> diagonalVector

void GetRowColumnCount(Double[][] data, Int32& rows, Int32& columns)

Parameters
Double[][] data
Int32& rows
Int32& columns

Matrix Identity(int m, int n)

Generates identity matrix
Parameters
return Matrix
int m Number of rows.
int n Number of columns.

Matrix KroneckerProduct(Matrix A, Matrix B)

Kronecker Product of two matrices.
Parameters
return Matrix
Matrix A
Matrix B

Matrix Ones(int m)

Generates an m-by-m matrix filled with 1.
Parameters
return Matrix
int m Number of rows = Number of columns

Matrix Random(int m, int n)

Generates matrix with standard-distributed random elements.
Parameters
return Matrix
int m Number of rows.
int n Number of columns.

Matrix Random(int m, int n, IContinuousGenerator randomDistribution)

Generates matrix with random elements.
Parameters
return Matrix
int m Number of rows.
int n Number of columns.
IContinuousGenerator randomDistribution Continuous Random Distribution or Source

Matrix Transpose(IMatrix<T> m)

Parameters
return Matrix
IMatrix<T> m

Matrix Zeros(int m)

Generates an m-by-m matrix filled with 0.
Parameters
return Matrix
int m Number of rows = Number of columns

Public properties

CholeskyDecomposition CholeskyDecomposition get;

Cholesky Decomposition
return CholeskyDecomposition

int ColumnCount get;

Gets the number of columns.
return int

EigenvalueDecomposition EigenvalueDecomposition get;

Eigenvalue Decomposition
return EigenvalueDecomposition

ComplexVector EigenValues get;

Gets the complex eigen values of this matrix.
The eigenvalue decomposition is cached internally..
return ComplexVector

Matrix EigenVectors get;

Gets the complex eigen vectors of this matrix.
The eigenvalue decomposition is cached internally.
return Matrix

double Item get; set;

Gets or set the element indexed by (i, j)in the Matrix.
return double

LUDecomposition LUDecomposition get;

LU Decomposition
return LUDecomposition

QRDecomposition QRDecomposition get;

QR Decomposition
return QRDecomposition

int RowCount get;

Gets the number of rows.
return int

SingularValueDecomposition SingularValueDecomposition get;

Singular Value Decomposition
return SingularValueDecomposition