Methods
(static) clone(A) → {matrix}
Creates a copy/clone of a matrix.
Example
var A = new M([[1,2,3,4]]);
var B = A.copy()
Parameters:
| Name | Type | Description |
|---|---|---|
A |
matrix | Matrix |
Returns:
- Type
- matrix
(static) ident(m, n) → {matrix}
Returns an identity matrix specified by m and n.
Example
M.ident(2,2).print();
//1.000 0.000
//0.000 1.000
Parameters:
| Name | Type | Description |
|---|---|---|
m |
int | columns |
n |
int | rows |
Returns:
- Type
- matrix
(static) ones(m, n) → {matrix}
Returns a matrix filled with 1s specified by m and n.
Example
M.ones(2,2).print();
//1.000 1.000
//1.000 1.000
Parameters:
| Name | Type | Description |
|---|---|---|
m |
int | columns |
n |
int | rows |
Returns:
- Type
- matrix
(static) range(min, step, max) → {matrix}
Returns a column vector specified by min, step, max
Examples
M.range(5).print(); // res: 0.000\n1.000\n2.000\n3.000\n4.000
M.range(0,2,10); // res: '0.000\n2.000\n4.000\n6.000\n8.000\n10.000'
Parameters:
| Name | Type | Description |
|---|---|---|
min |
int | Starting point |
step |
int | Increment between min and max |
max |
int | End point of array. |
Returns:
- Type
- matrix
(static) zeros(m, n) → {matrix}
Returns a matrix of zeros specified by m and n.
Example
M.zeros(2,2).print();
//0.000 0.000
//0.000 0.000
Parameters:
| Name | Type | Description |
|---|---|---|
m |
int | columns |
n |
int | rows |
Returns:
- Type
- matrix