@stdlib/array-base

Base (i.e., lower-level) array utilities.

https://github.com/stdlib-js/array-base

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary

Keywords

array arrays buffer data javascript matrix namespace ndarray node node-js nodejs ns stdlib structures typed typed-array types vector
Last synced: 6 months ago · JSON representation ·

Repository

Base (i.e., lower-level) array utilities.

Basic Info
Statistics
  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
array arrays buffer data javascript matrix namespace ndarray node node-js nodejs ns stdlib structures typed typed-array types vector
Created about 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

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

NPM version Build Status Coverage Status <!-- dependencies -->

Base (i.e., lower-level) array utilities.

## Installation ```bash npm install @stdlib/array-base ``` Alternatively, - To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm`][esm-url] branch (see [README][esm-readme]). - If you are using Deno, visit the [`deno`][deno-url] branch (see [README][deno-readme] for usage intructions). - For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd`][umd-url] branch (see [README][umd-readme]). The [branches.md][branches-url] file summarizes the available branches and displays a diagram illustrating their relationships. To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
## Usage ```javascript var ns = require( '@stdlib/array-base' ); ``` #### ns Array utilities. ```javascript var o = ns; // returns {...} ``` The namespace exports the following:
- [`accessorGetter( dtype )`][@stdlib/array/base/accessor-getter]: return an accessor function for retrieving an element from an array-like object supporting the get/set protocol. - [`accessorSetter( dtype )`][@stdlib/array/base/accessor-setter]: return an accessor function for setting an element in an array-like object supporting the get/set protocol. - [`AccessorArray( arr )`][@stdlib/array/base/accessor]: create a minimal array-like object supporting the accessor protocol from another array-like object. - [`accessors( x )`][@stdlib/array/base/accessors]: return element accessors for a provided array-like object. - [`anyByRight( x, predicate[, thisArg] )`][@stdlib/array/base/any-by-right]: test whether at least one element in an array passes a test implemented by a predicate function, while iterating from right to left. - [`anyBy( x, predicate[, thisArg] )`][@stdlib/array/base/any-by]: test whether at least one element in an array passes a test implemented by a predicate function. - [`anyHasOwnProp( arr, property )`][@stdlib/array/base/any-has-own-property]: test whether at least one element in a provided array has a specified own property. - [`anyHasProp( arr, property )`][@stdlib/array/base/any-has-property]: test whether at least one element in a provided array has a specified property, either own or inherited. - [`anyIsEntryIn( arr, property, value )`][@stdlib/array/base/any-is-entry-in]: test whether at least one element in a provided array has a specified property key-value pair, either own or inherited. - [`anyIsEntry( arr, property, value )`][@stdlib/array/base/any-is-entry]: test whether at least one element in a provided array has a specified own property key-value pair. - [`any( x )`][@stdlib/array/base/any]: test whether at least one element in an array is truthy. - [`arraylike2object( x )`][@stdlib/array/base/arraylike2object]: convert an array-like object to an object likely to have the same "shape". - [`assert`][@stdlib/array/base/assert]: base array assertion utilities. - [`at( x, index )`][@stdlib/array/base/at]: return an element from an array. - [`at2d( x, i0, i1 )`][@stdlib/array/base/at2d]: return an element from a two-dimensional nested array. - [`at3d( x, i0, i1, i2 )`][@stdlib/array/base/at3d]: return an element from a three-dimensional nested array. - [`at4d( x, i0, i1, i2, i3 )`][@stdlib/array/base/at4d]: return an element from a four-dimensional nested array. - [`at5d( x, i0, i1, i2, i3, i4 )`][@stdlib/array/base/at5d]: return an element from a five-dimensional nested array. - [`atnd( x, i0[, ...indices] )`][@stdlib/array/base/atnd]: return an element from an n-dimensional nested array. - [`banded`][@stdlib/array/base/banded]: banded array utilities. - [`bifurcateEntriesBy( x, predicate[, thisArg] )`][@stdlib/array/base/bifurcate-entries-by]: split element entries into two groups according to a predicate function. - [`bifurcateEntries( x, filter )`][@stdlib/array/base/bifurcate-entries]: split array element entries into two groups. - [`bifurcateIndicesBy( x, predicate[, thisArg] )`][@stdlib/array/base/bifurcate-indices-by]: split element indices into two groups according to a predicate function. - [`bifurcateIndices( x, filter )`][@stdlib/array/base/bifurcate-indices]: split array element indices into two groups. - [`bifurcateValuesBy( x, predicate[, thisArg] )`][@stdlib/array/base/bifurcate-values-by]: split element values into two groups according to a predicate function. - [`bifurcateValues( x, filter )`][@stdlib/array/base/bifurcate-values]: split array element values into two groups. - [`binary2d( arrays, shape, fcn )`][@stdlib/array/base/binary2d]: 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 )`][@stdlib/array/base/binary3d]: 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 )`][@stdlib/array/base/binary4d]: 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 )`][@stdlib/array/base/binary5d]: 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 )`][@stdlib/array/base/binarynd]: 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 )`][@stdlib/array/base/broadcast-array]: broadcast an array to a specified shape. - [`bbinary2d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-binary2d]: 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 )`][@stdlib/array/base/broadcasted-binary3d]: 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 )`][@stdlib/array/base/broadcasted-binary4d]: 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 )`][@stdlib/array/base/broadcasted-binary5d]: apply a binary callback to elements in two broadcasted nested input arrays and assign results to elements in a five-dimensional nested output array. - [`bquaternary2d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-quaternary2d]: apply a quaternary callback to elements in four broadcasted nested input arrays and assign results to elements in a two-dimensional nested output array. - [`bquaternary3d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-quaternary3d]: apply a quaternary callback to elements in four broadcasted input arrays and assign results to elements in a three-dimensional nested output array. - [`bquaternary4d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-quaternary4d]: apply a quaternary callback to elements in four broadcasted input arrays and assign results to elements in a four-dimensional nested output array. - [`bquaternary5d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-quaternary5d]: apply a quaternary callback to elements in four broadcasted input arrays and assign results to elements in a five-dimensional nested output array. - [`bquinary2d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-quinary2d]: apply a quinary callback to elements in five broadcasted nested input arrays and assign results to elements in a two-dimensional nested output array. - [`bquinary4d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-quinary4d]: apply a quinary callback to elements in five broadcasted input arrays and assign results to elements in a four-dimensional nested output array. - [`bternary2d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-ternary2d]: apply a ternary callback to elements in three broadcasted nested input arrays and assign results to elements in a two-dimensional nested output array. - [`bternary3d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-ternary3d]: apply a ternary callback to elements in three broadcasted nested input arrays and assign results to elements in a three-dimensional nested output array. - [`bternary4d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-ternary4d]: apply a ternary callback to elements in three broadcasted nested input arrays and assign results to elements in a four-dimensional nested output array. - [`bternary5d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-ternary5d]: apply a ternary callback to elements in three broadcasted nested input arrays and assign results to elements in a five-dimensional nested output array. - [`bunary2d( arrays, shapes, fcn )`][@stdlib/array/base/broadcasted-unary2d]: 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 )`][@stdlib/array/base/broadcasted-unary3d]: 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 )`][@stdlib/array/base/broadcasted-unary4d]: 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 )`][@stdlib/array/base/broadcasted-unary5d]: 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 )`][@stdlib/array/base/cartesian-power]: return the Cartesian power. - [`cartesianProduct( x1, x2 )`][@stdlib/array/base/cartesian-product]: return the Cartesian product. - [`cartesianSquare( x )`][@stdlib/array/base/cartesian-square]: return the Cartesian square. - [`copyIndexed( x )`][@stdlib/array/base/copy-indexed]: copy the elements of an indexed array-like object to a new "generic" array. - [`copy( x )`][@stdlib/array/base/copy]: copy the elements of an array-like object to a new "generic" array. - [`countFalsy( x )`][@stdlib/array/base/count-falsy]: count the number of falsy elements in an array. - [`countIf( x, predicate[, thisArg] )`][@stdlib/array/base/count-if]: count the number of elements in an array which pass a test implemented by a predicate function. - [`countIfs( x0, predicate0[, x1, predicate1[, x2, predicate2[, ...args]]] )`][@stdlib/array/base/count-ifs]: perform element-wise evaluation of one or more input arrays according to provided predicate functions and count the number of elements for which all predicates respectively return `true`. - [`countSameValueZero( x, value )`][@stdlib/array/base/count-same-value-zero]: count the number of elements in an array that are equal to a specified value. - [`countSameValue( x, value )`][@stdlib/array/base/count-same-value]: count the number of elements in an array that are equal to a specified value. - [`countTruthy( x )`][@stdlib/array/base/count-truthy]: count the number of truthy elements in an array. - [`cuany( x )`][@stdlib/array/base/cuany]: cumulatively test whether at least one element in a provided array is truthy. - [`cuevery( x )`][@stdlib/array/base/cuevery]: cumulatively test whether every element in a provided array is truthy. - [`cunone( x )`][@stdlib/array/base/cunone]: cumulatively test whether every element in a provided array is falsy. - [`dedupe( x, limit, equalNaNs )`][@stdlib/array/base/dedupe]: remove consecutive duplicated values. - [`everyByRight( x, predicate[, thisArg] )`][@stdlib/array/base/every-by-right]: test whether all elements in an array pass a test implemented by a predicate function, iterating from right to left. - [`everyBy( x, predicate[, thisArg] )`][@stdlib/array/base/every-by]: test whether all elements in an array pass a test implemented by a predicate function. - [`every( x )`][@stdlib/array/base/every]: test whether all elements in an array are truthy. - [`fancySliceAssign( x, y, s, strict )`][@stdlib/array/base/fancy-slice-assign]: assign element values from a broadcasted input array to corresponding elements in an output array. - [`fancySlice( x, s, strict )`][@stdlib/array/base/fancy-slice]: return a shallow copy of a portion of an array. - [`fillBy( x, start, end, fcn[, thisArg] )`][@stdlib/array/base/fill-by]: fill all elements within a portion of an array according to a callback function. - [`fill( x, value, start, end )`][@stdlib/array/base/fill]: fill all elements within a portion of an array with a specified value. - [`filledBy( len, clbk[, thisArg] )`][@stdlib/array/base/filled-by]: create a filled "generic" array according to a provided callback function. - [`filled( value, len )`][@stdlib/array/base/filled]: create a filled "generic" array. - [`filled2dBy( shape, clbk[, thisArg] )`][@stdlib/array/base/filled2d-by]: create a filled two-dimensional nested array according to a provided callback function. - [`filled2d( value, shape )`][@stdlib/array/base/filled2d]: create a filled two-dimensional nested array. - [`filled3dBy( shape, clbk[, thisArg] )`][@stdlib/array/base/filled3d-by]: create a filled three-dimensional nested array according to a provided callback function. - [`filled3d( value, shape )`][@stdlib/array/base/filled3d]: create a filled three-dimensional nested array. - [`filled4dBy( shape, clbk[, thisArg] )`][@stdlib/array/base/filled4d-by]: create a filled four-dimensional nested array according to a provided callback function. - [`filled4d( value, shape )`][@stdlib/array/base/filled4d]: create a filled four-dimensional nested array. - [`filled5dBy( shape, clbk[, thisArg] )`][@stdlib/array/base/filled5d-by]: create a filled five-dimensional nested array according to a provided callback function. - [`filled5d( value, shape )`][@stdlib/array/base/filled5d]: create a filled five-dimensional nested array. - [`filledndBy( shape, clbk[, thisArg] )`][@stdlib/array/base/fillednd-by]: create a filled n-dimensional nested array according to a provided callback function. - [`fillednd( value, shape )`][@stdlib/array/base/fillednd]: create a filled n-dimensional nested array. - [`filter( x, predicate[, thisArg] )`][@stdlib/array/base/filter]: return a shallow copy of an array containing only those elements which pass a test implemented by a predicate function. - [`first( x )`][@stdlib/array/base/first]: return the first element of an array-like object. - [`flattenBy( x, shape, colexicographic, clbk[, thisArg] )`][@stdlib/array/base/flatten-by]: flatten an n-dimensional nested array according to a callback function. - [`flatten( x, shape, colexicographic )`][@stdlib/array/base/flatten]: flatten an n-dimensional nested array. - [`flatten2dBy( x, shape, colexicographic, clbk[, thisArg] )`][@stdlib/array/base/flatten2d-by]: flatten a two-dimensional nested array according to a callback function. - [`flatten2d( x, shape, colexicographic )`][@stdlib/array/base/flatten2d]: flatten a two-dimensional nested array. - [`flatten3dBy( x, shape, colexicographic, clbk[, thisArg] )`][@stdlib/array/base/flatten3d-by]: flatten a three-dimensional nested array according to a callback function. - [`flatten3d( x, shape, colexicographic )`][@stdlib/array/base/flatten3d]: flatten a three-dimensional nested array. - [`flatten4dBy( x, shape, colexicographic, clbk[, thisArg] )`][@stdlib/array/base/flatten4d-by]: flatten a four-dimensional nested array according to a callback function. - [`flatten4d( x, shape, colexicographic )`][@stdlib/array/base/flatten4d]: flatten a four-dimensional nested array. - [`flatten5dBy( x, shape, colexicographic, clbk[, thisArg] )`][@stdlib/array/base/flatten5d-by]: flatten a five-dimensional nested array according to a callback function. - [`flatten5d( x, shape, colexicographic )`][@stdlib/array/base/flatten5d]: flatten a five-dimensional nested array. - [`fliplr2d( x )`][@stdlib/array/base/fliplr2d]: reverse the order of elements along the last dimension of a two-dimensional nested input array. - [`fliplr3d( x )`][@stdlib/array/base/fliplr3d]: reverse the order of elements along the last dimension of a three-dimensional nested input array. - [`fliplr4d( x )`][@stdlib/array/base/fliplr4d]: reverse the order of elements along the last dimension of a four-dimensional nested input array. - [`fliplr5d( x )`][@stdlib/array/base/fliplr5d]: reverse the order of elements along the last dimension of a five-dimensional nested input array. - [`flipud2d( x )`][@stdlib/array/base/flipud2d]: reverse the order of elements along the first dimension of a two-dimensional nested input array. - [`flipud3d( x )`][@stdlib/array/base/flipud3d]: reverse the order of elements along the second-to-last dimension of a three-dimensional nested input array. - [`flipud4d( x )`][@stdlib/array/base/flipud4d]: reverse the order of elements along the second-to-last dimension of a four-dimensional nested input array. - [`flipud5d( x )`][@stdlib/array/base/flipud5d]: reverse the order of elements along the second-to-last dimension of a five-dimensional nested input array. - [`strided2array( N, x, stride, offset )`][@stdlib/array/base/from-strided]: convert a strided array to a non-strided generic array. - [`getter( dtype )`][@stdlib/array/base/getter]: return an accessor function for retrieving an element from an indexed array-like object. - [`groupEntriesBy( x, indicator[, thisArg] )`][@stdlib/array/base/group-entries-by]: group element entries according to an indicator function. - [`groupEntries( x, groups )`][@stdlib/array/base/group-entries]: group element entries as arrays associated with distinct keys. - [`groupIndicesBy( x, indicator[, thisArg] )`][@stdlib/array/base/group-indices-by]: group element indices according to an indicator function. - [`groupIndices( x, groups )`][@stdlib/array/base/group-indices]: group element indices as arrays associated with distinct keys. - [`groupValuesBy( x, indicator[, thisArg] )`][@stdlib/array/base/group-values-by]: group element values according to an indicator function. - [`groupValues( x, groups )`][@stdlib/array/base/group-values]: group elements as arrays associated with distinct keys. - [`incrspace( start, stop, increment )`][@stdlib/array/base/incrspace]: generate a linearly spaced numeric array according to a provided increment. - [`indexOfSameValue( x, searchElement, fromIndex )`][@stdlib/array/base/index-of-same-value]: return the index of the first element which equals a provided search element according to the SameValue Algorithm. - [`indexOf( x, searchElement, fromIndex )`][@stdlib/array/base/index-of]: return the index of the first element which equals a provided search element. - [`indicesComplement( N, indices )`][@stdlib/array/base/indices-complement]: return the complement of a list of array indices. - [`join( x, separator )`][@stdlib/array/base/join]: return a string created by joining array elements using a specified separator. - [`lastIndexOfSameValue( x, searchElement, fromIndex )`][@stdlib/array/base/last-index-of-same-value]: return the index of the last element which equals a provided search element according to the SameValue Algorithm. - [`lastIndexOf( x, searchElement, fromIndex )`][@stdlib/array/base/last-index-of]: return the index of the last element which equals a provided search element. - [`last( x )`][@stdlib/array/base/last]: return the last element of an array-like object. - [`linspace( start, stop, length )`][@stdlib/array/base/linspace]: generate a linearly spaced numeric array. - [`linspace2d( start, stop, shape, colexicographic )`][@stdlib/array/base/linspace2d]: generate a linearly spaced two-dimensional nested numeric array. - [`logspace( a, b, length )`][@stdlib/array/base/logspace]: generate a logarithmically spaced numeric array. - [`map2d( x, shape, fcn[, thisArg] )`][@stdlib/array/base/map2d]: apply a function to elements in a two-dimensional nested input array and assign results to elements in a new two-dimensional nested output array. - [`map3d( x, shape, fcn[, thisArg] )`][@stdlib/array/base/map3d]: apply a function to elements in a three-dimensional nested input array and assign results to elements in a new three-dimensional nested output array. - [`map4d( x, shape, fcn[, thisArg] )`][@stdlib/array/base/map4d]: apply a function to elements in a four-dimensional nested input array and assign results to elements in a new four-dimensional nested output array. - [`map5d( x, shape, fcn[, thisArg] )`][@stdlib/array/base/map5d]: apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. - [`minSignedIntegerDataType( value )`][@stdlib/array/base/min-signed-integer-dtype]: determine the minimum array data type for storing a provided signed integer value. - [`minUnsignedIntegerDataType( value )`][@stdlib/array/base/min-unsigned-integer-dtype]: determine the minimum array data type for storing a provided unsigned integer value. - [`mskbinary2d( arrays, shape, fcn )`][@stdlib/array/base/mskbinary2d]: 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. - [`mskbinary3d( arrays, shape, fcn )`][@stdlib/array/base/mskbinary3d]: apply a binary callback to elements in two three-dimensional nested input arrays according to elements in a three-dimensional nested mask array and assign results to elements in a three-dimensional nested output array. - [`mskbinary4d( arrays, shape, fcn )`][@stdlib/array/base/mskbinary4d]: apply a binary callback to elements in two four-dimensional nested input arrays according to elements in a four-dimensional nested mask array and assign results to elements in a four-dimensional nested output array. - [`mskbinary5d( arrays, shape, fcn )`][@stdlib/array/base/mskbinary5d]: apply a binary callback to elements in two five-dimensional nested input arrays according to elements in a five-dimensional nested mask array and assign results to elements in a five-dimensional nested output array. - [`mskfilterMap( x, mask, clbk[, thisArg] )`][@stdlib/array/base/mskfilter-map]: apply a mask and a callback function to a provided input array. - [`mskfilter( x, mask )`][@stdlib/array/base/mskfilter]: apply a mask to a provided input array. - [`mskfilter2( x, y, mask )`][@stdlib/array/base/mskfilter2]: apply a mask to two provided input arrays in a single pass. - [`mskfiltern( x, [...arrays,] mask )`][@stdlib/array/base/mskfiltern]: apply a mask to one or more provided input arrays in a single pass. - [`mskput( x, mask, values, mode )`][@stdlib/array/base/mskput]: replace elements of an array with provided values according to a provided mask array. - [`mskreject( x, mask )`][@stdlib/array/base/mskreject]: apply a mask to a provided input array. - [`mskunary2d( arrays, shape, fcn )`][@stdlib/array/base/mskunary2d]: 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 )`][@stdlib/array/base/mskunary3d]: 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. - [`mskunary4d( arrays, shape, fcn )`][@stdlib/array/base/mskunary4d]: apply a unary callback to elements in a four-dimensional nested input array according to elements in a four-dimensional nested mask array and assign results to elements in a four-dimensional nested output array. - [`mskunary5d( arrays, shape, fcn )`][@stdlib/array/base/mskunary5d]: apply a unary callback to elements in a five-dimensional nested input array according to elements in a five-dimensional nested mask array and assign results to elements in a five-dimensional nested output array. - [`nCartesianProduct( x1, x2[, ...xN] )`][@stdlib/array/base/n-cartesian-product]: return the n-fold Cartesian product. - [`noneByRight( x, predicate[, thisArg] )`][@stdlib/array/base/none-by-right]: test whether all elements in an array fail a test implemented by a predicate function, iterating from right to left. - [`noneBy( x, predicate[, thisArg] )`][@stdlib/array/base/none-by]: test whether all elements in an array fail a test implemented by a predicate function. - [`none( x )`][@stdlib/array/base/none]: test whether all elements in an array are falsy. - [`nulls( len )`][@stdlib/array/base/nulls]: create a "generic" array filled with null values. - [`oneTo( n )`][@stdlib/array/base/one-to]: generate a linearly spaced numeric array whose elements increment by 1 starting from one. - [`ones( len )`][@stdlib/array/base/ones]: create a "generic" array filled with ones. - [`ones2d( shape )`][@stdlib/array/base/ones2d]: create a two-dimensional nested array filled with ones. - [`ones3d( shape )`][@stdlib/array/base/ones3d]: create a three-dimensional nested array filled with ones. - [`ones4d( shape )`][@stdlib/array/base/ones4d]: create a four-dimensional nested array filled with ones. - [`ones5d( shape )`][@stdlib/array/base/ones5d]: create a five-dimensional nested array filled with ones. - [`onesnd( shape )`][@stdlib/array/base/onesnd]: create an n-dimensional nested array filled with ones. - [`place( x, mask, values, mode )`][@stdlib/array/base/place]: replace elements of an array with provided values according to a provided mask array. - [`put( x, indices, values, mode )`][@stdlib/array/base/put]: replace specified elements of an array with provided values. - [`quaternary2d( arrays, shape, fcn )`][@stdlib/array/base/quaternary2d]: apply a quaternary callback to elements in four two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. - [`quaternary3d( arrays, shape, fcn )`][@stdlib/array/base/quaternary3d]: apply a quaternary callback to elements in four three-dimensional nested input arrays and assign results to elements in a three-dimensional nested output array. - [`quaternary4d( arrays, shape, fcn )`][@stdlib/array/base/quaternary4d]: apply a quaternary callback to elements in four four-dimensional nested input arrays and assign results to elements in a four-dimensional nested output array. - [`quaternary5d( arrays, shape, fcn )`][@stdlib/array/base/quaternary5d]: apply a quaternary callback to elements in four five-dimensional nested input arrays and assign results to elements in a five-dimensional nested output array. - [`quinary2d( arrays, shape, fcn )`][@stdlib/array/base/quinary2d]: apply a quinary callback to elements in five two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. - [`quinary3d( arrays, shape, fcn )`][@stdlib/array/base/quinary3d]: apply a quinary callback to elements in five three-dimensional nested input arrays and assign results to elements in a three-dimensional nested output array. - [`quinary4d( arrays, shape, fcn )`][@stdlib/array/base/quinary4d]: apply a quinary callback to elements in five four-dimensional nested input arrays and assign results to elements in a four-dimensional nested output array. - [`quinary5d( arrays, shape, fcn )`][@stdlib/array/base/quinary5d]: apply a quinary callback to elements in five five-dimensional nested input arrays and assign results to elements in a five-dimensional nested output array. - [`reject( x, predicate[, thisArg] )`][@stdlib/array/base/reject]: return a shallow copy of an array containing only those elements which fail a test implemented by a predicate function. - [`removeAt( x, index )`][@stdlib/array/base/remove-at]: remove an element from an array. - [`reshape( x, fromShape, toShape, colexicographic )`][@stdlib/array/base/reshape]: reshape a nested array into another nested array having a desired shape. - [`resolveGetter( x )`][@stdlib/array/base/resolve-getter]: return an accessor function for retrieving an element from an array-like object. - [`resolveSetter( x )`][@stdlib/array/base/resolve-setter]: return an accessor function for setting an element in an array-like object. - [`reverse( x )`][@stdlib/array/base/reverse]: reverse an array in-place. - [`scatterFilled( fill, len, indices, values, mode )`][@stdlib/array/base/scatter-filled]: scatter a list of provided values to specified indices in a new filled "generic" array. - [`scattered( len, indices, values, mode )`][@stdlib/array/base/scattered]: scatter a list of provided values to specified indices in a new zero-filled "generic" array. - [`setter( dtype )`][@stdlib/array/base/setter]: return an accessor function for setting an element in an indexed array-like object. - [`slice( x, start, end )`][@stdlib/array/base/slice]: return a shallow copy of a portion of an array. - [`strided2array2d( x, shape, strides, offset )`][@stdlib/array/base/strided2array2d]: convert a strided array to a two-dimensional nested array. - [`strided2array3d( x, shape, strides, offset )`][@stdlib/array/base/strided2array3d]: convert a strided array to a three-dimensional nested array. - [`strided2array4d( x, shape, strides, offset )`][@stdlib/array/base/strided2array4d]: convert a strided array to a four-dimensional nested array. - [`strided2array5d( x, shape, strides, offset )`][@stdlib/array/base/strided2array5d]: convert a strided array to a five-dimensional nested array. - [`symmetricBanded`][@stdlib/array/base/symmetric-banded]: symmetric banded array utilities. - [`symmetric`][@stdlib/array/base/symmetric]: symmetric array utilities. - [`takeIndexed( x, indices )`][@stdlib/array/base/take-indexed]: take elements from an indexed array. - [`takeIndexed2( x, y, indices )`][@stdlib/array/base/take-indexed2]: take elements from two indexed arrays in a single pass. - [`take( x, indices, mode )`][@stdlib/array/base/take]: take elements from an array. - [`take2d( x, indices, dimension, mode )`][@stdlib/array/base/take2d]: take elements from a two-dimensional nested array. - [`take3d( x, indices, dimension, mode )`][@stdlib/array/base/take3d]: take elements from a three-dimensional nested array. - [`ternary2d( arrays, shape, fcn )`][@stdlib/array/base/ternary2d]: apply a ternary callback to elements in three two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. - [`ternary3d( arrays, shape, fcn )`][@stdlib/array/base/ternary3d]: apply a ternary callback to elements in three three-dimensional nested input arrays and assign results to elements in a three-dimensional nested output array. - [`ternary4d( arrays, shape, fcn )`][@stdlib/array/base/ternary4d]: apply a ternary callback to elements in three four-dimensional nested input arrays and assign results to elements in a four-dimensional nested output array. - [`ternary5d( arrays, shape, fcn )`][@stdlib/array/base/ternary5d]: apply a ternary callback to elements in three five-dimensional nested input arrays and assign results to elements in a five-dimensional nested output array. - [`toAccessorArray( arr )`][@stdlib/array/base/to-accessor-array]: convert an array-like object to a minimal array-like object supporting the accessor protocol. - [`toDeduped( x, limit, equalNaNs )`][@stdlib/array/base/to-deduped]: copy elements to a new "generic" array after removing consecutive duplicated values. - [`toReversed( x )`][@stdlib/array/base/to-reversed]: return a new array with elements in reverse order. - [`unary2dBy( arrays, shape, fcn, clbk[, thisArg] )`][@stdlib/array/base/unary2d-by]: 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 )`][@stdlib/array/base/unary2d]: 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. - [`unary3dBy( arrays, shape, fcn, clbk[, thisArg] )`][@stdlib/array/base/unary3d-by]: apply a unary function to each element retrieved from a three-dimensional nested input array according to a callback function and assign results to elements in a three-dimensional nested output array. - [`unary3d( arrays, shape, fcn )`][@stdlib/array/base/unary3d]: 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. - [`unary4dBy( arrays, shape, fcn, clbk[, thisArg] )`][@stdlib/array/base/unary4d-by]: apply a unary function to each element retrieved from a four-dimensional nested input array according to a callback function and assign results to elements in a four-dimensional nested output array. - [`unary4d( arrays, shape, fcn )`][@stdlib/array/base/unary4d]: 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. - [`unary5dBy( arrays, shape, fcn, clbk[, thisArg] )`][@stdlib/array/base/unary5d-by]: apply a unary function to each element retrieved from a five-dimensional nested input array according to a callback function and assign results to elements in a five-dimensional nested output array. - [`unary5d( arrays, shape, fcn )`][@stdlib/array/base/unary5d]: 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 )`][@stdlib/array/base/unarynd]: 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 )`][@stdlib/array/base/unitspace]: generate a linearly spaced numeric array whose elements increment by 1. - [`where( condition, x, y )`][@stdlib/array/base/where]: take elements from either one of two arrays depending on a condition. - [`arrayWith( x, index, value )`][@stdlib/array/base/with]: return a new array with the element at the specified index replaced with a provided value. - [`without( x, index )`][@stdlib/array/base/without]: return a new array containing every element from an input array, except for the element at a specified index. - [`zeroTo( n )`][@stdlib/array/base/zero-to]: generate a linearly spaced numeric array whose elements increment by 1 starting from zero. - [`zeros( len )`][@stdlib/array/base/zeros]: create a zero-filled "generic" array. - [`zeros2d( shape )`][@stdlib/array/base/zeros2d]: create a zero-filled two-dimensional nested array. - [`zeros3d( shape )`][@stdlib/array/base/zeros3d]: create a zero-filled three-dimensional nested array. - [`zeros4d( shape )`][@stdlib/array/base/zeros4d]: create a zero-filled four-dimensional nested array. - [`zeros5d( shape )`][@stdlib/array/base/zeros5d]: create a zero-filled five-dimensional nested array. - [`zerosnd( shape )`][@stdlib/array/base/zerosnd]: create a zero-filled n-dimensional nested array.
## Examples ```javascript var randu = require( '@stdlib/random-base-randu' ); var ns = require( '@stdlib/array-base' ); // Create a zero-filled array: var zeros = ns.zeros( 5 ); // returns [ 0, 0, 0, 0, 0 ] // Create an array filled with a specific value: var filled = ns.filled( 7, 4 ); // returns [ 7, 7, 7, 7 ] // Create a linearly spaced array: var linear = ns.linspace( 0, 1, 5 ); // returns [ 0, 0.25, 0.5, 0.75, 1 ] // Create a two-dimensional array: var arr2d = ns.ones2d( [ 2, 3 ] ); // returns [ [ 1, 1, 1 ], [ 1, 1, 1 ] ] // Map a function over a 2D array: var squared = ns.map2d( arr2d, [ 2, 3 ], randu ); // e.g., returns [ [ ~0.123, ~0.789, ~0.456 ], [ ~0.321, ~0.654, ~0.987 ] ] ```
* * * ## Notice This package is part of [stdlib][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][stdlib], see the main project [repository][stdlib]. #### Community [![Chat][chat-image]][chat-url] --- ## License See [LICENSE][stdlib-license]. ## Copyright Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors].

