Skip to content

Latest commit

 

History

History
362 lines (229 loc) · 9.6 KB

DOCUMENTATION.md

File metadata and controls

362 lines (229 loc) · 9.6 KB

Modules

constructors

A module to construct specific Matrices

Classes

Matrix

constructors

A module to construct specific Matrices


full(dimX, dimY, value, type) ⇒ Matrix

Creates a matrix filled with given value

Kind: Exported function Returns: Matrix - Created matrix

Param Type Description
dimX Number Row size of the matrix
dimY Number Column size of the matrix
value Number Value to give all elements of the matrix
type String Expected C-type of the matrix elements

ones(dimX, dimY, type) ⇒ Matrix

Creates a matrix filled with 1s

Kind: Exported function Returns: Matrix - Created matrix

Param Type Description
dimX Number Row size of the matrix
dimY Number Column size of the matrix
type String Expected C-type of the matrix elements

zeros(dimX, dimY, type) ⇒ Matrix

Creates a matrix filled with 0s

Kind: Exported function Returns: Matrix - Created matrix

Param Type Description
dimX Number Row size of the matrix
dimY Number Column size of the matrix
type String Expected C-type of the matrix elements

identity(size, type) ⇒ Matrix

Creates an identity matrix of given size

Kind: Exported function Returns: Matrix - Created identity matrix

Param Type Description
size Number Edge size of the square identity matrix
type String Expected C-type of the matrix elements

fromArray(array) ⇒ Matrix

Creates a vector or a matrix from given JavaScript array

Kind: Exported function Returns: Matrix - Created identity matrix

Param Type Description
array Array JavaScript array to be converted into a matrix or vector

Matrix

Kind: global class


new Matrix(dimX, dimY, type)

Creates an instance of Matrix.

Param Type Description
dimX Number Row size of the matrix
dimY Number Column size of the matrix
type String Expected C-type of the matrix elements (Defaults to double)

matrix.get(x, y) ⇒ any

Returns the value of given location

Kind: instance method of Matrix Returns: any - value of given index

Param Type Description
x any column index
y any row index

matrix.getRow(x) ⇒ Float64Array

Returns values of given row

Kind: instance method of Matrix Returns: Float64Array - A TypedArray containing the values of given row

Param Type Description
x Number Row index

matrix.set(x, y, entry) ⇒ void

Sets the value of given location

Kind: instance method of Matrix

Param Type Description
x any column index
y any row index
entry any value to set given index

matrix.t() ⇒ Matrix

Returns transposed copy of self

Kind: instance method of Matrix Returns: Matrix - Transposed self


matrix.flatten() ⇒ Matrix

Returns row-major flattened version of self

Kind: instance method of Matrix Returns: Matrix - row-major flattened copy of self


matrix.dot(other) ⇒ Number

Returns dot product of self with given matrix

Kind: instance method of Matrix Returns: Number - Dot product with other

Param Type Description
other Matrix The second matrix

matrix.shape() ⇒ array

Returns the shape of the array as an array of dimensions

Kind: instance method of Matrix Returns: array - Tuple of rowCount and colCount


matrix.tril() ⇒ Matrix

Returns lower triangle of the matrix

Kind: instance method of Matrix Returns: Matrix - Lower triangle of self


matrix.triu() ⇒ Matrix

Returns upper triangle of the matrix

Kind: instance method of Matrix Returns: Matrix - Lower triangle of self


matrix.diag() ⇒ array

Extract diagonal of self

Kind: instance method of Matrix Returns: array - Diagonal array of self


matrix.print() ⇒ void

Prints the text representation of self to console

Kind: instance method of Matrix


matrix.isVector(mat) ⇒ boolean

Returns whether the matrix is a Vector

Kind: instance method of Matrix Returns: boolean - True if the matrix is 1D

Param Type Description
mat Matrix Matrix to be checked

matrix.is3dVector(mat) ⇒ boolean

Returns whether the matrix is a 3D Vector

Kind: instance method of Matrix Returns: boolean - True if the matrix is a 3D Vector

Param Type Description
mat Matrix Matrix to be checked

matrix.isScalar(mat) ⇒ boolean

Returns whether the matrix is 1x1

Kind: instance method of Matrix Returns: boolean - True if matrix is 1x1

Param Type Description
mat Matrix Matrix to be checked

matrix.isSquare(mat) ⇒ boolean

Returns whether the matrix is a square matrix

Kind: instance method of Matrix Returns: boolean - True if matrix is square

Param Type Description
mat Matrix Matrix to be checked

matrix.isIdentity(mat) ⇒ boolean

Returns whether the matrix is an identity matrix

Kind: instance method of Matrix Returns: boolean - True if the matrix is an identity matrix

Param Type Description
mat Matrix Matrix to be checked