Click or drag to resize

Matrix Structure

Represents a dense rectangular matrix.
Inheritance Hierarchy
SystemObject
  SystemValueType
    Austra.LibraryMatrix

Namespace: Austra.Library
Assembly: Austra.Library (in Austra.Library.dll) Version: 2.5.0+44e7797405725ef3cf24b3ff0eba94ce6c649601
Syntax
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

The Matrix type exposes the following members.

Constructors
 NameDescription
Public methodMatrix(Double)Creates a diagonal matrix given its diagonal.
Public methodMatrix(DVector)Creates a diagonal matrix given its diagonal.
Public methodMatrix(DVector)Creates a matrix given its rows.
Public methodMatrix(Int32)Creates an empty square matrix.
Public methodMatrix(Int32, NormalRandom)Creates a squared matrix filled with a standard normal distribution.
Public methodMatrix(Int32, FuncInt32, Int32, Double)Creates a square matrix using a formula to fill its cells.
Public methodMatrix(Int32, Int32)Creates an empty rectangular matrix.
Public methodMatrix(Int32, Random) Creates a square matrix filled with a uniform distribution generator.
Public methodMatrix(Int32, Int32, NormalRandom)Creates a matrix filled with a standard normal distribution.
Public methodMatrix(Int32, Int32, Double) Creates a matrix with a given number of rows and columns, and its internal array.
Public methodMatrix(Int32, Int32, FuncInt32, Int32, Double)Creates a matrix using a formula to fill its cells.
Public methodMatrix(Int32, Int32, Random)Creates a matrix filled with a uniform distribution generator.
Public methodMatrix(Int32, Random, Double, Double)Creates a square matrix filled with a uniform distribution generator.
Public methodMatrix(Int32, Int32, Random, Double, Double)Creates a matrix filled with a uniform distribution generator.
Top
Properties
 NameDescription
Public propertyColsGets the number of columns.
Public propertyIsInitializedHas the matrix been properly initialized?
Public propertyIsSquareChecks if the matrix is a square one.
Public propertyItemIndex, IndexGets the value of a single cell using Index.
Public propertyItemIndex, RangeGets a range of rows and columns as a new matrix.
Public propertyItemInt32, Int32Gets or sets the value of a single cell.
Public propertyItemInt32, RangeGets a range of rows and columns as a new matrix.
Public propertyItemRange, IndexGets a range of rows and columns as a new matrix.
Public propertyItemRange, Int32Gets a range of rows and columns as a new matrix.
Public propertyItemRange, RangeGets a range of rows and columns as a new matrix.
Public propertyRowsGets the number of rows.
Top
Methods
 NameDescription
Public methodAllChecks whether the predicate is satified by all cells.
Public methodAMaxGets the cell with the maximum absolute value.
Public methodAMinGets the cell with the minimum absolute value.
Public methodAnyChecks whether the predicate is satified by at least one cell.
Public methodCholeskyComputes the Cholesky decomposition of this matrix.
Public methodCholeskyMatrixComputes the Cholesky decomposition of this matrix.
Public methodCloneCreates an identical rectangular matrix.
Public methodContainsChecks if the matrix contains the given value.
Public methodDeterminantGets the determinant of the matrix.
Public methodDiagonalGets the main diagonal.
Public methodDistanceComputes the maximum difference between cells.
Public methodEquals(Matrix)Checks if the provided argument is a matrix with the same values.
Public methodEquals(Object)Checks if the provided argument is a matrix with the same values.
(Overrides ValueTypeEquals(Object))
Public methodEVDComputes the eigenvalue decomposition.
Public methodEVD(NullableBoolean)Computes the eigenvalue decomposition.
Public methodStatic memberFromColumnsCreates a matrix given its columns.
Public methodGetColumn(Index)Gets a copy of a column as a vector, using Index.
Public methodGetColumn(Int32)Gets a copy of a column as a vector.
Public methodGetHashCodeReturns the hashcode for this matrix.
(Overrides ValueTypeGetHashCode)
Public methodGetRow(Index)Gets a copy of a row as a vector, using Index.
Public methodGetRow(Int32)Gets a copy of a row as a vector.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStatic memberHCat(Matrix)Horizontal concatenation of an array of matrices.
Public methodStatic memberHCat(DVector, Matrix)Horizontal concatenation of a new column and a matrix.
Public methodStatic memberHCat(Matrix, DVector)Horizontal concatenation of a matrix and a new column.
Public methodStatic memberHCat(Matrix, Matrix)Horizontal concatenation of two matrices.
Public methodStatic memberIdentityCreates an identity matrix given its size.
Public methodInverseCalculates the inverse of the matrix.
Public methodIsSymmetricChecks if the matrix is a symmetric one.
Public methodLUPerforms the LUP decomposition of this matrix.
Public methodMapApplies a function to each cell of the matrix.
Public methodMaximumGets the cell with the maximum value.
Public methodMinimumGets the cell with the minimum value.
Public methodMultiplyAdd(CVector, CVector)Transforms a complex vector and adds an offset.
Public methodMultiplyAdd(DVector, DVector)Transforms a vector and adds an offset.
Public methodMultiplyAdd(DVector, Double, DVector)Transforms a vector and adds an offset.
Public methodMultiplySubtract(CVector, CVector)Transforms a complex vector and subtracts an offset.
Public methodMultiplySubtract(DVector, DVector)Transforms a vector and subtracts an offset.
Public methodMultiplyTranspose(Matrix)Multiplies this matrix by the transposed argument.
Public methodMultiplyTranspose(Matrix, Double)Multiplies this matrix by the transposed argument.
Public methodPointwiseDivideCell by cell division with a second matrix.
Public methodPointwiseMultiplyCell by cell product with a second matrix.
Public methodRedim(Int32)Creates a new matrix with different dimensions.
Public methodRedim(Int32, Int32)Creates a new matrix with different dimensions.
Public methodSolve(DVector)Solves the equation Ax = b for x.
Public methodSolve(Matrix)Solves the equation AX = B for the matrix X.
Public methodSquareMultiplies this matrix by itself.
Public methodStatsGets statistics on the matrix cells.
Public methodSubtractMultiply(CVector, CVector)Optimized subtraction of transformed complex vector.
Public methodSubtractMultiply(DVector, DVector)Optimized subtraction of transformed vector.
Public methodSumCalculates the sum of the matrix cells.
Public methodSymEVDComputes the eigenvalue decomposition for a symmetric matrix.
Public methodToStringGets a textual representation of this matrix.
(Overrides ValueTypeToString)
Public methodToString(String, IFormatProvider)Gets a textual representation of this matrix.
Public methodTraceCalculates the trace of a matrix.
Public methodTransformTransforms a vector using a matrix and a preallocated buffer.
Public methodTransposeTransposes the matrix.
Public methodTransposeMultiplyTransforms a vector using the transpose of this matrix.
Public methodTryCholeskyTentative Cholesky decomposition.
Public methodStatic memberVCat(Matrix)Vertical concatenation of an array of matrices.
Public methodStatic memberVCat(DVector, Matrix)Vertical concatenation of a row vector and a matrix.
Public methodStatic memberVCat(Matrix, DVector)Vertical concatenation of a matrix and a row vector.
Public methodStatic memberVCat(Matrix, Matrix)Vertical concatenation of two matrices.
Top
Operators
 NameDescription
