Skip to content
Tav edited this page Jul 1, 2016 · 5 revisions

###Namespace: RedMath.LinearAlgebra

The Matrix class represent a matrix. It allows for operations between matrices.
For more info about matrices: https://en.wikipedia.org/wiki/Matrix_(mathematics)

Constructors:

Matrix()

Creates a 1-by-1 identity matrix

Example

Matrix m = new Matrix()
The resulting matrix is:

1

Matrix(int rows, int cols)

Creates a matrix with rows rows and cols columns

Example

Matrix m = new Matrix(1, 2)
The resulting matrix is:

0 0

Matrix(double[,] data)

Creates a matrix from the specified 2-dimensional array

Example

Matrix m = new Matrix(new double[,] { { 1, 2 } { 3, 4 } })
The resulting matrix is:

1 2
3 4

It is recommended that you will call this constructor using the following syntax:

Matrix m = new Matrix  
(  
    new double[,]  
    {  
        { 1, 2 },  
        { 3, 4 },  
    }  
);

Clone this wiki locally