Types in MathNet.Numerics.LinearAlgebra
Public Static Functions
Matrix<T> Dense<T>(int rows, int columns, Func<int, int, T> init)
Create a new dense matrix and initialize each value using the provided init function.
Matrix<T> Dense<T>(int rows, int columns, T value)
Create a new dense matrix and initialize each value to the same provided value.
Matrix<T> Dense<T>(int rows, int columns, T[] storage)
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.
Matrix<T> Dense<T>(int rows, int columns)
Create a new dense matrix with the given number of rows and columns.
All cells of the matrix will be initialized to zero.
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.
Matrix<T> DenseDiagonal<T>(int rows, int columns, Func<int, T> init)
Create a new diagonal dense matrix and initialize each diagonal value using the provided init function.
Matrix<T> DenseDiagonal<T>(int order, T value)
Create a new diagonal dense matrix and initialize each diagonal value to the same provided value.
Matrix<T> DenseDiagonal<T>(int rows, int columns, T value)
Create a new diagonal dense matrix and initialize each diagonal value to the same provided value.
Matrix<T> DenseIdentity<T>(int rows, int columns)
Create a new diagonal dense identity matrix with a one-diagonal.
Matrix<T> DenseIdentity<T>(int order)
Create a new diagonal dense identity matrix with a one-diagonal.
Matrix<T> DenseOfColumnArrays<T>(T[][] columns)
Matrix<T> DenseOfColumnArrays<T>(IEnumerable<T[]> columns)
Create a new dense matrix of T 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.
Matrix<T> DenseOfColumnMajor<T>(int rows, int columns, IEnumerable<T> columnMajor)
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.
Matrix<T> DenseOfColumns<T>(IEnumerable<IEnumerable<T>> data)
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.
Matrix<T> DenseOfColumns<T>(int rows, int columns, IEnumerable<IEnumerable<T>> data)
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.
Matrix<T> DenseOfColumnVectors<T>(IEnumerable<Vector<T>> columns)
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.
Matrix<T> DenseOfColumnVectors<T>(Vector`1[] columns)
Matrix<T> DenseOfDiagonalArray<T>(int rows, int columns, T[] diagonal)
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.
Matrix<T> DenseOfDiagonalArray<T>(T[] diagonal)
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.
Matrix<T> DenseOfDiagonalVector<T>(int rows, int columns, Vector<T> diagonal)
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.
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.
Matrix<T> DenseOfIndexed<T>(int rows, int columns, IEnumerable<Tuple<int, int, T>> enumerable)
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.
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.
Matrix<T> DenseOfMatrixArray<T>(Matrix`1[,] matrices)
Matrix<T> DenseOfRowArrays<T>(IEnumerable<T[]> rows)
Create a new dense matrix of T 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.
Matrix<T> DenseOfRows<T>(int rows, int columns, IEnumerable<IEnumerable<T>> data)
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.
Matrix<T> DenseOfRows<T>(IEnumerable<IEnumerable<T>> data)
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.
Matrix<T> DenseOfRowVectors<T>(IEnumerable<Vector<T>> rows)
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.
Matrix<T> DenseOfRowVectors<T>(Vector`1[] rows)
Matrix<T> Diagonal<T>(T[] storage)
Create a new square diagonal matrix directly binding to a raw array.
The array is assumed to represent the diagonal values and is used directly without copying.
Very efficient, but changes to the array and the matrix will affect each other.
Matrix<T> Diagonal<T>(int rows, int columns, Func<int, T> init)
Create a new diagonal matrix and initialize each diagonal value using the provided init function.
Create a new diagonal 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.
Matrix<T> Diagonal<T>(int rows, int columns, T value)
Create a new diagonal matrix and initialize each diagonal value to the same provided value.
Matrix<T> Diagonal<T>(int rows, int columns)
Create a new diagonal matrix with the given number of rows and columns.
All cells of the matrix will be initialized to zero.
Matrix<T> Diagonal<T>(int rows, int columns, T[] storage)
Create a new diagonal matrix with the given number of rows and columns directly binding to a raw array.
The array is assumed to represent the diagonal values and is used directly without copying.
Very efficient, but changes to the array and the matrix will affect each other.
Matrix<T> DiagonalIdentity<T>(int order)
Create a new diagonal identity matrix with a one-diagonal.
Matrix<T> DiagonalIdentity<T>(int rows, int columns)
Create a new diagonal identity matrix with a one-diagonal.
Matrix<T> DiagonalOfDiagonalArray<T>(int rows, int columns, T[] diagonal)
Create a new diagonal 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.
Matrix<T> DiagonalOfDiagonalArray<T>(T[] diagonal)
Create a new diagonal 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.
Matrix<T> DiagonalOfDiagonalVector<T>(Vector<T> diagonal)
Create a new diagonal 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.
Matrix<T> DiagonalOfDiagonalVector<T>(int rows, int columns, Vector<T> diagonal)
Create a new diagonal 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.
Matrix<T> Random<T>(int rows, int columns, int seed)
Create a new dense matrix with values sampled from the standard distribution with a system random source.
Matrix<T> Random<T>(int rows, int columns)
Create a new dense matrix with values sampled from the standard distribution with a system random source.
Create a new dense matrix with values sampled from the provided random distribution.
Matrix<T> RandomPositiveDefinite<T>(int order)
Create a new positive definite dense matrix where each value is the product
of two samples from the standard distribution.
Create a new positive definite dense matrix where each value is the product
of two samples from the provided random distribution.
Matrix<T> RandomPositiveDefinite<T>(int order, int seed)
Create a new positive definite dense matrix where each value is the product
of two samples from the provided random distribution.
Create a new matrix with a type that can represent and is closest to both provided samples and the dimensions of example.
Matrix<T> SameAs<T>(Matrix<T> example, Matrix<T> otherExample, int rows, int columns, bool fullyMutable)
Create a new matrix with a type that can represent and is closest to both provided samples.
Matrix<T> SameAs<T>(Vector<T> example, int rows, int columns)
Create a new matrix with the same kind of the provided example.
Create a new matrix with the same kind and dimensions of the provided example.
Matrix<T> SameAs<T, TU>(Matrix<T> example, int rows, int columns, bool fullyMutable)
Create a new matrix with the same kind of the provided example.
Matrix<T> Sparse<T>(int rows, int columns, Func<int, int, T> init)
Create a new sparse matrix and initialize each value using the provided init function.
Matrix<T> Sparse<T>(int rows, int columns, T value)
Create a new sparse matrix and initialize each value to the same provided value.
Matrix<T> Sparse<T>(int rows, int columns)
Create a sparse matrix of T with the given number of rows and columns.
Parameters
int
rows
int
columns
Create a new sparse 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.
Matrix<T> SparseDiagonal<T>(int rows, int columns, T value)
Create a new diagonal sparse matrix and initialize each diagonal value to the same provided value.
Matrix<T> SparseDiagonal<T>(int order, T value)
Create a new diagonal sparse matrix and initialize each diagonal value to the same provided value.
Matrix<T> SparseDiagonal<T>(int rows, int columns, Func<int, T> init)
Create a new diagonal sparse matrix and initialize each diagonal value using the provided init function.
Matrix<T> SparseIdentity<T>(int rows, int columns)
Create a new diagonal dense identity matrix with a one-diagonal.
Matrix<T> SparseIdentity<T>(int order)
Create a new diagonal dense identity matrix with a one-diagonal.
Matrix<T> SparseOfColumnArrays<T>(T[][] columns)
Matrix<T> SparseOfColumnArrays<T>(IEnumerable<T[]> columns)
Create a new sparse 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.
Matrix<T> SparseOfColumnMajor<T>(int rows, int columns, IList<T> columnMajor)
Create a new sparse matrix with the given number of rows and columns as a copy of the given array.
The array is assumed to be in column-major order (column by column).
This new matrix will be independent from the provided array.
A new memory block will be allocated for storing the matrix.
Matrix<T> SparseOfColumns<T>(IEnumerable<IEnumerable<T>> data)
Create a new sparse 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.
Matrix<T> SparseOfColumns<T>(int rows, int columns, IEnumerable<IEnumerable<T>> data)
Create a new sparse 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.
Matrix<T> SparseOfColumnVectors<T>(Vector`1[] columns)
Matrix<T> SparseOfColumnVectors<T>(IEnumerable<Vector<T>> columns)
Create a new sparse 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.
Matrix<T> SparseOfDiagonalArray<T>(int rows, int columns, T[] diagonal)
Create a new sparse 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.
Matrix<T> SparseOfDiagonalArray<T>(T[] diagonal)
Create a new sparse 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.
Matrix<T> SparseOfDiagonalVector<T>(int rows, int columns, Vector<T> diagonal)
Create a new sparse 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.
Matrix<T> SparseOfDiagonalVector<T>(Vector<T> diagonal)
Create a new sparse 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.
Matrix<T> SparseOfIndexed<T>(int rows, int columns, IEnumerable<Tuple<int, int, T>> enumerable)
Create a new sparse 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.
Create a new sparse 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.
Matrix<T> SparseOfMatrixArray<T>(Matrix`1[,] matrices)
Matrix<T> SparseOfRowArrays<T>(IEnumerable<T[]> rows)
Create a new sparse 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.
Matrix<T> SparseOfRowMajor<T>(int rows, int columns, IEnumerable<T> rowMajor)
Create a new sparse matrix as a copy of the given enumerable.
The enumerable is assumed to be in row-major order (row by row).
This new matrix will be independent from the enumerable.
A new memory block will be allocated for storing the vector.
Matrix<T> SparseOfRows<T>(int rows, int columns, IEnumerable<IEnumerable<T>> data)
Create a new sparse 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.
Matrix<T> SparseOfRows<T>(IEnumerable<IEnumerable<T>> data)
Create a new sparse 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.
Matrix<T> SparseOfRowVectors<T>(IEnumerable<Vector<T>> rows)
Create a new sparse 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.
Matrix<T> SparseOfRowVectors<T>(Vector`1[] rows)
Create a new matrix straight from an initialized matrix storage instance.
If you have an instance of a discrete storage type instead, use their direct methods instead.