Skip to content
Riaan Hanekom edited this page Mar 10, 2013 · 5 revisions

The Matrix data structure

[Serializable]
public class Matrix : ObjectMatrix<double>, ICloneable, IMathematicalMatrix, IEquatable<IMathematicalMatrix>
{
    // Methods
    public Matrix(int rows, int columns);    
    public Matrix Add(Matrix matrix);    
    public Matrix Adjoint();
    public Matrix Clone();
    public Matrix Concatenate(Matrix rightMatrix);    
    public double Determinant();
    public static Matrix Diagonal(int rows, int columns, double value);
    public bool Equals(IMathematicalMatrix other);    
    public Matrix GetSubMatrix(int rowStart, int columnStart, int rowCount, int columnCount);
    public static Matrix IdentityMatrix(int rows, int columns);
    public Matrix Inverse();
    public Matrix Minor(int row, int column);    
    public Matrix Multiply(Matrix matrix);
    public Matrix Multiply(double number);
    public void MultiplyColumn(int column, double number);
    public void MultiplyRow(int row, double number);
    public Matrix Negate();        
    public Matrix Solve(Matrix rightHandSide);    
    public Matrix Subtract(Matrix matrix);        
    public Matrix Transpose();
    // ...
    
    // Operators
    public static Matrix operator +(Matrix m1, Matrix m2);    
    public static Matrix operator *(Matrix m1, Matrix m2);    
    public static Matrix operator *(Matrix m1, double number);    
    public static Matrix operator *(double number, Matrix m2);    
    public static Matrix operator -(Matrix m1, Matrix m2);
	
    // Properties
    public double FrobeniusNorm { get; }
    public double InfinityNorm { get; }
    public bool IsSingular { get; }
    public bool IsSymmetric { get; }
    public double OneNorm { get; }
    public double Trace { get; }
    // ...
}

The Matrix class corresponds to the Linear Algebra notation of a Matrix. It implements simple operations like Plus, Times, Minus, and IsSymmetric, as well as some of the more advanced concepts like norms, trace, determinants, etc.

From the 1.3 Alpha release of NGenerics, the Matrix class inherits from ObjectMatrix, giving it several new features like row and column swapping, etc.

Decompositions of matrices has been provided as seperate classes. These include :

More information on Matrices

Clone this wiki locally