Owner

  • Name: stdlib
  • Login: stdlib-js
  • Kind: organization

Standard library for JavaScript.

Citation (CITATION.cff)

cff-version: 1.2.0
title: stdlib
message: >-
  If you use this software, please cite it using the
  metadata from this file.

type: software

authors:
  - name: The Stdlib Authors
    url: https://github.com/stdlib-js/stdlib/graphs/contributors

repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io

abstract: |
  Standard library for JavaScript and Node.js.

keywords:
  - JavaScript
  - Node.js
  - TypeScript
  - standard library
  - scientific computing
  - numerical computing
  - statistical computing

license: Apache-2.0 AND BSL-1.0

date-released: 2016

GitHub Events

Total
  • Push event: 58
Last Year
  • Push event: 58

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 205
  • Total Committers: 1
  • Avg Commits per committer: 205.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 164
  • Committers: 1
  • Avg Commits per committer: 164.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
stdlib-bot n****y@s****o 205
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • npm 10 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 4
npmjs.org: @stdlib/array-base

Base (i.e., lower-level) array utilities.

  • Homepage: https://stdlib.io
  • License: Apache-2.0
  • Latest release: 0.3.0
    published over 1 year ago
  • Versions: 5
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 10 Last month
Rankings
Stargazers count: 15.5%
Dependent packages count: 16.2%
Forks count: 17.4%
Average: 25.1%
Dependent repos count: 25.3%
Downloads: 51.2%
Funding
  • type: opencollective
  • url: https://opencollective.com/stdlib
Last synced: 6 months ago

Dependencies

package.json npm
  • @stdlib/array-complex64 ^0.0.x development
  • @stdlib/array-float64 ^0.0.x development
  • @stdlib/assert-is-array ^0.0.x development
  • @stdlib/assert-is-collection ^0.0.x development
  • @stdlib/assert-is-complex64 ^0.0.x development
  • @stdlib/bench ^0.0.x development
  • @stdlib/blas-base-gscal ^0.0.x development
  • @stdlib/blas-ext-base-gfill ^0.0.x development
  • @stdlib/blas-ext-base-gsort2hp ^0.0.x development
  • @stdlib/boolean-ctor ^0.0.x development
  • @stdlib/complex-float32 ^0.0.x development
  • @stdlib/complex-imagf ^0.0.x development
  • @stdlib/complex-realf ^0.0.x development
  • @stdlib/math-base-special-ceil ^0.0.x development
  • @stdlib/math-base-special-pow ^0.0.x development
  • @stdlib/random-base-randu ^0.0.x development
  • @stdlib/utils-constant-function ^0.0.x development
  • @stdlib/utils-keys ^0.0.x development
  • istanbul ^0.4.1 development
  • tap-spec 5.x.x development
  • tape git+https://github.com/kgryte/tape.git#fix/globby development
  • @stdlib/array-base-arraylike2object ^0.0.x
  • @stdlib/array-base-copy ^0.0.x
  • @stdlib/array-base-filled ^0.0.x
  • @stdlib/array-base-filled-by ^0.0.x
  • @stdlib/array-base-incrspace ^0.0.x
  • @stdlib/array-base-linspace ^0.0.x
  • @stdlib/array-base-logspace ^0.0.x
  • @stdlib/array-base-ones ^0.0.x
  • @stdlib/array-base-unitspace ^0.0.x
  • @stdlib/array-base-zeros ^0.0.x
  • @stdlib/utils-define-read-only-property ^0.0.x
.github/workflows/benchmark.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/cancel.yml actions
  • styfle/cancel-workflow-action 0.11.0 composite
.github/workflows/close_pull_requests.yml actions
  • superbrothers/close-pull-request v3 composite
.github/workflows/examples.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/npm_downloads.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • actions/upload-artifact v3 composite
  • distributhor/workflow-webhook v3 composite
.github/workflows/productionize.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • stdlib-js/bundle-action main composite
  • stdlib-js/transform-errors-action main composite
.github/workflows/publish.yml actions
  • JS-DevTools/npm-publish v1 composite
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • styfle/cancel-workflow-action 0.11.0 composite
.github/workflows/test.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/test_bundles.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • denoland/setup-deno v1 composite
.github/workflows/test_coverage.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • codecov/codecov-action v3 composite
  • distributhor/workflow-webhook v3 composite
.github/workflows/test_install.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite