Click or drag to resize

MatrixMath Class

Class MatrixMath provides common static methods for matrix manipulation and arithmetic in tow dimensions.
Inheritance Hierarchy
SystemObject
  Altaxo.Calc.LinearAlgebraMatrixMath

Namespace: Altaxo.Calc.LinearAlgebra
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static class MatrixMath

The MatrixMath type exposes the following members.

Methods
 NameDescription
Public methodStatic memberAdd Calculates a+b and stores the result in matrix c.
Public methodStatic memberAddRow(IROMatrixDouble, IReadOnlyListDouble, IMatrixDouble) Add the vector b to all rows of matrix a.
Public methodStatic memberAddRow(IROMatrixDouble, IROMatrixDouble, Int32, IMatrixDouble) Add the row rowb of matrix b to all rows of matrix a.
Public Extension MethodAny Determines whether any element of the provided matrix a fulfills the given predicate.
Public methodStatic memberClearT 
Public methodStatic memberClear_DefaultImplT 
Public methodStatic memberColumnsToZeroMean This will center the matrix so that the mean of each column is null.
Public methodStatic memberColumnsToZeroMeanAndUnitVariance This will center the matrix so that the mean of each column is null, and the variance of each column is one.
Public methodStatic memberColumnToROVectorT Returns a read-only vector representing a matrix column by providing the matrix and the row number of that matrix that is wrapped.
Public methodStatic memberColumnToVectorT Returns a vector representing a matrix column by providing the matrix and the row number of that matrix that is wrapped.
Public methodStatic memberCopy(IROMatrixDouble, IMatrixDouble) Copies matrix src to matrix dest. Both matrizes must have the same dimensions.
Public methodStatic memberCopy(IROMatrixDouble, IMatrixDouble, Int32, Int32) Copies the matrix src into the matrix dest. Matrix dest must have equal or greater dimension than src. You can provide a destination row/column into the destination matrix where the origin of the copy operation is located.
Public Extension MethodCopyColumn(IROMatrixDouble, Int32, IVectorDouble) Gets the column of a matrix copied into a vector.
Public Extension MethodCopyColumn(IROMatrixDouble, Int32, Double) Gets the column of a matrix copied into a vector.
Public Extension MethodCopyColumnT(IROMatrixT, Int32, IMatrixT, Int32, Int32) Copies one column of a source matrix into a destination matrix to a given row and column offset.
Public Extension MethodCopyRow(IROMatrixDouble, Int32, IVectorDouble) Gets the row of a matrix copied into a vector.
Public Extension MethodCopyRow(IROMatrixDouble, Int32, Double) Gets the row of a matrix copied into a vector.
Public methodStatic memberDenseOfMatrixT 
Public methodStatic memberDivideRow Divides all rows of matrix a by the row rowb of matrix b (element by element).
Public methodStatic memberEnumerateElementsIndexedT 
Public methodStatic memberGetMatrixArray Allocates an array of n x m values.
Public methodStatic memberGetSingularValueDecomposition(IMatrixDouble)Returns the singular value decomposition for this matrix.
Public methodStatic memberGetSingularValueDecomposition(IROMatrixDouble, IMatrixDouble)Returns the singular value decomposition for this matrix.
Public methodStatic memberHypotenuse Calculates the hypotenuse length of a and b, i.e. the sqrt(a^2+b^2), avoiding overflow at large values.
Public methodStatic memberInvertDiagonalMatrix This inverts the provided diagonal matrix. There is no check that the matrix is really diagonal, but the algorithm sets the elements outside the diagonal to zero, assuming that this are small arithmetic errors.
Public methodStatic memberIsEqual Compares matrix a and matrix b. Takes the norm of matrix b times accuracy as threshold basis for comparing the elements.
Public methodStatic memberIsZeroMatrix Tests if all elements of the matrix a are equal to zero.
Public methodStatic memberLengthOf Returns the square root of the sum of the squares of the matrix a.
Public methodStatic memberMap(IROMatrixDouble, FuncDouble, Double, IMatrixDouble) Elementwise application of a function to each element of a matrix. The result is stored in another matrix or in the same matrix.
Public methodStatic memberMap(IROMatrixDouble, IROMatrixDouble, FuncDouble, Double, Double, IMatrixDouble) Elementwise application of a function to each element of two matrices. The result is stored in another matrix or in the same matrix.
Public methodStatic memberMapIndexed(IROMatrixDouble, FuncInt32, Int32, Double, Double, IMatrixDouble) Elementwise application of a function to each element of a matrix. The result is stored in another matrix or in the same matrix.
Public methodStatic memberMapIndexed(IROMatrixDouble, IROMatrixDouble, FuncInt32, Int32, Double, Double, Double, IMatrixDouble) Elementwise application of a function to each element of two matrices. The result is stored in another matrix or in the same matrix.
Public methodStatic memberMapIndexedT1(IROMatrixDouble, T1, FuncInt32, Int32, Double, T1, Double, IMatrixDouble) Elementwise application of a function to each element of a matrix. The result is stored in another matrix or in the same matrix.
Public Extension MethodMapIndexedT, T1(IROMatrixT, T1, FuncInt32, Int32, T, T1, T, IMatrixT, Zeros) 
Public methodStatic memberMatrixToString(String, IROComplexDoubleMatrix) 
Public methodStatic memberMatrixToString(String, IROComplexFloatMatrix) 
Public methodStatic memberMatrixToString(String, IROMatrixSingle) 
Public methodStatic memberMatrixToStringT(String, IROMatrixT) 
Public Extension MethodMax Get the maximum value of all elements of the specified matrix a.
Public Extension MethodMin Get the minimum value of all elements of the specified matrix a.
Public methodStatic memberMultiply(IROMatrixDouble, IROMatrixDouble, IMatrixDouble) Multiplies matrix a with matrix b and stores the result in matrix c.
Public methodStatic memberMultiply(IROMatrixDouble, IReadOnlyListDouble, IVectorDouble) Multiplies matrix a with vector b and stores the result in vector c.
Public methodStatic memberMultiplyFirstTransposed(IROMatrixDouble, IROMatrixDouble, IMatrixDouble) Multiplies matrix a_transposed with matrix b and stores the result in matrix c.
Public methodStatic memberMultiplyFirstTransposed(IROMatrixDouble, IReadOnlyListDouble, IVectorDouble) Multiplies matrix a_transposed with vector b and stores the result in vector c.
Public methodStatic memberMultiplyRow(IROMatrixDouble, IReadOnlyListDouble, IMatrixDouble) Multiplies the row rowb of matrix b element by element to all rows of matrix a.
Public methodStatic memberMultiplyRow(IROMatrixDouble, IROMatrixDouble, Int32, IMatrixDouble) Multiplies the row rowb of matrix b element by element to all rows of matrix a.
Public methodStatic memberMultiplyScalar Multiplies the matrix a with a scalar value b and stores the result in c. Matrix a and c are allowed to be the same matrix.
Public methodStatic memberMultiplySecondTransposed Multiplies matrix a with matrix b_transposed and stores the result in matrix c.
Public methodStatic memberMultiplyVectorFromLeftAndRight Multiplies matrix a with vector b from left and right: b* A b.
Public methodStatic memberNIPALS_HO Calculates eigenvectors (loads) and the corresponding eigenvalues (scores) by means of the NIPALS algorithm
Public Extension MethodNorm 
Public methodStatic memberNormalizeCols Normalizes each column (each vertical vector) of the matrix. After normalization, each column has the norm 1, i.e. the sum of squares of the elements of each column is 1 (one).
Public methodStatic memberNormalizeOneColumn Normalizes the column col of a matrix to unit length.
Public methodStatic memberNormalizeRows Normalizes each row (each horizontal vector) of the matrix. After normalization, each row has the norm 1, i.e. the sum of squares of the elements of each row is 1 (one).
Public methodStatic memberPseudoInverse(IROMatrixDouble) Calculates the pseudo inverse of the matrix input by means of singular value decomposition. A relative value of 100*DBL_EPSILON is used to chop the singular values before calculation.
Public methodStatic memberPseudoInverse(IROMatrixDouble, Int32) Calculates the pseudo inverse of the matrix input by means of singular value decomposition. A relative value of 100*DBL_EPSILON is used to chop the singular values before calculation.
Public Extension MethodReplaceNaNAndInfiniteElementsWith Replaces all matrix elements that are NaN (Not a Number) or infinite with the value of replacementValue.
Public Extension MethodReplaceNaNElementsWith Replaces all matrix elements that are NaN (not a number) with the value of replacementValue.
Public methodStatic memberRowToROVectorT(IROMatrixT, Int32) Returns a vector representing a matrix row by providing the matrix and the row number of that matrix that is wrapped.
Public methodStatic memberRowToROVectorT(IROMatrixT, Int32, Int32, Int32) Returns a vector representing a matrix row by providing the matrix and the row number of that matrix that is wrapped.
Public methodStatic memberRowToVectorT(IMatrixT, Int32) Returns a vector representing a matrix row by providing the matrix and the row number of that matrix that is wrapped.
Public methodStatic memberRowToVectorT(IMatrixT, Int32, Int32, Int32) Returns a vector representing a matrix row by providing the matrix and the row number of that matrix that is wrapped.
Public Extension MethodSetColumn(IMatrixDouble, Int32, IReadOnlyListDouble) Gets the column of a matrix copied into a vector.
Public Extension MethodSetColumn(IMatrixDouble, Int32, Double) Gets the column of a matrix copied into a vector.
Public methodStatic memberSetColumn(IReadOnlyListDouble, IMatrixDouble, Int32) Sets one row in the destination matrix equal to the vector provided by src.
Public methodStatic memberSetColumn(IROMatrixDouble, IMatrixDouble, Int32) Sets one column in the destination matrix equal to the vertical vector provided by src matix.
Public methodStatic memberSetColumn(IROMatrixDouble, Int32, IMatrixDouble, Int32) Sets one column in the destination matrix equal to the vertical vector provided by src matix.
Public Extension MethodSetMatrixElements(IMatrixDouble, Double) Set all matrix elements to the provided value scalar.
Public Extension MethodSetMatrixElements(IMatrixDouble, FuncInt32, Int32, Double) Sets the matrix elements to the value provided by a setter function Setter.
Public Extension MethodSetRow(IMatrixDouble, Int32, IReadOnlyListDouble) Gets the row of a matrix copied into a vector.
Public Extension MethodSetRow(IMatrixDouble, Int32, Double) Gets the row of a matrix copied into a vector.
Public methodStatic memberSetRow(IReadOnlyListDouble, IMatrixDouble, Int32) Sets one row in the destination matrix equal to the vector provided by src.
Public methodStatic memberSetRow(IROMatrixDouble, Int32, IMatrixDouble, Int32) Sets one row in the destination matrix equal to the horizontal vector provided by src matix.
Public methodStatic memberSquare Calculates the Square of the value x.
Public methodStatic memberSubmatrix(IROMatrixDouble, IMatrixDouble) Gets a submatrix out of the source matrix a. The dimensions of the submatrix are given by the provided matrix dest. The origin of the submatrix in the source matrix is (0,0), i.e. the left upper corner.
Public methodStatic memberSubmatrix(IROMatrixDouble, IMatrixDouble, Int32, Int32) Gets a submatrix out of the source matrix a. The dimensions of the submatrix are given by the provided matrix dest.
Public Extension MethodSubMatrixT(IROMatrixDouble, Boolean, Boolean, FuncInt32, Int32, T) Gets a new submatrix, i.e. a matrix containing selected elements of the original matrix a.
Public Extension MethodSubMatrixT(IROMatrixDouble, Boolean, Int32, FuncInt32, Int32, T) Gets a new submatrix, i.e. a matrix containing selected elements of the original matrix a.
Public Extension MethodSubMatrixT(IROMatrixDouble, Boolean, Int32, FuncInt32, Int32, T) Gets a new submatrix, i.e. a matrix containing selected elements of the original matrix a.
Public Extension MethodSubMatrixT(IROMatrixDouble, Int32, Boolean, FuncInt32, Int32, T) Gets a new submatrix, i.e. a matrix containing selected elements of the original matrix a.
Public Extension MethodSubMatrixT(IROMatrixDouble, Int32, Boolean, FuncInt32, Int32, T) Gets a new submatrix, i.e. a matrix containing selected elements of the original matrix a.
Public Extension MethodSubMatrixT(IROMatrixDouble, Int32, Int32, FuncInt32, Int32, T) Gets a new submatrix, i.e. a matrix containing selected elements of the original matrix a.
Public methodStatic memberSubtract Calculates a-b and stores the result in matrix c.
Public methodStatic memberSubtractColumn Subtracts the column bcol of matrix b from all columns of matrix a.
Public methodStatic memberSubtractProductFromSelf(IROMatrixDouble, IROMatrixDouble, IMatrixDouble) Calculates c = c - ab
Public methodStatic memberSubtractProductFromSelf(IROMatrixDouble, Double, IMatrixDouble) Calculates c = c - ab
Public methodStatic memberSubtractRow(IROMatrixDouble, IReadOnlyListDouble, IMatrixDouble) Subtracts the row rowb of matrix b from all rows of matrix a.
Public methodStatic memberSubtractRow(IROMatrixDouble, IROMatrixDouble, Int32, IMatrixDouble) Subtracts the row rowb of matrix b from all rows of matrix a.
Public methodStatic memberSumOfSquaredDifferences Returns the sum of the squares of differences of elements of a and b.
Public methodStatic memberSumOfSquares Returns the sum of the squares of all elements.
Public methodStatic memberToMatrixT(MatrixWrapperStructForColumnMajorOrderLinearArrayT) Wraps a linear array (column major order) into a read-write matrix. The array is packed in column major order, i.e. the first elements belong to the first column of the matrix.
Public methodStatic memberToMatrixT(MatrixWrapperStructForLeftSpineJaggedArrayT) 
Public methodStatic memberToMatrixT(MatrixWrapperStructForTopSpineJaggedArrayT) Constructs an RE matrix from an array of double vectors. Attention! The double vectors (the second) dimensions are here the columns (!) of the matrix. The data is not copied.
Public Extension MethodToMatrixT(T) 
Public methodStatic memberToMatrixFromColumnMajorLinearArrayT Wraps a linear array into a read-write matrix. The array is packed column-wise, i.e. the first elements belong to the first column of the matrix.
Public methodStatic memberToMatrixFromLeftSpineJaggedArrayT This wraps a jagged double array to the IMatrixT interface. The data is not copied!
Public methodStatic memberToMatrixFromTopSpineJaggedArrayT Constructs an RE matrix from an array of double vectors. Attention! The double vectors (the second) dimensions are here the columns (!) of the matrix. The data is not copied.
Public methodStatic memberToRODiagonalMatrixT Wraps a read-only vector to a read-only diagonal matrix.
Public methodStatic memberToROMatrixT(MatrixWrapperStructForColumnMajorOrderLinearArrayT) Wraps a linear array (column major order) into a read-only matrix. The array is packed in column major order, i.e. the first elements belong to the first column of the matrix.
Public Extension MethodToROMatrixT(T) 
Public methodStatic memberToROMatrixFromColumnMajorLinearArrayT Wraps a linear array (column major order) into a read-only matrix. The array is packed in column major order, i.e. the first elements belong to the first column of the matrix.
Public methodStatic memberToROMatrixFromLeftSpineJaggedArrayT This wraps a jagged double array to the IROMatrixT interface. The data is not copied!
Public methodStatic memberToROMatrixFromTopSpineJaggedArrayT Constructs an RE matrix from an array of double vectors. Attention! The double vectors (the second) dimensions are here the columns (!) of the matrix. The data is not copied.
Public methodStatic memberToROMatrixWithOneColumnT Wraps a read-only vector, so that it becomes a matrix with one column, and as many rows as the vector.
Public methodStatic memberToROMatrixWithOneRowT Wraps a read-only vector, so that it becomes a matrix with one row, and as many columns as elements in the vector.
Public methodStatic memberToROSubMatrixT Wraps a submatrix part, so that this part can be used as a matrix in operations (read-only).
Public methodStatic memberToSubMatrixT Wraps a submatrix part, so that this part can be used as a matrix in operations.
Public Extension MethodToZeroMean(IMatrixDouble) Calculates the mean value of all matrix elements and then subtracts the mean value from each matrix element, so that the mean value of the resulting matrix is zero.
Public Extension MethodToZeroMean(IMatrixDouble, Double) Calculates the mean value of all matrix elements and then subtracts the mean value from each matrix element, so that the mean value of the resulting matrix is zero.
Public Extension MethodTrace Get the trace of square matrix a, i.e. the sum of diagonal elements.
Public Extension MethodZeroMatrix Set all elements in the matrix to 0 (zero)
Top
See Also