Class: NDArray

NDArray(shape, data, dtype, base, strides, offset, itemsize)

new NDArray(shape, data, dtype, base, strides, offset, itemsize)

Parameters:
Name Type Default Description
shape Array.<number>
data Array.<any> null
dtype Dtype null
base NDArray null
strides Array.<number> null
offset number 0
itemsize number 1 always 1
Source:

Classes

NDArray

Members

T :NDArray

Type:
Source:

base :NDArray|null

Type:
Source:

data :Array.<any>

Type:
  • Array.<any>
Source:

dtype :Dtype

Type:
Source:

flat :Flatiter

Type:
Source:

itemsize :number

Type:
  • number
Source:

length :number

Type:
  • number
Source:

ndim :number

Type:
  • number
Source:

offset :number

Type:
  • number
Source:

shape :Array.<number>

Type:
  • Array.<number>
Source:

size :number

Type:
  • number
Source:

strides :Array.<number>

Type:
  • Array.<number>
Source:

Methods

add(x, outopt) → {NDArray}

Returns add(this, x, out)
Parameters:
Name Type Attributes Default Description
x NDArray
out null | NDArray <optional>
null
Source:
Returns:
Type
NDArray
Example
x.add(a, x)
// in-place add

all(axis, out, keepdims, initial, return_scalar) → {NDArray.<boolean>|boolean}

Parameters:
Name Type Default Description
axis number | Array.<number> | null null
out NDArray null
keepdims boolean false
initial boolean true
return_scalar boolean true
Source:
Returns:
Type
NDArray.<boolean> | boolean

any(axis, out, keepdims, initial, return_scalar) → {NDArray.<boolean>|boolean}

Parameters:
Name Type Default Description
axis number | Array.<number> | null null
out NDArray null
keepdims boolean false
initial boolean false
return_scalar boolean true
Source:
Returns:
Type
NDArray.<boolean> | boolean

