Methods
(inner) coordToIndex(coord, matrixSize) → {number}
- Source:
Convert a matrix coordinate into the index of it's serialized representation.
Parameters:
Name |
Type |
Description |
coord |
Object
|
Matrix coordinate (r, c)
Properties
Name |
Type |
Description |
r |
number
|
Row index |
c |
number
|
Column index |
|
matrixSize |
Object
|
Matrix size
Properties
Name |
Type |
Description |
R |
number
|
Number of rows |
C |
number
|
Number of columns |
|
Returns:
Corresponding index on the serialized matrix
-
Type
-
number
(inner) forEach(matrix, fn)
- Source:
Executes a provided function once for each matrix element.
Parameters:
Name |
Type |
Description |
matrix |
array
|
The matrix that forEach() is being applied to. |
fn |
matrixCallback
|
Function to execute for each element |
(inner) indexToCoord(index, matrixSize) → {Object|number|number}
- Source:
Convert the index of a serialized matrix into it's original coordinate.
Parameters:
Name |
Type |
Description |
index |
number
|
Index of the serialized matrix |
matrixSize |
Object
|
Matrix size
Properties
Name |
Type |
Description |
R |
number
|
Number of rows |
C |
number
|
Number of columns |
|
Returns:
(inner) map(matrix, fn) → {array}
- Source:
Creates a new matrix with the results of calling a provided function on every element in this array.
Parameters:
Name |
Type |
Description |
matrix |
array
|
Original matrix. |
fn |
matrixCallback
|
Function that produces an element of the new matrix. |
Returns:
A new matrix with each element being the result of the callback function.
-
Type
-
array
Type Definitions
matrixCallback(The, The, The, The)
- Source:
Callback used in matrix operations.
Parameters:
Name |
Type |
Description |
The |
currentValue
|
current element being processed in the matrix. |
The |
row
|
row index. |
The |
col
|
column index. |
The |
matrix
|
matrix being processed. |