A general MxN dimensional matrix.

This object is not often used in Nape :)

Constructor

new(rows:Int, cols:Int)

Construct a new Matrix.

Parameters:

rows

The number of rows in matrix.

cols

The number of columns in matrix.

Returns:

The constructed Matrix.

Throws:

#

If rows or columns is negative or 0.

Variables

@:value(null)zpp_inner:ZPP_MatMN = null

@private

read onlyrows:Int

The number of rows in the matrix.

read onlycols:Int

The number of columns in the matrix.

Methods

inlinex(row:Int, col:Int):Float

Access element at index.

Parameters:

row

The row of the matrix to access.

col

the column of the matrix to access.

Returns:

The element at given (row,col) index.

Throws:

#

If access is out of range.

inlinesetx(row:Int, col:Int, x:Float):Float

Set element at index.

Parameters:

row

The row of the matrix to set.

col

The column of the matrix to set.

x

The value to set at given (row,col) index.

Returns:

The value of matrix at given index after set. (Always equal to the x parameter)

Throws:

#

If index is out of range.

@:keeptoString():String

@private

transpose():MatMN

Transpose matrix, returning a new Matrix.

Returns:

The transposed matrix.

mul(matrix:MatMN):MatMN

Multiple this matrix with another.

This operation is only valid if the number of columns in this matrix, is equal to the number of rows in the input matrix.
The result of the multiplication is returned as a new matrix.

Parameters:

matrix

The matrix to multiple with.

Returns:

The result of the multiplication

Throws:

If

matrix dimensions are not compatible.