Global

Methods

abs(x) → {NdArray}

Return absolute value of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

add(a, b) → {NdArray}

Add arguments, element-wise.
Parameters:
Name Type Description
a NdArray | Array | number
b NdArray | Array | number
Source:
Returns:
Type
NdArray

arange(startopt, stop, stepopt, dtypeopt) → {NdArray}

Return evenly spaced values within a given interval.
Parameters:
Name Type Attributes Default Description
start int <optional>
0 Start of interval. The interval includes this value.
stop int End of interval. The interval does not include this value.
step int <optional>
1 Spacing between values. The default step size is 1. If step is specified, start must also be given.
dtype String | Object <optional>
Array The type of the output array.
Source:
Returns:
Array of evenly spaced values.
Type
NdArray

arccos(x) → {NdArray}

Return trigonometric inverse cosine of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

arcsin(x) → {NdArray}

Return trigonometric inverse sine of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

arctan(x) → {NdArray}

Return trigonometric inverse tangent of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

clip(x, minopt, maxopt) → {NdArray}

Clip (limit) the values in an array between min and max, element-wise.
Parameters:
Name Type Attributes Default Description
x Array | NdArray | number
min number <optional>
0
max number <optional>
1
Source:
Returns:
Type
NdArray

concatenate(…arrays) → {NdArray}

Join given arrays along the last axis.
Parameters:
Name Type Attributes Description
arrays Array | NdArray <repeatable>
Source:
Returns:
Type
NdArray

convolve(a, b)

Convolve 2 N-dimensionnal arrays
Parameters:
Name Type Description
a Array | NdArray
b Array | NdArray
Source:

cos(x) → {NdArray}

Return trigonometric cosine of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

diag(x) → {NdArray}

Extract a diagonal or construct a diagonal array.
Parameters:
Name Type Description
x Array | NdArray
Source:
Returns:
a view a of the original array when possible, a new array otherwise
Type
NdArray

divide(a, b) → {NdArray}

Divide `a` by `b`, element-wise.
Parameters:
Name Type Description
a Array | NdArray
b Array | NdArray | number
Source:
Returns:
Type
NdArray

dot(a, b) → {NdArray}

Dot product of two arrays. WARNING: supported products are: - matrix dot matrix - vector dot vector - matrix dot vector - vector dot matrix
Parameters:
Name Type Description
a Array | NdArray
b Array | NdArray
Source:
Returns:
Type
NdArray

empty(shape, dtypeopt) → {NdArray}

Return a new array of given shape and type, filled with `undefined` values.
Parameters:
Name Type Attributes Default Description
shape Array | int Shape of the new array, e.g., [2, 3] or 2.
dtype String | Object <optional>
Array The type of the output array.
Source:
Returns:
Array of `undefined` values with the given shape and dtype
Type
NdArray

equal(array1, array2) → {boolean}

Return true if two arrays have the same shape and elements, false otherwise.
Parameters:
Name Type Description
array1 Array | NdArray
array2 Array | NdArray
Source:
Returns:
Type
boolean

exp(x) → {NdArray}

Calculate the exponential of all elements in the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

fftconvolve(a, b)

Convolve 2 N-dimensionnal arrays using Fast Fourier Transform (FFT)
Parameters:
Name Type Description
a Array | NdArray
b Array | NdArray
Source:

flatten(array) → {NdArray}

Return a copy of the array collapsed into one dimension using row-major order (C-style)
Parameters:
Name Type Description
array Array | NdArray
Source:
Returns:
Type
NdArray

getRawData(array) → {*}

Parameters:
Name Type Description
array NdArray
Source:
Returns:
Type
*

identity(Number, dtypeopt) → {Array}

The identity array is a square array with ones on the main diagonal.
Parameters:
Name Type Attributes Default Description
Number number of rows (and columns) in n x n output.
dtype String | Object <optional>
Array The type of the output array.
Source:
Returns:
n x n array with its main diagonal set to one, and all other elements 0
Type
Array

log(x) → {NdArray}

Calculate the natural logarithm of all elements in the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

max(x) → {Number}

Return the maximum value of the array
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
Number

mean(x) → {number}

Return the arithmetic mean of input array elements.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
number

min(x) → {Number}

Return the minimum value of the array
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
Number

multiply(a, b) → {NdArray}

