/matrix

A general purpose matrix class.

Primary LanguageC#MIT LicenseMIT

Matrix

A general purpose matrix class which can be used for easily performing matrix manupilation functions like Multiplication, Division, Addition, Substraction and finding Inverse, Determinant, Transpose etc.

Construction

Matrix mtx = new Matrix(3, 3);

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;

Equality

bool result = matrix1 == matrix2;

Inequality

bool result = matrix1 != matrix2;

Addition

Matrix result = matrix1 + matrix2;

Substraction

Matrix result = matrix1 - matrix2;

Multiplication

Matrix result1 = matrix1 * matrix2;
Matrix result2 = matrix1 * 3;

Division

Matrix result = matrix1 / 3;

Transpose

Matrix result = ~matrix1;

Inverse

Matrix result = !matrix1;

Power

Matrix result = matrix1 ^ 3;

Determinant

float det = matrix1.Determinant();

Adjoint

Matrix adj = matrix1.Adjoint();

Minor

Matrix min = matrix1.Minor(1, 1);