Public operatorStatic memberAddition(Double, Matrix)Adds a scalar to a matrix.
Public operatorStatic memberAddition(LMatrix, Matrix)Adds a lower triangular matrix to a full matrix.
Public operatorStatic memberAddition(Matrix, LMatrix)Adds a full matrix to a lower triangular matrix.
Public operatorStatic memberAddition(Matrix, Matrix)Sums two matrices with the same size.
Public operatorStatic memberAddition(Matrix, RMatrix)Adds a full matrix to an upper triangular matrix.
Public operatorStatic memberAddition(Matrix, Double)Adds a scalar to a matrix.
Public operatorStatic memberAddition(RMatrix, Matrix)Adds an upper triangular matrix to a full matrix.
Public operatorStatic memberDivision(DVector, Matrix)Solves the equation m*x = v for the vector x.
Public operatorStatic memberDivision(Matrix, Matrix)Solves the equation m2*x = m1 for the matrix x.
Public operatorStatic memberDivision(Matrix, Double)Divides a matrix by a scalar value.
Public operatorStatic memberEquality(Matrix, LMatrix)Checks two matrices for equality.
Public operatorStatic memberEquality(Matrix, Matrix)Checks two matrices for equality.
Public operatorStatic memberEquality(Matrix, RMatrix)Checks two matrices for equality.
Public operatorStatic member(Matrix to Double)Explicit conversion from a matrix to a 1D-array.
Public operatorStatic member(Matrix to Double)Explicit conversion from a matrix to a 2D-array.
Public operatorStatic memberInequality(Matrix, LMatrix)Checks two matrices for inequality.
Public operatorStatic memberInequality(Matrix, Matrix)Checks two matrices for inequality.
Public operatorStatic memberInequality(Matrix, RMatrix)Checks two matrices for inequality.
Public operatorStatic memberMultiply(CVector, Matrix)Transform a complex vector using the transposed matrix.
Public operatorStatic memberMultiply(Double, Matrix)Multiplies a matrix by a scalar value.
Public operatorStatic memberMultiply(DVector, Matrix)Transform a vector using the transposed matrix.
Public operatorStatic memberMultiply(Matrix, CVector)Transform a complex vector using a matrix.
Public operatorStatic memberMultiply(Matrix, DVector)Transform a vector using a matrix.
Public operatorStatic memberMultiply(Matrix, Matrix)Multiplies two compatible matrices.
Public operatorStatic memberMultiply(Matrix, Double)Multiplies a matrix by a scalar value.
Public operatorStatic memberSubtraction(Double, Matrix)Subtracts a matrix from a scalar.
Public operatorStatic memberSubtraction(LMatrix, Matrix)Subtracts a full matrix from a lower-triangular matrix.
Public operatorStatic memberSubtraction(Matrix, LMatrix)Subtracts a lower-triangular matrix from a full matrix.
Public operatorStatic memberSubtraction(Matrix, Matrix)Subtracts two matrices with the same size.
Public operatorStatic memberSubtraction(Matrix, RMatrix)Subtracts an upper-triangular matrix from a full matrix.
Public operatorStatic memberSubtraction(Matrix, Double)Subtracts a scalar from a matrix.
Public operatorStatic memberSubtraction(RMatrix, Matrix)Subtracts a full matrix from an upper-triangular matrix.
Public operatorStatic memberUnaryNegation(Matrix)Negates a matrix.
Top
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.

See Also