Properties
  • Rows - Gets the number of rows in the matrix.
  • Columns - Gets the number of columns in the matrix.

Methods
  • Determinant() - Returns the determinant of the matrix.
  • Adjoint() - Returns the adjoint matrix.
  • Minor(int row, int column) - Returns the minor with respect to the elements represented by the row and the column.
  • IsIdentity() - Returns true if the matrix is an identity matrix otherwise false.
  • IsInvertible() - Returns true if the matrix is invertible, otherwise false.
  • Reset() - Makes the matrix an identity matrix.
  • Clear() - Makes the matrix a zero matrix.
  • Round(int percision) - Rounds the elements to the provided percision.

Static Methods
  • Round(Matrix mtx, int percision) - Rounds the elements of the provided matrix to the given percision.

Operators
  • == Equals
  • != Not equal
  • * Multiply (3 overloads)
  • + Addition
  • - Subtract
  • / Division
  • ^ Power of
  • ~ Transpose
  • ! Inverse

Examples

Initializing a matrix object
int rows = 3;    //specify the number of rows
int cols = 3;    //specify the number of columns

//the matrix is a zero matrix by default
Matrix mtx = new Matrix(rows, cols);

//add code to initialize the elements
mtx[0, 0] = 11; mtx[0, 1] = 12; mtx[0, 2] = 13;
mtx[1, 0] = 21; mtx[1, 1] = 22; mtx[1, 2] = 23;
mtx[2, 0] = 31; mtx[2, 1] = 32; mtx[2, 2] = 33;


Performing matrix functions
Matrix mtx1, mtx2, mtxResult;

//code to initialize mtx1 and mtx2 goes here

try
{
    mtxResult = mtx1 * mtx2;        //multiply and store the result

    Console.WriteLine(!mtxResult);  //print the inverse to screen
}
catch(MatrixException ex)
{
    Console.WriteLine(ex.Message);
}

Last edited Mar 26, 2014 at 1:21 PM by rajithaw, version 12