Skip to content

SpeedyMatrix

Speedy includes its own fast implementation of matrices. They are used extensively in encantar.js.

Properties

rows

matrix.rows: number, read-only

Number of rows of the matrix.

columns

matrix.columns: number, read-only

Number of columns of the matrix.

Methods

read

matrix.read(): number[]

Read the entries of the matrix in column-major format.

Returns

The entries of the matrix in column-major format.

Example

/*

Suppose that you are given this matrix:

         [ 1  4  7 ]
matrix = [ 2  5  8 ]
         [ 3  6  9 ]

Its entries in column-major format are: [1,2,3,   4,5,6,   7,8,9]

*/

const entries = matrix.read();

toString

matrix.toString(): string

Convert to string.

Returns

A human-readable representation of the matrix.

Example

console.log(matrix.toString());