argmax(axisopt, outopt, keepdimsopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
axis number | null <optional>
null
out NDArray | null <optional>
null
keepdims boolean <optional>
false
Source:
Returns:
Type
NDArray

argmin(axisopt, outopt, keepdimsopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
axis number | null <optional>
null
out NDArray | null <optional>
null
keepdims boolean <optional>
false
Source:
Returns:
Type
NDArray

argsort(axis, keyopt) → {NDArray.<number>}

Parameters:
Name Type Attributes Default Description
axis number
key function <optional>
null
Source:
Returns:
Type
NDArray.<number>

array() → {Array.<any>|any}

Source:
Returns:
Type
Array.<any> | any

as_strided(shapeopt, stridesopt, offsetopt) → {NDArray}

Returns a view with the given shape, strides, and offset. out.base = this.base ?? this
Parameters:
Name Type Attributes Description
shape Array.<number> <optional>
strides Array.<number> <optional>
offset number <optional>
required as a ptr to the first item
Source:
Returns:
Type
NDArray

astype(dtype, copyopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
dtype Dtype
copy boolean <optional>
true
Source:
Returns:
Type
NDArray

at(…indices) → {NDArray}

`.at(0)` is is equivalent to `.get([0])`
Parameters:
Name Type Attributes Description
indices number | Slice | string | null | Array.<number> | Array.<boolean> | NDArray <repeatable>
Source:
Returns:
Type
NDArray

clip(a_min, a_max, out) → {NDArray}

Parameters:
Name Type Default Description
a_min number | NDArray
a_max number | NDArray
out NDArray null
Source:
Returns:
Type
NDArray

compress(condition, axisopt, outopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
condition Array.<boolean>
axis number <optional>
null
out NDArray <optional>
null
Source:
Returns:
Type
NDArray

copy() → {NDArray}

Source:
Returns:
Type
NDArray

cumprod(axisopt, outopt) → {NDArray}

Parameters:
Name Type Attributes Description
axis number <optional>
out NDArray <optional>
Source:
Returns:
Type
NDArray

cumsum(axisopt, outopt) → {NDArray}

Parameters:
Name Type Attributes Description
axis number <optional>
out NDArray <optional>
Source:
Returns:
Type
NDArray

diagonal(offsetopt, axis1opt, axis2opt) → {NDArray}

Parameters:
Name Type Attributes Default Description
offset number <optional>
0
axis1 number <optional>
0
axis2 number <optional>
1
Source:
Returns:
Type
NDArray

div(x, outopt) → {NDArray}

Returns divide(this, x, out)
Parameters:
Name Type Attributes Default Description
x NDArray
out null | NDArray <optional>
null
Source:
Returns:
Type
NDArray

fill(value) → {NDArray}

Parameters:
Name Type Description
value any
Source:
Returns:
this
Type
NDArray

flatten() → {NDArray}

Source:
Returns:
Type
NDArray

get(indices, axisopt) → {NDArray}

`.get(indices)` is is equivalent to `.at(...indices)`
Parameters:
Name Type Attributes Default Description
indices Array.<(number|Slice|string|null|Array.<number>|Array.<boolean>|NDArray)>
axis number <optional>
0
Source:
Returns:
Type
NDArray

idx(index) → {number}

Converts NDArray index to .data[] index.
Parameters:
Name Type Description
index number | Array.<number> | undefined
Source:
Returns:
Type
number

item(index) → {any}

Returns an element of the array. if `index` is an integer, `index` is regarded as a flatten index. `index` can be undefined only if `a.size == 1`.
Parameters:
Name Type Description
index number | Array.<number> | undefined
Source:
Returns:
Type
any

itemset(index, scalar) → {NDArray}

Sets an element of the array. index can be undefined only if a.size == 1.
Parameters:
Name Type Description
index number | Array.<number> | undefined
scalar any
Source:
Returns:
Type
NDArray

keys() → {NdoffsetIterator}

Returns `ndoffset(this.shape, this.strides, this.offset)`. Useful when iterating `this.data[i]` or `this.item(i)` in a `for (let i of this.keys())` loop.
Source:
Returns:
Type
NdoffsetIterator

max(axisopt, outopt, keepdimsopt, initialopt, return_scalaropt) → {NDArray.<any>|any}

Parameters:
Name Type Attributes Default Description
axis number | Array.<number> <optional>
null
out NDArray <optional>
null
keepdims boolean <optional>
false
initial any <optional>
null
return_scalar boolean <optional>
true
Source:
Returns:
Type
NDArray.<any> | any

min(axisopt, outopt, keepdimsopt, initialopt, return_scalaropt) → {NDArray|any}

Parameters:
Name Type Attributes Default Description
axis number | Array.<number> <optional>
null
out NDArray <optional>
null
keepdims boolean <optional>
false
initial any <optional>
null
return_scalar boolean <optional>
true
Source:
Returns:
Type
NDArray | any

mod(x, outopt) → {NDArray}

Returns mod(this, x, out)
Parameters:
Name Type Attributes Default Description
x NDArray
out null | NDArray <optional>
null
Source:
Returns:
Type
NDArray

mul(x, outopt) → {NDArray}

Returns multiply(this, x, out)
Parameters:
Name Type Attributes Default Description
x NDArray
out null | NDArray <optional>
null
Source:
Returns:
Type
NDArray

nonzero() → {Array.<NDArray>}

Source:
Returns:
Type
Array.<NDArray>

prod(axisopt, outopt, keepdimsopt, initialopt, return_scalaropt) → {NDArray|any}

Parameters:
Name Type Attributes Default Description
axis number | Array.<number> <optional>
null
out NDArray <optional>
null
keepdims boolean <optional>
false
initial any <optional>
0
return_scalar boolean <optional>
true
Source:
Returns:
Type
NDArray | any

ptp(axisopt, outopt, keepdimsopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
axis number | Array.<number> <optional>
null
out NDArray <optional>
null
keepdims boolean <optional>
false
Source:
Returns:
Type
NDArray

put(indices, values, modeopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
indices Array.<number>
values Array.<any>
mode string <optional>
raise
Source:
Returns:
this
Type
NDArray

ravel() → {NDArray}

Source:
Returns:
Type
NDArray

repeat(repeats, axisopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
repeats number | Array.<number>
axis number <optional>
null
Source:
Returns:
Type
NDArray

reshape(…shape) → {NDArray}

`.reshape(1, 2)` is equivalent to `.reshape([1, 2])`
Parameters:
Name Type Attributes Description
shape number | Array.<number> <repeatable>
Source:
Returns:
Type
NDArray

resize(new_shape) → {NDArray}

inplace resize
Parameters:
Name Type Description
new_shape Array.<number>
Source:
Returns:
this
Type
NDArray

round(decimalsopt, outopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
decimals number <optional>
0
out NDArray <optional>
null
Source:
Returns:
Type
NDArray

searchsorted(v, sideopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
v Array.<any>
side string <optional>
left
Source:
Returns:
Type
NDArray

set(indices, valueopt) → {NDArray}

`.set(value)` is equivalent to `.set(['...'], value)`, but faster
Parameters:
Name Type Attributes Description
indices Array.<(number|Slice|string|null|Array.<number>|Array.<boolean>|NDArray)>
value any <optional>
Source:
Returns:
Type
NDArray

slice(startopt, endopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
start number | null <optional>
null
end number | null <optional>
null
Source:
Returns:
Type
NDArray

sort(axisopt, keyopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
axis number <optional>
key function <optional>
null
Source:
Returns:
this
Type
NDArray

squeeze(axis) → {NDArray}

Parameters:
Name Type Default Description
axis number | Array.<number> null
Source:
Returns:
Type
NDArray

std(axisopt, outopt, ddofopt, keepdimsopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
axis number | Array.<number> <optional>
null
out NDArray <optional>
null
ddof number <optional>
0
keepdims boolean <optional>
false
Source:
Returns:
Type
NDArray

sub(x, outopt) → {NDArray}

Returns subtract(this, x, out)
Parameters:
Name Type Attributes Default Description
x NDArray
out null | NDArray <optional>
null
Source:
Returns:
Type
NDArray

sum(axisopt, outopt, keepdimsopt, initialopt, return_scalaropt) → {NDArray|any}

Parameters:
Name Type Attributes Default Description
axis number | Array.<number> <optional>
null
out NDArray <optional>
null
keepdims boolean <optional>
false
initial number <optional>
0
return_scalar boolean <optional>
true
Source:
Returns:
Type
NDArray | any

swapaxes(axis1, axis2) → {NDArray}

Parameters:
Name Type Description
axis1 number
axis2 number
Source:
Returns:
Type
NDArray

take(indices, axisopt, outopt, modeopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
indices Array.<number>
axis number <optional>
null
out NDArray <optional>
null
mode string <optional>
raise
Source:
Returns:
Type
NDArray

toString() → {string}

Source:
Returns:
Type
string

toarray() → {Array.<any>|any}

Source:
Returns:
Type
Array.<any> | any

tolist() → {Array.<any>|any}

Alias of .toarray()
Source:
Returns:
Type
Array.<any> | any

transpose(axesopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
axes number | Array.<number> <optional>
null
Source:
Returns:
Type
NDArray

valueOf() → {any|string}

Source:
Returns:
Type
any | string

values() → {Flatiter}

Returns `this.flat`.
Source:
Returns:
Type
Flatiter

variance(axisopt, outopt, ddofopt, keepdimsopt) → {NDArray}

Parameters:
Name Type Attributes Default Description
axis number | Array.<number> <optional>
null
out NDArray <optional>
null
ddof number <optional>
0
keepdims boolean <optional>
false
Source:
Returns:
Type
NDArray