- constructors
A module to construct specific Matrices
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 1
s
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 0
s
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 |
Kind: global class
- Matrix
- new Matrix(dimX, dimY, type)
- .get(x, y) ⇒
any
- .getRow(x) ⇒
Float64Array
- .set(x, y, entry) ⇒
void
- .t() ⇒
Matrix
- .flatten() ⇒
Matrix
- .dot(other) ⇒
Number
- .shape() ⇒
array
- .tril() ⇒
Matrix
- .triu() ⇒
Matrix
- .diag() ⇒
array
- .print() ⇒
void
- .isVector(mat) ⇒
boolean
- .is3dVector(mat) ⇒
boolean
- .isScalar(mat) ⇒
boolean
- .isSquare(mat) ⇒
boolean
- .isIdentity(mat) ⇒
boolean
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 ) |
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 |
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 |
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
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 |
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
Extract diagonal of self
Kind: instance method of Matrix
Returns: array
- Diagonal array of self
Prints the text representation of self to console
Kind: instance method of Matrix
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 |
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 |
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 |
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 |
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 |