API for dealing with matrices as simple 2D arrays.
- Source:
Methods
(static) add(a1, a2) → {Array.<Array.<Number>>}
Add two 2D arrays and return the result.
Parameters:
| Name |
Type |
Description |
a1 |
Array.<Array.<Number>>
|
|
a2 |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Array.<Array.<Number>>
(static) copy(arraysnon-null) → {Array.<Array.<Number>>}
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
2D array to copy. |
- Source:
Returns:
-
Type
-
Array.<Array.<Number>>
(static) createBlank(numOfRowsnon-null, numOfColsopt) → {Array.<Array.<Number>>}
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
numOfRows |
Integer
|
|
|
|
numOfCols |
Integer
|
<optional>
|
numOfRows
|
|
- Source:
Returns:
The blank (zeros) 2D array of given size.
-
Type
-
Array.<Array.<Number>>
(static) createIdentity(sizenon-null) → {Array.<Array.<Number>>}
Parameters:
| Name |
Type |
Description |
size |
Integer
|
|
- Source:
Returns:
The identity 2D array of given size.
-
Type
-
Array.<Array.<Number>>
(static) decompose(arrays) → {LUP}
Decompose this 2D array into lower and upper triangular 2D arrays.
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Throws:
SingularMatrixException
Returns:
Lower and upper triangular 2D arrays, and a permutation 2D array.
-
Type
-
LUP
(static) determinant(arrays) → {Number}
Return the determinant of the given 2D array.
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
Square matrix |
- Source:
Returns:
-
Type
-
Number
(static) divide(a1, a2) → {Array.<Array.<Number>>}
Divide a1 by a2 and return the result.
Parameters:
| Name |
Type |
Description |
a1 |
Array.<Array.<Number>>
|
Number
|
|
a2 |
Array.<Array.<Number>>
|
Number
|
|
- Source:
Returns:
-
Type
-
Array.<Array.<Number>>
(static) getDimensions(arraysnon-null) → {Array.<Integer>}
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
e.g. [2, 3] for a 2x3 matrix
-
Type
-
Array.<Integer>
(static) getNumOfColumns(arraysnon-null) → {Integer}
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Integer
(static) getNumOfRows(arraysnon-null) → {Integer}
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Integer
(static) getSize(arraysnon-null) → {String}
Get a string representation of the 2D array size.
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
String
(static) invert(arrays) → {Array.<Array.<Number>>}
Return an inverted version of the given 2D array.
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Array.<Array.<Number>>
(static) isEmpty(arraysnon-null) → {Boolean}
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Boolean
(static) isInvertible(arrays) → {Boolean}
Is it possible to invert the given 2D array?
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Boolean
(static) isLowerTriangular(arraysnon-null) → {Boolean}
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Boolean
(static) isSquare(arraysnon-null) → {Boolean}
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Boolean
(static) isUpperTriangular(arraysnon-null) → {Boolean}
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Boolean
(static) multiply(a1, a2) → {Array.<Array.<Number>>}
Multiply two 2D arrays and return the result.
Parameters:
| Name |
Type |
Description |
a1 |
Array.<Array.<Number>>
|
Number
|
|
a2 |
Array.<Array.<Number>>
|
Number
|
|
- Source:
Returns:
-
Type
-
Array.<Array.<Number>>
(static) solve(A, b) → {Array.<Array.<Number>>}
Solve the matrix equation Ax = b for x with matrix size N.
Parameters:
| Name |
Type |
Description |
A |
Array.<Array.<Number>>
|
NxN |
b |
Array.<Array.<Number>>
|
Nx1 |
- Source:
Returns:
Nx1
-
Type
-
Array.<Array.<Number>>
(static) subtract(a1, a2) → {Array.<Array.<Number>>}
Subtract a2 from a1 and return the result.
Parameters:
| Name |
Type |
Description |
a1 |
Array.<Array.<Number>>
|
|
a2 |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Array.<Array.<Number>>
(static) transpose(arrays) → {Array.<Array.<Number>>}
Return a transposed version of the given 2D array.
Parameters:
| Name |
Type |
Description |
arrays |
Array.<Array.<Number>>
|
|
- Source:
Returns:
-
Type
-
Array.<Array.<Number>>
Type Definitions
LUP
Type:
Properties:
| Name |
Type |
Description |
l |
Array.<Array.<Number>>
|
Lower triangular matrix. |
u |
Array.<Array.<Number>>
|
Upper triangular matrix. |
p |
Array.<Array.<Number>>
|
Permutation matrix. |
- Source: