Package Exports
- @stdlib/array-base
- @stdlib/array-base/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stdlib/array-base) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
About stdlib...
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
base
Base (i.e., lower-level) array utilities.
Installation
npm install @stdlib/array-baseUsage
var ns = require( '@stdlib/array-base' );ns
Array utilities.
var o = ns;
// returns {...}The namespace exports the following:
accessorGetter( dtype ): return an accessor function for retrieving an element from an array-like object supporting the get/set protocol.accessorSetter( dtype ): return an accessor function for setting an element in an array-like object supporting the get/set protocol.AccessorArray( arr ): create a minimal array-like object supporting the accessor protocol from another array-like object.accessors( x ): return element accessors for a provided array-like object.arraylike2object( x ): convert an array-like object to an object likely to have the same "shape".assert: base array assertion utilities.binary2d( arrays, shape, fcn ): apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.binary3d( arrays, shape, fcn ): apply a binary callback to elements in two three-dimensional nested input arrays and assign results to elements in a three-dimensional nested output array.binary4d( arrays, shape, fcn ): apply a binary callback to elements in two four-dimensional nested input arrays and assign results to elements in a four-dimensional nested output array.binary5d( arrays, shape, fcn ): apply a binary callback to elements in two five-dimensional nested input arrays and assign results to elements in a five-dimensional nested output array.binarynd( arrays, shape, fcn ): apply a binary callback to elements in two n-dimensional nested input arrays and assign results to elements in an n-dimensional nested output array.broadcastArray( x, inShape, outShape ): broadcast an array to a specified shape.bbinary2d( arrays, shapes, fcn ): apply a binary callback to elements in two broadcasted nested input arrays and assign results to elements in a two-dimensional nested output array.bbinary3d( arrays, shapes, fcn ): apply a binary callback to elements in two broadcasted nested input arrays and assign results to elements in a three-dimensional nested output array.bbinary4d( arrays, shapes, fcn ): apply a binary callback to elements in two broadcasted nested input arrays and assign results to elements in a four-dimensional nested output array.bbinary5d( arrays, shapes, fcn ): apply a binary callback to elements in two broadcasted nested input arrays and assign results to elements in a five-dimensional nested output array.bunary2d( arrays, shapes, fcn ): apply a unary callback to elements in a broadcasted nested input array and assign results to elements in a two-dimensional nested output array.bunary3d( arrays, shapes, fcn ): apply a unary callback to elements in a broadcasted nested input array and assign results to elements in a three-dimensional nested output array.bunary4d( arrays, shapes, fcn ): apply a unary callback to elements in a broadcasted nested input array and assign results to elements in a four-dimensional nested output array.bunary5d( arrays, shapes, fcn ): apply a unary callback to elements in a broadcasted nested input array and assign results to elements in a five-dimensional nested output array.cartesianPower( x, n ): return the Cartesian power.cartesianProduct( x1, x2 ): return the Cartesian product.cartesianSquare( x ): return the Cartesian square.copyIndexed( x ): copy the elements of an indexed array-like object to a new "generic" array.copy( x ): copy the elements of an array-like object to a new "generic" array.filledBy( len, clbk[, thisArg] ): create a filled "generic" array according to a provided callback function.filled( value, len ): create a filled "generic" array.filled2dBy( shape, clbk[, thisArg] ): create a filled two-dimensional nested array according to a provided callback function.filled2d( value, shape ): create a filled two-dimensional nested array.filled3dBy( shape, clbk[, thisArg] ): create a filled three-dimensional nested array according to a provided callback function.filled3d( value, shape ): create a filled three-dimensional nested array.filled4dBy( shape, clbk[, thisArg] ): create a filled four-dimensional nested array according to a provided callback function.filled4d( value, shape ): create a filled four-dimensional nested array.filled5dBy( shape, clbk[, thisArg] ): create a filled five-dimensional nested array according to a provided callback function.filled5d( value, shape ): create a filled five-dimensional nested array.filledndBy( shape, clbk[, thisArg] ): create a filled n-dimensional nested array according to a provided callback function.fillednd( value, shape ): create a filled n-dimensional nested array.flattenBy( x, shape, colexicographic, clbk[, thisArg] ): flatten an n-dimensional nested array according to a callback function.flatten( x, shape, colexicographic ): flatten an n-dimensional nested array.flatten2dBy( x, shape, colexicographic, clbk[, thisArg] ): flatten a two-dimensional nested array according to a callback function.flatten2d( x, shape, colexicographic ): flatten a two-dimensional nested array.flatten3dBy( x, shape, colexicographic, clbk[, thisArg] ): flatten a three-dimensional nested array according to a callback function.flatten3d( x, shape, colexicographic ): flatten a three-dimensional nested array.flatten4dBy( x, shape, colexicographic, clbk[, thisArg] ): flatten a four-dimensional nested array according to a callback function.flatten4d( x, shape, colexicographic ): flatten a four-dimensional nested array.flatten5dBy( x, shape, colexicographic, clbk[, thisArg] ): flatten a five-dimensional nested array according to a callback function.flatten5d( x, shape, colexicographic ): flatten a five-dimensional nested array.getter( dtype ): return an accessor function for retrieving an element from an indexed array-like object.incrspace( start, stop, increment ): generate a linearly spaced numeric array according to a provided increment.last( x ): return the last element of an array-like object.linspace( start, stop, length ): generate a linearly spaced numeric array.logspace( a, b, length ): generate a logarithmically spaced numeric array.mskbinary2d( arrays, shape, fcn ): apply a binary callback to elements in two two-dimensional nested input arrays according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.mskunary2d( arrays, shape, fcn ): apply a unary callback to elements in a two-dimensional nested input array according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.mskunary3d( arrays, shape, fcn ): apply a unary callback to elements in a three-dimensional nested input array according to elements in a three-dimensional nested mask array and assign results to elements in a three-dimensional nested output array.nCartesianProduct( x1, x2[, ...xN] ): return the n-fold Cartesian product.oneTo( n ): generate a linearly spaced numeric array whose elements increment by 1 starting from one.ones( len ): create a "generic" array filled with ones.ones2d( shape ): create a two-dimensional nested array filled with ones.ones3d( shape ): create a three-dimensional nested array filled with ones.ones4d( shape ): create a four-dimensional nested array filled with ones.ones5d( shape ): create a five-dimensional nested array filled with ones.onesnd( shape ): create an n-dimensional nested array filled with ones.setter( dtype ): return an accessor function for setting an element in an indexed array-like object.take( x, indices ): take elements from an array.toAccessorArray( arr ): convert an array-like object to a minimal array-like object supporting the accessor protocol.unary2dBy( arrays, shape, fcn, clbk[, thisArg] ): apply a unary function to each element retrieved from a two-dimensional nested input array according to a callback function and assign results to elements in a two-dimensional nested output array.unary2d( arrays, shape, fcn ): apply a unary callback to elements in a two-dimensional nested input array and assign results to elements in a two-dimensional nested output array.unary3d( arrays, shape, fcn ): apply a unary callback to elements in a three-dimensional nested input array and assign results to elements in a three-dimensional nested output array.unary4d( arrays, shape, fcn ): apply a unary callback to elements in a four-dimensional nested input array and assign results to elements in a four-dimensional nested output array.unary5d( arrays, shape, fcn ): apply a unary callback to elements in a five-dimensional nested input array and assign results to elements in a five-dimensional nested output array.unarynd( arrays, shape, fcn ): apply a unary callback to elements in an n-dimensional nested input array and assign results to elements in an n-dimensional nested output array.unitspace( start, stop ): generate a linearly spaced numeric array whose elements increment by 1.zeroTo( n ): generate a linearly spaced numeric array whose elements increment by 1 starting from zero.zeros( len ): create a zero-filled "generic" array.zeros2d( shape ): create a zero-filled two-dimensional nested array.zeros3d( shape ): create a zero-filled three-dimensional nested array.zeros4d( shape ): create a zero-filled four-dimensional nested array.zeros5d( shape ): create a zero-filled five-dimensional nested array.zerosnd( shape ): create a zero-filled n-dimensional nested array.
Examples
var objectKeys = require( '@stdlib/utils-keys' );
var ns = require( '@stdlib/array-base' );
console.log( objectKeys( ns ) );Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2023. The Stdlib Authors.