Multiply arguments, element-wise.
Parameters:
Name Type Description
a Array | NdArray
b Array | NdArray | number
Source:
Returns:
Type
NdArray

negative(x) → {NdArray}

Return the inverse of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

ones(shape, dtypeopt) → {NdArray}

Return a new array of given shape and type, filled with ones.
Parameters:
Name Type Attributes Default Description
shape Array | int Shape of the new array, e.g., [2, 3] or 2.
dtype String | Object <optional>
Array The type of the output array.
Source:
Returns:
Array of ones with the given shape and dtype
Type
NdArray

power(x1, x2) → {NdArray}

Raise first array elements to powers from second array, element-wise.
Parameters:
Name Type Description
x1 Array | NdArray | number
x2 Array | NdArray | number
Source:
Returns:
Type
NdArray

random(shape) → {NdArray}

Create an array of the given shape and propagate it with random samples from a uniform distribution over [0, 1].
Parameters:
Name Type Description
shape number | Array | number The dimensions of the returned array, should all be positive integers
Source:
Returns:
Type
NdArray

reshape(array, shape) → {NdArray}

Gives a new shape to an array without changing its data.
Parameters:
Name Type Description
array Array | NdArray
shape Array The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length
Source:
Returns:
Type
NdArray

round(x) → {NdArray}

Round an array to the to the nearest integer.
Parameters:
Name Type Description
x Array | NdArray
Source:
Returns:
Type
NdArray

sigmoid(x, topt) → {NdArray}

Return the sigmoid of the input array, element-wise.
Parameters:
Name Type Attributes Default Description
x Array | NdArray | number
t number <optional>
1 stifness parameter
Source:
Returns:
Type
NdArray

sin(x) → {NdArray}

Return trigonometric sine of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

softmax(x) → {NdArray}

Return the softmax, or normalized exponential, of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

sqrt(x) → {NdArray}

Calculate the positive square-root of all elements in the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

stack(sequence, axisopt) → {Array}

Join a sequence of arrays along a new axis. The axis parameter specifies the index of the new axis in the dimensions of the result. For example, if axis=0 it will be the first dimension and if axis=-1 it will be the last dimension.
Parameters:
Name Type Attributes Default Description
sequence Array of array_like
axis number <optional>
0 The axis in the result array along which the input arrays are stacked.
Source:
Returns:
The stacked array has one more dimension than the input arrays.
Type
Array

std(x) → {number}

Returns the standard deviation, a measure of the spread of a distribution, of the input array elements.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
number

subtract(a, b) → {NdArray}

Subtract second argument from the first, element-wise.
Parameters:
Name Type Description
a NdArray | Array | number
b NdArray | Array | number
Source:
Returns:
Type
NdArray

sum(x) → {number}

Return the sum of input array elements.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
number

tan(x) → {NdArray}

Return trigonometric tangent of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

tanh(x) → {NdArray}

Return hyperbolic tangent of the input array, element-wise.
Parameters:
Name Type Description
x Array | NdArray | number
Source:
Returns:
Type
NdArray

transpose(x, axesopt) → {NdArray}

Permute the dimensions of the input array according to the given axes.
Parameters:
Name Type Attributes Description
x Array | NdArray | number
axes number | number <optional>
Source:
Returns:
Type
NdArray
Example
arr = nj.arange(6).reshape(1,2,3)
// array([[[ 0, 1, 2],
//         [ 3, 4, 5]]])
arr.T
// array([[[ 0],
//         [ 3]],
//        [[ 1],
//         [ 4]],
//        [[ 2],
//         [ 5]]])

arr.transpose(1,0,2)
// array([[[ 0, 1, 2]],
//        [[ 3, 4, 5]]])

zeros(shape, dtypeopt) → {NdArray}

Return a new array of given shape and type, filled with zeros.
Parameters:
Name Type Attributes Default Description
shape Array | int Shape of the new array, e.g., [2, 3] or 2.
dtype String | Object <optional>
Array The type of the output array.
Source:
Returns:
Array of zeros with the given shape and dtype
Type
NdArray

Type Definitions

imgCallback(error)

This callback type is called `imgCallback` and is displayed as a global symbol.
Parameters:
Name Type Description
error err if any, null otherwise
NdArray image represented as a (H, W, [K,]) array, with K the number of color channels. if image is grayscale (or B&W) then image only have two dimensions H and W
Source: