diff --git a/base/assert/docs/types/index.d.ts b/base/assert/docs/types/index.d.ts index 9f143e71..6a38f909 100644 --- a/base/assert/docs/types/index.d.ts +++ b/base/assert/docs/types/index.d.ts @@ -21,7 +21,10 @@ /* eslint-disable max-lines */ import contains = require( './../../../../base/assert/contains' ); +import hasSameValues = require( './../../../../base/assert/has-same-values' ); import isAccessorArray = require( './../../../../base/assert/is-accessor-array' ); +import isComplex64Array = require( './../../../../base/assert/is-complex64array' ); +import isComplex128Array = require( './../../../../base/assert/is-complex128array' ); /** * Interface describing the `assert` namespace. @@ -51,6 +54,26 @@ interface Namespace { */ contains: typeof contains; + /** + * Tests if two arrays have the same values. + * + * ## Notes + * + * - If provided arrays of unequal length, the function returns `false`. + * + * @param x - first input array + * @param y - second input array + * @returns boolean indicating whether both arrays have the same values + * + * @example + * var x = [ 0, 0, 1, 0 ]; + * var y = [ 0, 0, 1, 0 ]; + * + * var out = ns.hasSameValues( x, y ); + * // returns true + */ + hasSameValues: typeof hasSameValues; + /** * Tests if an array-like object supports the accessor (get/set) protocol. * @@ -69,6 +92,44 @@ interface Namespace { * // returns false */ isAccessorArray: typeof isAccessorArray; + + /** + * Tests if a value is a `Complex64Array`. + * + * @param value - value to test + * @returns boolean indicating whether a value is a `Complex64Array` + * + * @example + * var Complex64Array = require( './../../../../complex64' ); + * + * var arr = new Complex64Array( 10 ); + * var bool = ns.isComplex64Array( arr ); + * // returns true + * + * @example + * var bool = ns.isComplex64Array( [] ); + * // returns false + */ + isComplex64Array: typeof isComplex64Array; + + /** + * Tests if a value is a `Complex128Array`. + * + * @param value - value to test + * @returns boolean indicating whether a value is a `Complex128Array` + * + * @example + * var Complex128Array = require( './../../../../complex128' ); + * + * var arr = new Complex128Array( 10 ); + * var bool = ns.isComplex128Array( arr ); + * // returns true + * + * @example + * var bool = ns.isComplex128Array( [] ); + * // returns false + */ + isComplex128Array: typeof isComplex128Array; } /** diff --git a/base/docs/types/index.d.ts b/base/docs/types/index.d.ts index 70446a97..a039f072 100644 --- a/base/docs/types/index.d.ts +++ b/base/docs/types/index.d.ts @@ -24,8 +24,17 @@ import AccessorArray = require( './../../../base/accessor' ); import accessorGetter = require( './../../../base/accessor-getter' ); import accessorSetter = require( './../../../base/accessor-setter' ); import accessors = require( './../../../base/accessors' ); +import any = require( './../../../base/any' ); +import anyBy = require( './../../../base/any-by' ); +import anyByRight = require( './../../../base/any-by-right' ); import arraylike2object = require( './../../../base/arraylike2object' ); import assert = require( './../../../base/assert' ); +import at = require( './../../../base/at' ); +import at2d = require( './../../../base/at2d' ); +import at3d = require( './../../../base/at3d' ); +import at4d = require( './../../../base/at4d' ); +import at5d = require( './../../../base/at5d' ); +import atnd = require( './../../../base/atnd' ); import bifurcateEntries = require( './../../../base/bifurcate-entries' ); import bifurcateEntriesBy = require( './../../../base/bifurcate-entries-by' ); import bifurcateIndices = require( './../../../base/bifurcate-indices' ); @@ -55,6 +64,9 @@ import cartesianSquare = require( './../../../base/cartesian-square' ); import copy = require( './../../../base/copy' ); import copyIndexed = require( './../../../base/copy-indexed' ); import dedupe = require( './../../../base/dedupe' ); +import every = require( './../../../base/every' ); +import everyBy = require( './../../../base/every-by' ); +import everyByRight = require( './../../../base/every-by-right' ); import filled = require( './../../../base/filled' ); import filledBy = require( './../../../base/filled-by' ); import filled2d = require( './../../../base/filled2d' ); @@ -67,6 +79,7 @@ import filled5d = require( './../../../base/filled5d' ); import filled5dBy = require( './../../../base/filled5d-by' ); import fillednd = require( './../../../base/fillednd' ); import filledndBy = require( './../../../base/fillednd-by' ); +import filter = require( './../../../base/filter' ); import first = require( './../../../base/first' ); import flatten = require( './../../../base/flatten' ); import flattenBy = require( './../../../base/flatten-by' ); @@ -105,9 +118,13 @@ import map3d = require( './../../../base/map3d' ); import map4d = require( './../../../base/map4d' ); import map5d = require( './../../../base/map5d' ); import mskbinary2d = require( './../../../base/mskbinary2d' ); +import mskfilter = require( './../../../base/mskfilter' ); import mskunary2d = require( './../../../base/mskunary2d' ); import mskunary3d = require( './../../../base/mskunary3d' ); import nCartesianProduct = require( './../../../base/n-cartesian-product' ); +import none = require( './../../../base/none' ); +import noneBy = require( './../../../base/none-by' ); +import noneByRight = require( './../../../base/none-by-right' ); import oneTo = require( './../../../base/one-to' ); import ones = require( './../../../base/ones' ); import ones2d = require( './../../../base/ones2d' ); @@ -124,6 +141,8 @@ import quinary3d = require( './../../../base/quinary3d' ); import quinary4d = require( './../../../base/quinary4d' ); import quinary5d = require( './../../../base/quinary5d' ); import resolveGetter = require( './../../../base/resolve-getter' ); +import resolveSetter = require( './../../../base/resolve-setter' ); +import reverse = require( './../../../base/reverse' ); import setter = require( './../../../base/setter' ); import slice = require( './../../../base/slice' ); import strided2array2d = require( './../../../base/strided2array2d' ); @@ -140,6 +159,7 @@ import ternary4d = require( './../../../base/ternary4d' ); import ternary5d = require( './../../../base/ternary5d' ); import toAccessorArray = require( './../../../base/to-accessor-array' ); import toDeduped = require( './../../../base/to-deduped' ); +import toReversed = require( './../../../base/to-reversed' ); import unary2d = require( './../../../base/unary2d' ); import unary2dBy = require( './../../../base/unary2d-by' ); import unary3d = require( './../../../base/unary3d' ); @@ -260,6 +280,75 @@ interface Namespace { */ accessors: typeof accessors; + /** + * Tests whether at least one element in an array is truthy. + * + * ## Notes + * + * - The function immediately returns upon encountering a truthy value. + * - If provided an empty collection, the function returns `false`. + * + * @param x - input array + * @returns boolean indicating whether at least one element is truthy + * + * @example + * var x = [ 0, 0, 1, 0 ]; + * + * var out = ns.any( x ); + * // returns true + */ + any: typeof any; + + /** + * Tests whether at least one element in an array passes a test implemented by a predicate function. + * + * ## Notes + * + * - The function immediately returns upon encountering a truthy return value. + * - If provided an empty collection, the function returns `false`. + * + * @param x - input array + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns boolean indicating whether all elements pass a test + * + * @example + * function isPositive( v ) { + * return v > 0; + * } + * + * var x = [ 0, 0, 1, 0 ]; + * + * var out = ns.anyBy( x, isPositive ); + * // returns true + */ + anyBy: typeof anyBy; + + /** + * Tests whether at least one element in an array passes a test implemented by a predicate function, while iterating from right to left. + * + * ## Notes + * + * - The function immediately returns upon encountering a truthy return value. + * - If provided an empty collection, the function returns `false`. + * + * @param x - input array + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns boolean indicating whether all elements pass a test + * + * @example + * function isPositive( v ) { + * return v > 0; + * } + * + * var x = [ 0, 0, 1, 0 ]; + * + * var out = ns.anyByRight( x, isPositive ); + * // returns true + */ + anyByRight: typeof anyByRight; + /** * Converts a one-dimensional array-like object to an object likely to have the same "shape". * @@ -297,6 +386,143 @@ interface Namespace { */ assert: typeof assert; + /** + * Returns an element from an array. + * + * @param x - input array + * @param index - element index + * @returns array element + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var v = ns.at( x, 0 ); + * // returns 1 + * + * v = ns.at( x, 1 ); + * // returns 2 + * + * v = ns.at( x, -2 ); + * // returns 3 + */ + at: typeof at; + + /** + * Returns an element from a two-dimensional nested array. + * + * @param x - input array + * @param i0 - first dimension index + * @param i1 - second dimension index + * @returns nested array element + * + * @example + * var x = [ [ 1, 2 ], [ 3, 4 ] ]; + * + * var v = ns.at2d( x, 0, 1 ); + * // returns 2 + * + * v = ns.at2d( x, 1, 0 ); + * // returns 3 + * + * v = ns.at2d( x, -2, -2 ); + * // returns 1 + */ + at2d: typeof at2d; + + /** + * Returns an element from a three-dimensional nested array. + * + * @param x - input array + * @param i0 - first dimension index + * @param i1 - second dimension index + * @param i2 - third dimension index + * @returns nested array element + * + * @example + * var x = [ [ [ 1, 2 ], [ 3, 4 ] ] ]; + * + * var v = ns.at3d( x, 0, 0, 1 ); + * // returns 2 + * + * v = ns.at3d( x, 0, 1, 0 ); + * // returns 3 + * + * v = ns.at3d( x, -1, -2, -2 ); + * // returns 1 + */ + at3d: typeof at3d; + + /** + * Returns an element from a four-dimensional nested array. + * + * @param x - input array + * @param i0 - first dimension index + * @param i1 - second dimension index + * @param i2 - third dimension index + * @param i3 - fourth dimension index + * @returns nested array element + * + * @example + * var x = [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ]; + * + * var v = ns.at4d( x, 0, 0, 0, 1 ); + * // returns 2 + * + * v = ns.at4d( x, 0, 0, 1, 0 ); + * // returns 3 + * + * v = ns.at4d( x, -1, -1, -2, -2 ); + * // returns 1 + */ + at4d: typeof at4d; + + /** + * Returns an element from a five-dimensional nested array. + * + * @param x - input array + * @param i0 - first dimension index + * @param i1 - second dimension index + * @param i2 - third dimension index + * @param i3 - fourth dimension index + * @param i4 - fifth dimension index + * @returns nested array element + * + * @example + * var x = [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ]; + * + * var v = ns.at5d( x, 0, 0, 0, 0, 1 ); + * // returns 2 + * + * v = ns.at5d( x, 0, 0, 0, 1, 0 ); + * // returns 3 + * + * v = ns.at5d( x, -1, -1, -1, -2, -2 ); + * // returns 1 + */ + at5d: typeof at5d; + + /** + * Returns an element from an n-dimensional nested array. + * + * @param x - input array + * @param i0 - first dimension index + * @param indices - dimension indices + * @returns nested array element + * + * @example + * var x = [ [ 1, 2 ], [ 3, 4 ] ]; + * + * var v = ns.atnd( x, 0, 1 ); + * // returns 2 + * + * v = ns.atnd( x, 1, 0 ); + * // returns 3 + * + * v = ns.atnd( x, -2, -2 ); + * // returns 1 + */ + atnd: typeof atnd; + /** * Splits array element entries into two groups. * @@ -1124,6 +1350,75 @@ interface Namespace { */ dedupe: typeof dedupe; + /** + * Tests whether all elements in an array are truthy. + * + * ## Notes + * + * - The function immediately returns upon encountering a non-truthy value. + * - If provided an empty collection, the function returns `true`. + * + * @param x - input array + * @returns boolean indicating whether all elements are truthy + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var out = ns.every( x ); + * // returns true + */ + every: typeof every; + + /** + * Tests whether all elements in an array pass a test implemented by a predicate function. + * + * ## Notes + * + * - The function immediately returns upon encountering a non-truthy return value. + * - If provided an empty collection, the function returns `true`. + * + * @param x - input array + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns boolean indicating whether all elements pass a test + * + * @example + * function isPositive( v ) { + * return v > 0; + * } + * + * var x = [ 1, 2, 3, 4 ]; + * + * var out = ns.everyBy( x, isPositive ); + * // returns true + */ + everyBy: typeof everyBy; + + /** + * Tests whether all elements in an array pass a test implemented by a predicate function, iterating from right to left. + * + * ## Notes + * + * - The function immediately returns upon encountering a non-truthy return value. + * - If provided an empty collection, the function returns `true`. + * + * @param x - input array + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns boolean indicating whether all elements pass a test + * + * @example + * function isPositive( v ) { + * return v > 0; + * } + * + * var x = [ 1, 2, 3, 4 ]; + * + * var out = ns.everyByRight( x, isPositive ); + * // returns true + */ + everyByRight: typeof everyByRight; + /** * Returns a filled "generic" array. * @@ -1322,6 +1617,22 @@ interface Namespace { */ filledndBy: typeof filledndBy; + /** + * Returns a shallow copy of an array containing only those elements which pass a test implemented by a predicate function. + * + * @param x - input array + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns output array + * + * @example + * var x = [ 1, -2, -3, 4 ]; + * + * var out = ns.filter( x, isPositiveNumber ); + * // returns [ 1, 4 ] + */ + filter: typeof filter; + /** * Returns the first element of an array-like object. * @@ -2283,6 +2594,21 @@ interface Namespace { */ mskbinary2d: typeof mskbinary2d; + /** + * Returns a new array by applying a mask to a provided input array. + * + * @param x - input array + * @param mask - mask array + * @returns output array + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var y = ns.mskfilter( x, [ 0, 1, 0, 1 ] ); + * // returns [ 2, 4 ] + */ + mskfilter: typeof mskfilter; + /** * Applies a unary callback to elements in a two-dimensional nested input array according to elements in a two-dimensional nested mask array and assigns results to elements in a two-dimensional nested output array. * @@ -2372,6 +2698,75 @@ interface Namespace { */ nCartesianProduct: typeof nCartesianProduct; + /** + * Tests whether all elements in an array are falsy. + * + * ## Notes + * + * - The function immediately returns upon encountering a truthy value. + * - If provided an empty collection, the function returns `true`. + * + * @param x - input array + * @returns boolean indicating whether all elements are falsy + * + * @example + * var x = [ 0, 0, 0, 0 ]; + * + * var out = ns.none( x ); + * // returns true + */ + none: typeof none; + + /** + * Tests whether all elements in an array fail a test implemented by a predicate function. + * + * ## Notes + * + * - The function immediately returns upon encountering a truthy return value. + * - If provided an empty collection, the function returns `true`. + * + * @param x - input array + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns boolean indicating whether all elements fail a test + * + * @example + * function isPositive( v ) { + * return v > 0; + * } + * + * var x = [ 0, 0, 0, 0 ]; + * + * var out = ns.noneBy( x, isPositive ); + * // returns true + */ + noneBy: typeof noneBy; + + /** + * Tests whether all elements in an array fail a test implemented by a predicate function, iterating from right to left. + * + * ## Notes + * + * - The function immediately returns upon encountering a truthy return value. + * - If provided an empty collection, the function returns `true`. + * + * @param x - input array + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns boolean indicating whether all elements fail a test + * + * @example + * function isPositive( v ) { + * return v > 0; + * } + * + * var x = [ 0, 0, 0, 0 ]; + * + * var out = ns.noneByRight( x, isPositive ); + * // returns true + */ + noneByRight: typeof noneByRight; + /** * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. * @@ -2381,6 +2776,18 @@ interface Namespace { * @example * var arr = ns.oneTo( 6 ); * // returns [ 1, 2, 3, 4, 5, 6 ] + * + * @example + * var out = [ 0, 0, 0, 0, 0, 0 ]; + * + * var arr = ns.oneTo.assign( out, 1, 0 ); + * // returns [ 1, 2, 3, 4, 5, 6 ] + * + * @example + * var out = [ 0, 0, 0, 0, 0, 0 ]; + * + * var arr = ns.oneTo.assign( out, -1, out.length-1 ); + * // returns [ 6, 5, 4, 3, 2, 1 ] */ oneTo: typeof oneTo; @@ -2723,6 +3130,40 @@ interface Namespace { */ resolveGetter: typeof resolveGetter; + /** + * Returns an accessor function for setting an element in an indexed array-like object. + * + * @param x - input array + * @returns accessor function + * + * @example + * var resolveGetter = require( './../../../base/resolve-getter' ); + * + * var arr = [ 1, 2, 3, 4 ]; + * + * var set = ns.resolveSetter( arr ); + * set( arr, 2, 10 ); + * + * var get = resolveGetter( arr ); + * var v = get( arr, 2 ); + * // returns 10 + */ + resolveSetter: typeof resolveSetter; + + /** + * Reverses an array in-place. + * + * @param x - input array + * @returns input array + * + * @example + * var x = [ 1, 2, 3 ]; + * + * var out = ns.reverse( x ); + * // returns [ 3, 2, 1 ] + */ + reverse: typeof reverse; + /** * Returns an accessor function for setting an element in an indexed array-like object. * @@ -3121,6 +3562,31 @@ interface Namespace { */ toDeduped: typeof toDeduped; + /** + * Returns a new array with elements in reverse order. + * + * @param x - input array + * @returns output array + * + * @example + * var toAccessorArray = require( './../../../base/to-accessor-array' ); + * + * var x = toAccessorArray( [ 1, 2, 3 ] ); + * + * var v = x.get( 0 ); + * // returns 1 + * + * var out = ns.toReversed( x ); + * // returns [ 3, 2, 1 ] + * + * @example + * var x = [ 1, 2, 3 ]; + * + * var out = ns.toReversed( x ); + * // returns [ 3, 2, 1 ] + */ + toReversed: typeof toReversed; + /** * Applies a unary callback to elements in a two-dimensional nested input array and assigns results to elements in a two-dimensional nested output array. * @@ -3335,6 +3801,18 @@ interface Namespace { * @example * var arr = ns.zeroTo( 6 ); * // returns [ 0, 1, 2, 3, 4, 5 ] + * + * @example + * var out = [ 0, 0, 0, 0, 0, 0 ]; + * + * var arr = ns.zeroTo.assign( out, 1, 0 ); + * // returns [ 0, 1, 2, 3, 4, 5 ] + * + * @example + * var out = [ 0, 0, 0, 0, 0, 0 ]; + * + * var arr = ns.zeroTo.assign( out, -1, out.length-1 ); + * // returns [ 5, 4, 3, 2, 1, 0 ] */ zeroTo: typeof zeroTo; diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index af3c2914..0d55880d 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -22,6 +22,9 @@ import base = require( './../../base' ); import ArrayBuffer = require( './../../buffer' ); +import acartesianPower = require( './../../cartesian-power' ); +import acartesianProduct = require( './../../cartesian-product' ); +import acartesianSquare = require( './../../cartesian-square' ); import Complex64Array = require( './../../complex64' ); import Complex128Array = require( './../../complex128' ); import convertArray = require( './../../convert' ); @@ -51,6 +54,8 @@ import arrayMinDataType = require( './../../min-dtype' ); import anans = require( './../../nans' ); import anansLike = require( './../../nans-like' ); import arrayNextDataType = require( './../../next-dtype' ); +import aoneTo = require( './../../one-to' ); +import aoneToLike = require( './../../one-to-like' ); import aones = require( './../../ones' ); import aonesLike = require( './../../ones-like' ); import typedarraypool = require( './../../pool' ); @@ -60,6 +65,7 @@ import arraySafeCasts = require( './../../safe-casts' ); import arraySameKindCasts = require( './../../same-kind-casts' ); import arrayShape = require( './../../shape' ); import SharedArrayBuffer = require( './../../shared-buffer' ); +import aslice = require( './../../slice' ); import circarray2iterator = require( './../../to-circular-iterator' ); import array2iterator = require( './../../to-iterator' ); import array2iteratorRight = require( './../../to-iterator-right' ); @@ -92,6 +98,8 @@ import Uint8Array = require( './../../uint8' ); import Uint8ClampedArray = require( './../../uint8c' ); import Uint16Array = require( './../../uint16' ); import Uint32Array = require( './../../uint32' ); +import azeroTo = require( './../../zero-to' ); +import azeroToLike = require( './../../zero-to-like' ); import azeros = require( './../../zeros' ); import azerosLike = require( './../../zeros-like' ); import constants = require( '@stdlib/constants/array' ); @@ -110,6 +118,64 @@ interface Namespace { */ ArrayBuffer: typeof ArrayBuffer; + /** + * Returns the Cartesian power. + * + * ## Notes + * + * - If provided an empty array, the function returns an empty array. + * - If `n` is less than or equal to zero, the function returns an empty array. + * + * @param x - input array + * @param n - power + * @returns Cartesian product + * + * @example + * var x = [ 1, 2 ]; + * + * var out = ns.acartesianPower( x, 2 ); + * // returns [ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 2, 2 ] ] + */ + acartesianPower: typeof acartesianPower; + + /** + * Returns the Cartesian product. + * + * ## Notes + * + * - If provided one or more empty arrays, the function returns an empty array. + * + * @param x1 - first input array + * @param x2 - second input array + * @returns Cartesian product + * + * @example + * var x1 = [ 1, 2, 3 ]; + * var x2 = [ 4, 5 ]; + * + * var out = ns.acartesianProduct( x1, x2 ); + * // returns [ [ 1, 4 ], [ 1, 5 ], [ 2, 4 ], [ 2, 5 ], [ 3, 4 ], [ 3, 5 ] ] + */ + acartesianProduct: typeof acartesianProduct; + + /** + * Returns the Cartesian square. + * + * ## Notes + * + * - If provided an empty array, the function returns an empty array. + * + * @param x - input array + * @returns Cartesian product + * + * @example + * var x = [ 1, 2 ]; + * + * var out = ns.acartesianSquare( x ); + * // returns [ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 2, 2 ] ] + */ + acartesianSquare: typeof acartesianSquare; + /** * 64-bit complex number array constructor. * @@ -812,6 +878,41 @@ interface Namespace { */ arrayNextDataType: typeof arrayNextDataType; + /** + * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. + * + * @param n - number of elements + * @param dtype - data type (default: 'float64') + * @returns linearly spaced numeric array + * + * @example + * var arr = ns.aoneTo( 2 ); + * // returns [ 1.0, 2.0 ] + * + * @example + * var arr = ns.aoneTo( 2, 'float32' ); + * // returns [ 1.0, 2.0 ] + */ + aoneTo: typeof aoneTo; + + /** + * Generates a linearly spaced numeric array whose elements increment by 1 starting from one and having the same length and data type as a provided input array. + * + * @param x - input array from which to derive the output array length + * @param dtype - data type + * @returns linearly spaced numeric array + * + * @example + * var zeros = require( './../../zeros' ); + * + * var x = zeros( 2, 'float32' ); + * // returns [ 0.0, 0.0 ] + * + * var y = ns.aoneToLike( x ); + * // returns [ 1.0, 2.0 ] + */ + aoneToLike: typeof aoneToLike; + /** * Creates an array filled with ones and having a specified length. * @@ -1025,6 +1126,28 @@ interface Namespace { */ SharedArrayBuffer: typeof SharedArrayBuffer; + /** + * Returns a shallow copy of a portion of an array. + * + * @param x - input array + * @param start - starting index (inclusive) + * @param end - ending index (exclusive) + * @returns output array + * + * @example + * var x = [ 1, 2, 3, 4, 5, 6 ]; + * + * var out = ns.aslice( x ); + * // returns [ 1, 2, 3 ] + * + * @example + * var x = [ 1, 2, 3, 4, 5, 6 ]; + * + * var out = ns.aslice( x, 0, 2 ); + * // returns [ 1, 2 ] + */ + aslice: typeof aslice; + /** * Returns an iterator which repeatedly iterates over each element in an array-like object. * @@ -1571,6 +1694,41 @@ interface Namespace { */ Uint32Array: typeof Uint32Array; + /** + * Generates a linearly spaced numeric array whose elements increment by 1 starting from zero. + * + * @param n - number of elements + * @param dtype - data type (default: 'float64') + * @returns linearly spaced numeric array + * + * @example + * var arr = ns.azeroTo( 2 ); + * // returns [ 0.0, 1.0 ] + * + * @example + * var arr = ns.azeroTo( 2, 'float32' ); + * // returns [ 0.0, 1.0 ] + */ + azeroTo: typeof azeroTo; + + /** + * Generates a linearly spaced numeric array whose elements increment by 1 starting from zero and having the same length and data type as a provided input array. + * + * @param x - input array from which to derive the output array length + * @param dtype - data type + * @returns linearly spaced numeric array + * + * @example + * var zeros = require( './../../zeros' ); + * + * var x = zeros( 2, 'float32' ); + * // returns [ 0.0, 0.0 ] + * + * var y = ns.azeroToLike( x ); + * // returns [ 0.0, 1.0 ] + */ + azeroToLike: typeof azeroToLike; + /** * Creates a zero-filled array having a specified length. *