Multidimensional arrays.
var ns = require( '@stdlib/ndarray' );
ndarray namespace.
var o = ns;
// returns {...}
The namespace exports the following functions to create multidimensional arrays:
- array( [buffer,] [options] ): create a multidimensional array.
- copy( x[, options] ): copy an input ndarray to a new ndarray having the same shape and data type.
- ndarray( dtype, buffer, shape, strides, offset, order[, options] ): multidimensional array constructor.
- emptyLike( x[, options] ): create an uninitialized ndarray having the same shape and data type as a provided ndarray.
- empty( shape[, options] ): create an uninitialized ndarray having a specified shape and data type.
- falsesLike( x[, options] ): create an ndarray filled with false values and having the same shape and data type as a provided ndarray.
- falses( shape[, options] ): create an ndarray filled with false values and having a specified shape and data type.
- FancyArray( dtype, buffer, shape, strides, offset, order[, options] ): fancy multidimensional array constructor.
- scalar2ndarrayLike( x, value[, options] ): convert a scalar value to a zero-dimensional ndarray having the same data-type as a provided ndarray.
- scalar2ndarray( value[, options] ): convert a scalar value to a zero-dimensional ndarray.
- nansLike( x[, options] ): create a NaN-filled ndarray having the same shape and data type as a provided ndarray.
- nans( shape[, options] ): create a NaN-filled ndarray having a specified shape and data type.
- ndarraylike2ndarray( x[, options] ): convert an ndarray-like object to an ndarray.
- onesLike( x[, options] ): create a ones-filled ndarray having the same shape and data type as a provided ndarray.
- ones( shape[, options] ): create a ones-filled ndarray having a specified shape and data type.
- ndarray2fancy( x[, options] ): convert an ndarray to an object supporting fancy indexing.
- truesLike( x[, options] ): create an ndarray filled with true values and having the same shape and data type as a provided ndarray.
- trues( shape[, options] ): create an ndarray filled with true values and having a specified shape and data type.
- zerosLike( x[, options] ): create a zero-filled ndarray having the same shape and data type as a provided ndarray.
- zeros( shape[, options] ): create a zero-filled ndarray having a specified shape and data type.
The namespace exports the following functions to manipulate multidimensional arrays:
- broadcastArray( x, shape ): broadcast an ndarray to a specified shape.
- broadcastArrays( ...arrays ): broadcast ndarrays to a common shape.
- broadcastScalarLike( x, value[, options] ): broadcast a scalar value to an ndarray having the same shape and data-type as a provided input ndarray.
- broadcastScalar( value, shape[, options] ): broadcast a scalar value to an ndarray of a specified shape.
- colcat( arrays ): concatenate a list of one-dimensional or two-dimensional ndarrays as columns.
- concat( arrays[, options] ): concatenate a list of ndarrays along a specified ndarray dimension.
- concat1d( ...arrays ): return a one-dimensional ndarray formed by concatenating provided input arguments.
- diagonal( x[, options] ): return a read-only view of the diagonal of a matrix (or stack of matrices).
- fillBy( x, fcn[, thisArg] ): fill an input ndarray according to a callback function.
- fillSlice( x, value, ...s[, options] ): fill an input ndarray view with a specified value.
- fill( x, value ): fill an input ndarray with a specified value.
- flattenBy( x[, options], fcn[, thisArg] ): flatten an ndarray according to a callback function.
- flattenFromBy( x, dim[, options], fcn[, thisArg] ): flatten an ndarray according to a callback function starting from a specified dimension.
- flattenFrom( x, dim[, options] ): return a copy of an input ndarray where all dimensions of the input ndarray are flattened starting from a specified dimension.
- flatten( x[, options] ): return a flattened copy of an input ndarray.
- fliplr( x ): return a read-only view of an input ndarray in which the order of elements along the last dimension is reversed.
- flipud( x ): return a read-only view of an input ndarray in which the order of elements along the second-to-last dimension is reversed.
- hconcat( arrays ): concatenate a list of ndarrays along the last dimension.
- map( x[, options], fcn[, thisArg] ): apply a callback function to elements in an input ndarray and assign results to elements in a new output ndarray.
- maybeBroadcastArray( x, shape ): broadcast an ndarray to a specified shape if and only if the specified shape differs from the provided ndarray's shape.
- maybeBroadcastArrays( arrays ): broadcast ndarrays to a common shape.
- pop( x[, options] ): return an array containing a read-only truncated view of an input ndarray and a read-only view of the last element(s) along a specified dimension.
- prependSingletonDimensions( x, n ): return a read-only view of an input ndarray with a specified number of prepended singleton dimensions.
- push( x, ...values ): return a one-dimensional ndarray formed by appending provided scalar values to a one-dimensional input ndarray.
- removeSingletonDimensions( x ): return a read-only view of an input ndarray with singleton dimensions removed.
- reverseDimension( x, dim ): return a read-only view of an input ndarray in which the order of elements along a specified dimension is reversed.
- reverseDimensions( x, dims ): return a read-only view of an input ndarray in which the order of elements along specified dimensions is reversed.
- reverse( x ): return a read-only view of an input ndarray in which the order of elements along each dimension is reversed.
- rot180( x[, options] ): return a read-only view of an input ndarray rotated 180 degrees in a specified plane.
- rot90( x[, options] ): return a read-only view of an input ndarray rotated 90 degrees in a specified plane.
- rotl90( x, k ): return a read-only view of a matrix (or a stack of matrices) rotated 90 degrees counterclockwise.
- rotr90( x, k ): return a read-only view of a matrix (or a stack of matrices) rotated 90 degrees clockwise.
- rowcat( arrays ): concatenate a list of one-dimensional or two-dimensional ndarrays as rows.
- shift( x[, options] ): return an array containing a read-only truncated view of an input ndarray and a read-only view of the first element(s) along a specified dimension.
- sliceAssign( x, y, ...s[, options] ): assign element values from a broadcasted input ndarray to corresponding elements in an output ndarray view.
- sliceDimensionFrom( x, dim, start[, options] ): return a read-only shifted view of an input ndarray along a specified dimension.
- sliceDimensionTo( x, dim, stop[, options] ): return a read-only truncated view of an input ndarray along a specified dimension.
- sliceDimension( x, dim, slice[, options] ): return a read-only view of an input ndarray when sliced along a specified dimension.
- sliceFrom( x, ...start[, options] ): return a read-only shifted view of an input ndarray.
- sliceTo( x, ...stop[, options] ): return a read-only truncated view of an input ndarray.
- slice( x, ...s[, options] ): return a read-only view of an input ndarray.
- spreadDimensions( ndims, x, dims ): return a read-only view of an input ndarray where the dimensions of the input ndarray are expanded to a specified dimensionality by spreading dimensions to specified dimension indices and inserting dimensions of size one for the remaining dimensions.
- toFlippedlr( x ): return a new ndarray where the order of elements along the last dimension of an input ndarray is reversed.
- toFlippedud( x ): return a new ndarray where the order of elements along the second-to-last dimension of an input ndarray is reversed.
- toReversedDimension( x[, options] ): return a new ndarray where the order of elements of an input ndarray along a specified dimension is reversed.
- toReversedDimensions( x, dims ): return a new ndarray where the order of elements of an input ndarray along specified dimensions is reversed.
- toReversed( x ): return a new ndarray where the order of elements of an input ndarray is reversed along each dimension.
- toRot180( x[, options] ): return a new ndarray where an input ndarray is rotated 180 degrees in a specified plane.
- toRot90( x[, options] ): return a new ndarray where an input ndarray is rotated 90 degrees in a specified plane.
- toRotl90( x, k ): return a new ndarray where a matrix (or a stack of matrices) is rotated 90 degrees counterclockwise.
- toRotr90( x, k ): return a new ndarray where a matrix (or a stack of matrices) is rotated 90 degrees clockwise.
- toTransposed( x ): return a new ndarray containing the elements of an input ndarray but whose last two dimensions are transposed.
- toUnflattened( x, dim, sizes ): return a new ndarray in which a specified dimension of an input ndarray is expanded over multiple dimensions.
- transpose( x ): return a read-only view of an input ndarray in which the last two dimensions are transposed.
- unflatten( x, dim, sizes ): return a read-only view of an input ndarray in which a specified dimension is expanded over multiple dimensions.
- unshift( x, ...values ): return a one-dimensional ndarray formed by prepending provided scalar values to a one-dimensional input ndarray.
- vconcat( arrays ): concatenate a list of ndarrays along the second-to-last dimension.
- ndarrayWith( x, indices, value ): return a new ndarray with the element at a specified index replaced by a provided value.
The namespace exports the following functions to search multidimensional arrays:
- anyBy( x[, options], predicate[, thisArg] ): test whether at least one element along one or more ndarray dimensions passes a test implemented by a predicate function.
- any( x[, options] ): test whether at least one element along one or more ndarray dimensions is truthy.
- countFalsy( x[, options] ): count the number of falsy elements along one or more ndarray dimensions.
- countIf( x[, options], predicate[, thisArg] ): count the number of truthy elements along one or more ndarray dimensions.
- countTruthy( x[, options] ): count the number of truthy elements along one or more ndarray dimensions.
- everyBy( x[, options], predicate[, thisArg] ): test whether all elements along one or more ndarray dimensions pass a test implemented by a predicate function.
- every( x[, options] ): test whether every element along one or more ndarray dimensions is truthy.
- filterMap( x[, options], fcn[, thisArg] ): filter and map elements in an input ndarray to elements in a new output ndarray according to a callback function.
- filter( x[, options], predicate[, thisArg] ): return a shallow copy of an ndarray containing only those elements which pass a test implemented by a predicate function.
- findLast( x[, options], predicate[, thisArg] ): return a new ndarray containing the last elements which pass a test implemented by a predicate function along one or more ndarray dimensions.
- find( x[, options], predicate[, thisArg] ): return a new ndarray containing the first elements which pass a test implemented by a predicate function along one or more ndarray dimensions.
- includes( x, searchElement[, options] ): test whether an ndarray contains a specified value along one or more dimensions.
- reject( x[, options], predicate[, thisArg] ): return a shallow copy of an ndarray containing only those elements which fail a test implemented by a predicate function.
- someBy( x, n[, options], predicate[, thisArg] ): test whether at least n elements along one or more ndarray dimensions pass a test implemented by a predicate function.
- some( x, n[, options] ): test whether at least n elements along one or more ndarray dimensions are truthy.
The namespace exports the following functions to inspect multidimensional arrays:
- dataBuffer( x ): return the underlying data buffer of a provided ndarray.
- dtype( x ): return the data type of a provided ndarray.
- flag( x, name ): return a specified flag for a provided ndarray.
- flags( x ): return the flags of a provided ndarray.
- ndims( x ): return the number of ndarray dimensions.
- numelDimension( x, dim ): return the size (i.e., number of elements) of a specified dimension for a provided ndarray.
- numel( x ): return the number of elements in an ndarray.
- offset( x ): return the index offset specifying the underlying buffer index of the first iterated ndarray element.
- order( x ): return the layout order of a provided ndarray.
- shape( x ): return the shape of a provided ndarray.
- stride( x, dim ): return the stride along a specified dimension for a provided ndarray.
- strides( x ): return the strides of a provided ndarray.
The namespace exports the following functions to index multidimensional arrays:
The namespace exports the following functions to convert multidimensional arrays:
The namespace exports the following functions for working with multidimensional array data types:
The namespace contains the following sub-namespaces:
- base: base ndarray.
- iter: multidimensional array iterators.
- vector: vector constructors and associated utilities.
The namespace contains the following multidimensional array utility functions:
var objectKeys = require( '@stdlib/utils/keys' );
var ns = require( '@stdlib/ndarray' );
console.log( objectKeys( ns ) );