Matrix Structure

Represents a dense rectangular matrix.

Definition

Namespace: Austra.Library
Assembly: Austra.Library (in Austra.Library.dll) Version: 2.5.0+d1268756e036101f601080f153b3997e72fc912d
C#
public readonly struct Matrix : IFormattable, 
	IEquatable<Matrix>, IEqualityOperators<Matrix, Matrix, bool>, 
	IEqualityOperators<Matrix, LMatrix, bool>, IEqualityOperators<Matrix, RMatrix, bool>, 
	IAdditionOperators<Matrix, Matrix, Matrix>, IAdditionOperators<Matrix, LMatrix, Matrix>, 
	IAdditionOperators<Matrix, double, Matrix>, ISubtractionOperators<Matrix, Matrix, Matrix>, 
	ISubtractionOperators<Matrix, LMatrix, Matrix>, ISubtractionOperators<Matrix, double, Matrix>, 
	IMultiplyOperators<Matrix, Matrix, Matrix>, IMultiplyOperators<Matrix, DVector, DVector>, 
	IMultiplyOperators<Matrix, double, Matrix>, IDivisionOperators<Matrix, double, Matrix>, 
	IUnaryNegationOperators<Matrix, Matrix>, IPointwiseOperators<Matrix>, 
	IMatrix
Inheritance
Object    ValueType    Matrix
Implements
IMatrix, IPointwiseOperatorsMatrix, IEquatableMatrix, IFormattable, IAdditionOperatorsMatrix, Matrix, Matrix, IAdditionOperatorsMatrix, LMatrix, Matrix, IAdditionOperatorsMatrix, Double, Matrix, IDivisionOperatorsMatrix, Double, Matrix, IEqualityOperatorsMatrix, Matrix, Boolean, IEqualityOperatorsMatrix, LMatrix, Boolean, IEqualityOperatorsMatrix, RMatrix, Boolean, IMultiplyOperatorsMatrix, Matrix, Matrix, IMultiplyOperatorsMatrix, DVector, DVector, IMultiplyOperatorsMatrix, Double, Matrix, ISubtractionOperatorsMatrix, Matrix, Matrix, ISubtractionOperatorsMatrix, LMatrix, Matrix, ISubtractionOperatorsMatrix, Double, Matrix, IUnaryNegationOperatorsMatrix, Matrix

Remarks

Values are stored in a one-dimensional array, in row-major order. Compatibility with bidimensional arrays, however, has been preserved.

Most methods respect immutability at the cost of extra allocations. Methods like MultiplyAdd(DVector, Double, DVector) save unneeded allocations. Most methods are hardware accelerated, either by using managed references, SIMD operations or both. Memory pinning has also been reduced to the minimum.

Constructors

Matrix(Double)Creates a diagonal matrix given its diagonal.
Matrix(DVector)Creates a diagonal matrix given its diagonal.
Matrix(DVector)Creates a matrix given its rows.
Matrix(Int32)Creates an empty square matrix.
Matrix(Int32, NormalRandom)Creates a squared matrix filled with a standard normal distribution.
Matrix(Int32, FuncInt32, Int32, Double)Creates a square matrix using a formula to fill its cells.
Matrix(Int32, Int32)Creates an empty rectangular matrix.
Matrix(Int32, Random) Creates a square matrix filled with a uniform distribution generator.
Matrix(Int32, Int32, NormalRandom)Creates a matrix filled with a standard normal distribution.
Matrix(Int32, Int32, Double) Creates a matrix with a given number of rows and columns, and its internal array.
Matrix(Int32, Int32, FuncInt32, Int32, Double)Creates a matrix using a formula to fill its cells.
Matrix(Int32, Int32, Random)Creates a matrix filled with a uniform distribution generator.
Matrix(Int32, Random, Double, Double)Creates a square matrix filled with a uniform distribution generator.
Matrix(Int32, Int32, Random, Double, Double)Creates a matrix filled with a uniform distribution generator.

Properties

ColsGets the number of columns.
IsInitializedHas the matrix been properly initialized?
IsSquareChecks if the matrix is a square one.
ItemIndex, IndexGets the value of a single cell using Index.
ItemIndex, RangeGets a range of rows and columns as a new matrix.
ItemInt32, Int32Gets or sets the value of a single cell.
ItemInt32, RangeGets a range of rows and columns as a new matrix.
ItemRange, IndexGets a range of rows and columns as a new matrix.
ItemRange, Int32Gets a range of rows and columns as a new matrix.
ItemRange, RangeGets a range of rows and columns as a new matrix.
RowsGets the number of rows.

Methods

AllChecks whether the predicate is satified by all cells.
AMaxGets the cell with the maximum absolute value.
AMinGets the cell with the minimum absolute value.
AnyChecks whether the predicate is satified by at least one cell.
CholeskyComputes the Cholesky decomposition of this matrix.
CholeskyMatrixComputes the Cholesky decomposition of this matrix.
CloneCreates an identical rectangular matrix.
ContainsChecks if the matrix contains the given value.
DeterminantGets the determinant of the matrix.
DiagonalGets the main diagonal.
DistanceComputes the maximum difference between cells.
Equals(Matrix)Checks if the provided argument is a matrix with the same values.
Equals(Object)Checks if the provided argument is a matrix with the same values.
(Overrides ValueTypeEquals(Object))
EVDComputes the eigenvalue decomposition.
EVD(NullableBoolean)Computes the eigenvalue decomposition.
FromColumnsCreates a matrix given its columns.
GetColumn(Index)Gets a copy of a column as a vector, using Index.
GetColumn(Int32)Gets a copy of a column as a vector.
GetHashCodeReturns the hashcode for this matrix.
(Overrides ValueTypeGetHashCode)
GetRow(Index)Gets a copy of a row as a vector, using Index.
GetRow(Int32)Gets a copy of a row as a vector.
GetTypeGets the Type of the current instance.
(Inherited from Object)
HCat(Matrix)Horizontal concatenation of an array of matrices.
HCat(DVector, Matrix)Horizontal concatenation of a new column and a matrix.
HCat(Matrix, DVector)Horizontal concatenation of a matrix and a new column.
HCat(Matrix, Matrix)Horizontal concatenation of two matrices.
IdentityCreates an identity matrix given its size.
InverseCalculates the inverse of the matrix.
IsSymmetricChecks if the matrix is a symmetric one.
LUPerforms the LUP decomposition of this matrix.
MapApplies a function to each cell of the matrix.
MaximumGets the cell with the maximum value.
MinimumGets the cell with the minimum value.
MultiplyAdd(CVector, CVector)Transforms a complex vector and adds an offset.
MultiplyAdd(DVector, DVector)Transforms a vector and adds an offset.
MultiplyAdd(DVector, Double, DVector)Transforms a vector and adds an offset.
MultiplySubtract(CVector, CVector)Transforms a complex vector and subtracts an offset.
MultiplySubtract(DVector, DVector)Transforms a vector and subtracts an offset.
MultiplyTranspose(Matrix)Multiplies this matrix by the transposed argument.
MultiplyTranspose(Matrix, Double)Multiplies this matrix by the transposed argument.
PointwiseDivideCell by cell division with a second matrix.
PointwiseMultiplyCell by cell product with a second matrix.
Redim(Int32)Creates a new matrix with different dimensions.
Redim(Int32, Int32)Creates a new matrix with different dimensions.
Solve(DVector)Solves the equation Ax = b for x.
Solve(Matrix)Solves the equation AX = B for the matrix X.
SquareMultiplies this matrix by itself.
StatsGets statistics on the matrix cells.
SubtractMultiply(CVector, CVector)Optimized subtraction of transformed complex vector.
SubtractMultiply(DVector, DVector)Optimized subtraction of transformed vector.
SumCalculates the sum of the matrix cells.
SymEVDComputes the eigenvalue decomposition for a symmetric matrix.
ToStringGets a textual representation of this matrix.
(Overrides ValueTypeToString)
ToString(String, IFormatProvider)Gets a textual representation of this matrix.
TraceCalculates the trace of a matrix.
TransformTransforms a vector using a matrix and a preallocated buffer.
TransposeTransposes the matrix.
TransposeMultiplyTransforms a vector using the transpose of this matrix.
TryCholeskyTentative Cholesky decomposition.
VCat(Matrix)Vertical concatenation of an array of matrices.
VCat(DVector, Matrix)Vertical concatenation of a row vector and a matrix.
VCat(Matrix, DVector)Vertical concatenation of a matrix and a row vector.
VCat(Matrix, Matrix)Vertical concatenation of two matrices.

Operators

Addition(Double, Matrix)Adds a scalar to a matrix.
Addition(LMatrix, Matrix)Adds a lower triangular matrix to a full matrix.
Addition(Matrix, LMatrix)Adds a full matrix to a lower triangular matrix.
Addition(Matrix, Matrix)Sums two matrices with the same size.
Addition(Matrix, RMatrix)Adds a full matrix to an upper triangular matrix.
Addition(Matrix, Double)Adds a scalar to a matrix.
Addition(RMatrix, Matrix)Adds an upper triangular matrix to a full matrix.
Division(DVector, Matrix)Solves the equation m*x = v for the vector x.
Division(Matrix, Matrix)Solves the equation m2*x = m1 for the matrix x.
Division(Matrix, Double)Divides a matrix by a scalar value.
Equality(Matrix, LMatrix)Checks two matrices for equality.
Equality(Matrix, Matrix)Checks two matrices for equality.
Equality(Matrix, RMatrix)Checks two matrices for equality.
(Matrix to Double)Explicit conversion from a matrix to a 1D-array.
(Matrix to Double)Explicit conversion from a matrix to a 2D-array.
Inequality(Matrix, LMatrix)Checks two matrices for inequality.
Inequality(Matrix, Matrix)Checks two matrices for inequality.
Inequality(Matrix, RMatrix)Checks two matrices for inequality.
Multiply(CVector, Matrix)Transform a complex vector using the transposed matrix.
Multiply(Double, Matrix)Multiplies a matrix by a scalar value.
Multiply(DVector, Matrix)Transform a vector using the transposed matrix.
Multiply(Matrix, CVector)Transform a complex vector using a matrix.
Multiply(Matrix, DVector)Transform a vector using a matrix.
Multiply(Matrix, Matrix)Multiplies two compatible matrices.
Multiply(Matrix, Double)Multiplies a matrix by a scalar value.
Subtraction(Double, Matrix)Subtracts a matrix from a scalar.
Subtraction(LMatrix, Matrix)Subtracts a full matrix from a lower-triangular matrix.
Subtraction(Matrix, LMatrix)Subtracts a lower-triangular matrix from a full matrix.
Subtraction(Matrix, Matrix)Subtracts two matrices with the same size.
Subtraction(Matrix, RMatrix)Subtracts an upper-triangular matrix from a full matrix.
Subtraction(Matrix, Double)Subtracts a scalar from a matrix.
Subtraction(RMatrix, Matrix)Subtracts a full matrix from an upper-triangular matrix.
UnaryNegation(Matrix)Negates a matrix.

See Also