API for dealing with matrices as wrapped functions.
- Source:
Namespaces
Methods
(static) copy(matrix) → {module:matrixy.Matrix}
Return a copy of the given Matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
(static) createBlankMatrix(sizenon-null) → {module:matrixy.Matrix}
Create a blank module:matrixy.Matrix of the given size.
Parameters:
| Name | Type | Description |
|---|---|---|
size |
Integer |
- Source:
Returns:
(static) createIdentityMatrix(sizenon-null) → {module:matrixy.Matrix}
Create an identity module:matrixy.Matrix of the given size.
Parameters:
| Name | Type | Description |
|---|---|---|
size |
Integer |
- Source:
Returns:
(static) createImmutableMatrix(arraysnon-null) → {module:matrixy.Matrix}
Create an immutable module:matrixy.Matrix from a 2D array.
All module:matrixy.MatrixOperations will be performed on a copy of the 2D array.
Parameters:
| Name | Type | Description |
|---|---|---|
arrays |
Array.<Array.<Number>> |
- Source:
Returns:
(static) createMatrix(arraysnon-null) → {module:matrixy.Matrix}
Create a module:matrixy.Matrix from a 2D array.
Parameters:
| Name | Type | Description |
|---|---|---|
arrays |
Array.<Array.<Number>> | 2D array |
- Source:
Returns:
(static) decompose(matrix) → {LUP}
Decompose this matrix into an LU pair.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
- See:
Returns:
- Type
- LUP
(static) determinantOf(matrix) → {Number}
Return the determinant of the given module:matrixy.Matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix | Square matrix |
- Source:
Returns:
- Type
- Number
(static) dividedBy(matrix) → {module:matrixy.MatrixOperation}
Infix function to divide a Matrix by another
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
Example
c = a(dividedBy(b)); // JavaScript
c = a dividedBy b # CoffeeScript
(static) get(row, col) → {Number}
Get an entry in the matrix at position (row, col).
Parameters:
| Name | Type | Description |
|---|---|---|
row |
Integer | |
col |
Integer |
- Source:
Returns:
- Type
- Number
(static) getDimensionsOf(matrix) → {Array.<Integer>}
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
- See:
Returns:
e.g. [2, 3] for a 2x3 matrix
- Type
- Array.<Integer>
(static) innerArraysOf(matrix) → {Array.<Array.<Number>>}
Get the wrapped 2D arrays of a module:matrixy.Matrix
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
- Type
- Array.<Array.<Number>>
(static) invert(matrix) → {module:matrixy.Matrix}
Return an inverted version of the given module:matrixy.Matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
Inverted matrix.
(static) isInvertible(matrix) → {Boolean}
Is it possible to invert the given 2D array?
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
- Type
- Boolean
(static) isLowerTriangular(matrix) → {Boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
- See:
Returns:
- Type
- Boolean
(static) isUpperTriangular(matrix) → {Boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
- See:
Returns:
- Type
- Boolean
(static) minus(matrix) → {module:matrixy.MatrixOperation}
Infix function to subtract a Matrix from another
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
Example
c = a(minus(b)); // JavaScript
c = a minus b # CoffeeScript
(static) numOfColsOf(matrix) → {Number}
Get the number of columns in the given matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
- Type
- Number
(static) numOfRowsOf(matrix) → {Number}
Get the number of rows in the given matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
- Type
- Number
(static) plus(matrix) → {module:matrixy.MatrixOperation}
Infix function to add two Matrices.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
Example
c = a(plus(b)); // JavaScript
c = a plus b # CoffeeScript
(static) set(row, col) → {module:matrixy~setter}
Set an entry in the matrix to a given value.
Parameters:
| Name | Type | Description |
|---|---|---|
row |
Integer | |
col |
Integer |
- Source:
Returns:
(static) sizeOf(matrix) → {String}
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
- See:
Returns:
- Type
- String
(static) solve(A, b) → {module:matrixy.Matrix}
Solve the matrix equation Ax = b for x with matrix size N.
Parameters:
| Name | Type | Description |
|---|---|---|
A |
module:matrixy.Matrix | NxN |
b |
module:matrixy.Matrix | Nx1 |
- Source:
- See:
Returns:
Nx1
(static) times(matrix) → {module:matrixy.MatrixOperation}
Infix function to multiply two Matrices.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix | Number |
- Source:
Returns:
Example
c = a(times(b)); // JavaScript
c = a times b # CoffeeScript
(static) transpose(matrix) → {module:matrixy.Matrix}
Return a transposed version of the given module:matrixy.Matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
Transposed matrix.
Type Definitions
LUP
Type:
- object
Properties:
| Name | Type | Description |
|---|---|---|
l |
module:matrixy.Matrix | Lower triangular matrix. |
u |
module:matrixy.Matrix | Upper triangular matrix. |
p |
module:matrixy.Matrix | Permutation matrix. |
- Source:
Matrix(opopt) → {Array.<Array.<Number>>|*}
A Matrix. Can be given a module:matrixy.MatrixOperation.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
op |
module:matrixy.MatrixOperation |
<optional> |
- Source:
Returns:
Internal 2D array if no params given, else result of op.
- Type
- Array.<Array.<Number>> | *
MatrixOperation(matrix) → {*}
Operation on a module:matrixy.Matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
matrix |
module:matrixy.Matrix |
- Source:
Returns:
- Type
- *