A simple Matrix class in JavaScript ðĪš
A module to construct specific Matrices
A module to construct specific Matrices
Matrix âMatrix âMatrix âMatrix âMatrix â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 |
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 |
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 |
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 |
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
anyFloat64ArrayvoidMatrixMatrixNumberarrayMatrixMatrixarrayvoidbooleanbooleanbooleanbooleanbooleanCreates 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) |
anyReturns 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 |
Float64ArrayReturns 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 |
voidSets 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 |
MatrixReturns transposed copy of self
Kind: instance method of Matrix
Returns: Matrix - Transposed self
MatrixReturns row-major flattened version of self
Kind: instance method of Matrix
Returns: Matrix - row-major flattened copy of self
NumberReturns 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 |
arrayReturns the shape of the array as an array of dimensions
Kind: instance method of Matrix
Returns: array - Tuple of rowCount and colCount
MatrixReturns lower triangle of the matrix
Kind: instance method of Matrix
Returns: Matrix - Lower triangle of self
MatrixReturns upper triangle of the matrix
Kind: instance method of Matrix
Returns: Matrix - Lower triangle of self
arrayExtract diagonal of self
Kind: instance method of Matrix
Returns: array - Diagonal array of self
voidPrints the text representation of self to console
Kind: instance method of Matrix
booleanReturns 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 |
booleanReturns 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 |
booleanReturns 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 |
booleanReturns 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 |
booleanReturns 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 |