public: *
Parameters:
data: - The underlying 1D storage for the multidimensional arrayshape: - The shape of the array (Default:[data.length, 1])stride: - The stride of the array (Default: row major,[1, shape[0])offset: - The offset of the array (Default:0)
- get
- set
- forEach
- reduce
- fill
- floodFill
- update
- place
- placeWith
- map
- copy
- reshape
- transpose
- lo
- hi
- slice
- col
- row
- flip
- scale
- reverse
- rotate90
- neighborhood
- flat
- indexOf
- includes
- some
- every
- findIndex
- findIndices
- sample
- serialize
- toString
- join
- toArrays
- toArray
- of
- from
- range
- zeros
- ones
- identity
- diagonal
- fill
- random
- empty
- isStridedView
| Method | Type |
|---|---|
get |
(x: number, y: number) => T or undefined |
Parameters:
x: - The x coordinatey: - The y coordinate
| Method | Type |
|---|---|
set |
(x: number, y: number, value: T) => void |
Parameters:
x: - The x coordinatey: - The y coordinatevalue: - The value to set
| Method | Type |
|---|---|
forEach |
(callbackFn: MapCallback<T, void>) => void |
Parameters:
callbackFn: - The function to execute on each element
| Method | Type |
|---|---|
reduce |
<R>(callbackFn: ReduceCallback<T, R>, initialValue: R) => R |
Parameters:
callbackFn: - The function to execute on each element, returning the new accumulator valueinitialValue: - The initial value of the accumulator
| Method | Type |
|---|---|
fill |
(value: T) => this |
Parameters:
value: - The value to fill the view with
| Method | Type |
|---|---|
floodFill |
(pos: [number, number], value: T, topology?: Topology, predicate?: ((target: T, current: T) => boolean) or undefined) => this |
Parameters:
pos: - Position to start the flood fillvalue: - The value to fill the view withtopology: - The topology of the flood fill (4 or 8)predicate: - The predicate to determine if a cell should be filled
| Method | Type |
|---|---|
update |
(callbackFn: MapCallback<T, T>) => this |
Parameters:
callbackFn: - The function to execute on each element, returning the new value
| Method | Type |
|---|---|
place |
(sub: StridedView<T>, [x, y]: [number, number]) => this |
Parameters:
sub: - The subview to placepos: - The position to place the subview
| Method | Type |
|---|---|
placeWith |
<R>(sub: StridedView<R>, pos: [number, number], callbackFn: MapCallback<R, T>) => this |
Parameters:
sub: - The subview to placepos: - The position to place the subviewcallbackFn: - The function to execute on each element, returning the new value
| Method | Type |
|---|---|
map |
<R>(callbackFn: MapCallback<T, R>) => StridedView<R> |
Parameters:
callbackFn: - The function to execute on each element, returning the new value
| Method | Type |
|---|---|
copy |
() => StridedView<T> |
| Method | Type |
|---|---|
reshape |
(shape: [number, number]) => StridedView<T> |
Parameters:
shape: - The new shape of the array
| Method | Type |
|---|---|
transpose |
() => StridedView<T> |
| Method | Type |
|---|---|
lo |
([x, y]: [number, number]) => StridedView<T> |
Parameters:
pos: - The position of the lower bound
| Method | Type |
|---|---|
hi |
(shape: [number, number]) => StridedView<T> |
Parameters:
shape: - The shape of the upper bound
| Method | Type |
|---|---|
slice |
([x, y]: [number, number], shape?: [number, number] or undefined) => StridedView<T> |
Parameters:
begin: - The coordinates to start the slice fromshape: - The size of the slice (Default: [shape[0] - begin[0], shape[1] - begin[1])
| Method | Type |
|---|---|
col |
(col: number) => StridedView<T> |
Parameters:
col: - The index of the column
| Method | Type |
|---|---|
row |
(row: number) => StridedView<T> |
Parameters:
row: - The index of the row
| Method | Type |
|---|---|
flip |
(dim?: Dim) => StridedView<T> |
Parameters:
dim: - The dimension of the axis (Default: 0, 0 = x, 1 = y)
| Method | Type |
|---|---|
scale |
(scale: [number, number]) => StridedView<T> |
| Method | Type |
|---|---|
reverse |
() => StridedView<T> |
| Method | Type |
|---|---|
rotate90 |
() => StridedView<T> |
| Method | Type |
|---|---|
neighborhood |
(pos: [number, number], distance?: number) => StridedView<T> |
Parameters:
pos: - The position of the center of the neighborhooddistance: - The distance from the center of the neighborhood
| Method | Type |
|---|---|
flat |
() => StridedView<T> |
| Method | Type |
|---|---|
indexOf |
(value: T) => [number, number] |
Parameters:
value: - The value to search for
| Method | Type |
|---|---|
includes |
(value: T) => boolean |
Parameters:
value: - The value to search for
| Method | Type |
|---|---|
some |
(callbackFn: MapCallback<T, boolean>) => boolean |
Parameters:
callbackFn: -
| Method | Type |
|---|---|
every |
(callbackFn: MapCallback<T, boolean>) => boolean |
Parameters:
callbackFn: -
| Method | Type |
|---|---|
findIndex |
(callbackFn: MapCallback<T, boolean>) => [number, number] |
Parameters:
callbackFn: -
| Method | Type |
|---|---|
findIndices |
(callbackFn?: MapCallback<T, boolean> or undefined) => [number, number][] |
| Method | Type |
|---|---|
sample |
(k?: number, callbackFn?: MapCallback<T, boolean> or undefined) => [number, number][] |
| Method | Type |
|---|---|
serialize |
() => { shape: [number, number]; stride: [number, number]; offset: number; data: Data<T>; } |
| Method | Type |
|---|---|
toString |
() => string |
| Method | Type |
|---|---|
join |
(colSep?: string, rowSep?: string) => string |
Parameters:
colSep: - The separator between columns (default: ",")rowSep: - The separator between rows (default: "\n")
| Method | Type |
|---|---|
toArrays |
() => T[][] |
| Method | Type |
|---|---|
toArray |
() => T[] |
| Method | Type |
|---|---|
of |
<T>(array: Data<T>, shape?: [number, number] or undefined) => StridedView<T> |
Parameters:
array: - The underlying 1D storage for the multidimensional arrayshape: - The shape of the view
| Method | Type |
|---|---|
from |
<T>(array: T[][]) => StridedView<T> |
Parameters:
array: - A 2D array to create a view from
| Method | Type |
|---|---|
range |
(shape: [number, number], start?: number, step?: number) => StridedView<number> |
Parameters:
shape: - The shape of the rangestart: - The starting value of the range (Default: 0)step: - The step between values in the range (Default: 1)
| Method | Type |
|---|---|
zeros |
(shape: [number, number]) => StridedView<number> |
Parameters:
shape: - The shape of the array
| Method | Type |
|---|---|
ones |
(shape: [number, number]) => StridedView<number> |
Parameters:
shape: - The shape of the array
| Method | Type |
|---|---|
identity |
(length: number) => StridedView<number> |
Parameters:
length: - The length of the identity matrix
| Method | Type |
|---|---|
diagonal |
(array: number[]) => StridedView<number> |
Parameters:
array: - The array to create a diagonal matrix from (i.e. the diagonal values)
| Method | Type |
|---|---|
fill |
<T>(shape: [number, number], value: T) => StridedView<T> |
Parameters:
shape: - The shape of the viewvalue: - The value to fill the array with
| Method | Type |
|---|---|
random |
(shape: [number, number], randFn?: (() => number) or undefined) => StridedView<number> |
Parameters:
shape: - The shape of the viewrandFn: - The random number generator function (Default: Math.random)
| Method | Type |
|---|---|
empty |
<T>(shape: [number, number]) => StridedView<T> |
| Method | Type |
|---|---|
isStridedView |
<T>(obj: any) => obj is StridedView<T> |
Parameters:
obj: - The object to check
| Property | Type |
|---|---|
stride |
[number, number] |
| Property | Type |
|---|---|
shape |
[number, number] |
| Property | Type |
|---|---|
offset |
number |