diff --git a/lib/node_modules/@stdlib/array/base/assert/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/assert/docs/types/index.d.ts index db96d9c2fa26..629f5d39bd07 100644 --- a/lib/node_modules/@stdlib/array/base/assert/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/assert/docs/types/index.d.ts @@ -23,8 +23,21 @@ import contains = require( '@stdlib/array/base/assert/contains' ); import hasSameValues = require( '@stdlib/array/base/assert/has-same-values' ); import isAccessorArray = require( '@stdlib/array/base/assert/is-accessor-array' ); +import isComplexFloatingPointDataType = require( '@stdlib/array/base/assert/is-complex-floating-point-data-type' ); +import isComplexTypedArray = require( '@stdlib/array/base/assert/is-complex-typed-array' ); import isComplex64Array = require( '@stdlib/array/base/assert/is-complex64array' ); import isComplex128Array = require( '@stdlib/array/base/assert/is-complex128array' ); +import isDataType = require( '@stdlib/array/base/assert/is-data-type' ); +import isFloatingPointDataType = require( '@stdlib/array/base/assert/is-floating-point-data-type' ); +import isIntegerDataType = require( '@stdlib/array/base/assert/is-integer-data-type' ); +import isMostlySafeDataTypeCast = require( '@stdlib/array/base/assert/is-mostly-safe-data-type-cast' ); +import isNumericDataType = require( '@stdlib/array/base/assert/is-numeric-data-type' ); +import isRealDataType = require( '@stdlib/array/base/assert/is-real-data-type' ); +import isRealFloatingPointDataType = require( '@stdlib/array/base/assert/is-real-floating-point-data-type' ); +import isSafeDataTypeCast = require( '@stdlib/array/base/assert/is-safe-data-type-cast' ); +import isSameKindDataTypeCast = require( '@stdlib/array/base/assert/is-same-kind-data-type-cast' ); +import isSignedIntegerDataType = require( '@stdlib/array/base/assert/is-signed-integer-data-type' ); +import isUnsignedIntegerDataType = require( '@stdlib/array/base/assert/is-unsigned-integer-data-type' ); /** * Interface describing the `assert` namespace. @@ -93,6 +106,73 @@ interface Namespace { */ isAccessorArray: typeof isAccessorArray; + /** + * Tests whether an input value is a supported array complex-valued floating-point data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array complex-valued floating-point data type + * + * @example + * var bool = ns.isComplexFloatingPointDataType( 'complex64' ); + * // returns true + * + * bool = ns.isComplexFloatingPointDataType( 'complex128' ); + * // returns true + * + * bool = ns.isComplexFloatingPointDataType( 'float32' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'float64' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'generic' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'int16' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'int32' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'int8' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'uint16' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'uint32' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'uint8' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'uint8c' ); + * // returns false + * + * bool = ns.isComplexFloatingPointDataType( 'foo' ); + * // returns false + */ + isComplexFloatingPointDataType: typeof isComplexFloatingPointDataType; + + /** + * Tests if a value is a complex typed array. + * + * @param value - value to test + * @returns boolean indicating whether a value is complex typed array + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var arr = new Complex128Array( 10 ); + * var bool = ns.isComplexTypedArray( arr ); + * // returns true + * + * @example + * var bool = ns.isComplexTypedArray( [] ); + * // returns false + */ + isComplexTypedArray: typeof isComplexTypedArray; + /** * Tests if a value is a `Complex64Array`. * @@ -130,6 +210,393 @@ interface Namespace { * // returns false */ isComplex128Array: typeof isComplex128Array; + + /** + * Tests whether an input value is a supported array data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array data type + * + * @example + * var bool = ns.isDataType( 'float32' ); + * // returns true + * + * bool = ns.isDataType( 'float64' ); + * // returns true + * + * bool = ns.isDataType( 'generic' ); + * // returns true + * + * bool = ns.isDataType( 'int16' ); + * // returns true + * + * bool = ns.isDataType( 'int32' ); + * // returns true + * + * bool = ns.isDataType( 'int8' ); + * // returns true + * + * bool = ns.isDataType( 'uint16' ); + * // returns true + * + * bool = ns.isDataType( 'uint32' ); + * // returns true + * + * bool = ns.isDataType( 'uint8' ); + * // returns true + * + * bool = ns.isDataType( 'uint8c' ); + * // returns true + * + * bool = ns.isDataType( 'foo' ); + * // returns false + */ + isDataType: typeof isDataType; + + /** + * Tests whether an input value is a supported array floating-point data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array floating-point data type + * + * @example + * var bool = ns.isFloatingPointDataType( 'float32' ); + * // returns true + * + * bool = ns.isFloatingPointDataType( 'float64' ); + * // returns true + * + * bool = ns.isFloatingPointDataType( 'generic' ); + * // returns false + * + * bool = ns.isFloatingPointDataType( 'int16' ); + * // returns false + * + * bool = ns.isFloatingPointDataType( 'int32' ); + * // returns false + * + * bool = ns.isFloatingPointDataType( 'int8' ); + * // returns false + * + * bool = ns.isFloatingPointDataType( 'uint16' ); + * // returns false + * + * bool = ns.isFloatingPointDataType( 'uint32' ); + * // returns false + * + * bool = ns.isFloatingPointDataType( 'uint8' ); + * // returns false + * + * bool = ns.isFloatingPointDataType( 'uint8c' ); + * // returns false + * + * bool = ns.isFloatingPointDataType( 'foo' ); + * // returns false + */ + isFloatingPointDataType: typeof isFloatingPointDataType; + + /** + * Tests whether an input value is a supported array integer (i.e., signed or unsigned integer) data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array integer data type + * + * @example + * var bool = ns.isIntegerDataType( 'float32' ); + * // returns false + * + * bool = ns.isIntegerDataType( 'float64' ); + * // returns false + * + * bool = ns.isIntegerDataType( 'generic' ); + * // returns false + * + * bool = ns.isIntegerDataType( 'int16' ); + * // returns true + * + * bool = ns.isIntegerDataType( 'int32' ); + * // returns true + * + * bool = ns.isIntegerDataType( 'int8' ); + * // returns true + * + * bool = ns.isIntegerDataType( 'uint16' ); + * // returns true + * + * bool = ns.isIntegerDataType( 'uint32' ); + * // returns true + * + * bool = ns.isIntegerDataType( 'uint8' ); + * // returns true + * + * bool = ns.isIntegerDataType( 'uint8c' ); + * // returns true + * + * bool = ns.isIntegerDataType( 'foo' ); + * // returns false + */ + isIntegerDataType: typeof isIntegerDataType; + + /** + * Returns a boolean indicating if a provided array data type can be safely cast or, for floating-point data types, downcast to another array data type. + * + * @param from - array data type + * @param to - array data type + * @returns boolean indicating if a data type can be cast to another data type + * + * @example + * var bool = ns.isMostlySafeDataTypeCast( 'float32', 'float64' ); + * // returns true + * + * bool = ns.isMostlySafeDataTypeCast( 'float64', 'int32' ); + * // returns false + */ + isMostlySafeDataTypeCast: typeof isMostlySafeDataTypeCast; + + /** + * Tests whether an input value is a supported array numeric data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array numeric data type + * + * @example + * var bool = ns.isNumericDataType( 'float32' ); + * // returns true + * + * bool = ns.isNumericDataType( 'float64' ); + * // returns true + * + * bool = ns.isNumericDataType( 'generic' ); + * // returns false + * + * bool = ns.isNumericDataType( 'int16' ); + * // returns true + * + * bool = ns.isNumericDataType( 'int32' ); + * // returns true + * + * bool = ns.isNumericDataType( 'int8' ); + * // returns true + * + * bool = ns.isNumericDataType( 'uint16' ); + * // returns true + * + * bool = ns.isNumericDataType( 'uint32' ); + * // returns true + * + * bool = ns.isNumericDataType( 'uint8' ); + * // returns true + * + * bool = ns.isNumericDataType( 'uint8c' ); + * // returns true + * + * bool = ns.isNumericDataType( 'foo' ); + * // returns false + */ + isNumericDataType: typeof isNumericDataType; + + /** + * Tests whether an input value is a supported array real-valued data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array real-valued data type + * + * @example + * var bool = ns.isRealDataType( 'float32' ); + * // returns true + * + * bool = ns.isRealDataType( 'float64' ); + * // returns true + * + * bool = ns.isRealDataType( 'complex128' ); + * // returns false + * + * bool = ns.isRealDataType( 'generic' ); + * // returns false + * + * bool = ns.isRealDataType( 'int16' ); + * // returns true + * + * bool = ns.isRealDataType( 'int32' ); + * // returns true + * + * bool = ns.isRealDataType( 'int8' ); + * // returns true + * + * bool = ns.isRealDataType( 'uint16' ); + * // returns true + * + * bool = ns.isRealDataType( 'uint32' ); + * // returns true + * + * bool = ns.isRealDataType( 'uint8' ); + * // returns true + * + * bool = ns.isRealDataType( 'uint8c' ); + * // returns true + * + * bool = ns.isRealDataType( 'foo' ); + * // returns false + */ + isRealDataType: typeof isRealDataType; + + /** + * Tests whether an input value is a supported array real-valued floating-point data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array real-valued floating-point data type + * + * @example + * var bool = ns.isRealFloatingPointDataType( 'float32' ); + * // returns true + * + * bool = ns.isRealFloatingPointDataType( 'float64' ); + * // returns true + * + * bool = ns.isRealFloatingPointDataType( 'generic' ); + * // returns false + * + * bool = ns.isRealFloatingPointDataType( 'int16' ); + * // returns false + * + * bool = ns.isRealFloatingPointDataType( 'int32' ); + * // returns false + * + * bool = ns.isRealFloatingPointDataType( 'int8' ); + * // returns false + * + * bool = ns.isRealFloatingPointDataType( 'uint16' ); + * // returns false + * + * bool = ns.isRealFloatingPointDataType( 'uint32' ); + * // returns false + * + * bool = ns.isRealFloatingPointDataType( 'uint8' ); + * // returns false + * + * bool = ns.isRealFloatingPointDataType( 'uint8c' ); + * // returns false + * + * bool = ns.isRealFloatingPointDataType( 'foo' ); + * // returns false + */ + isRealFloatingPointDataType: typeof isRealFloatingPointDataType; + + /** + * Returns a boolean indicating if a provided array data type can be safely cast to another array data type. + * + * @param from - array data type + * @param to - array data type + * @returns boolean indicating if a data type can be safely cast to another data type + * + * @example + * var bool = ns.isSafeDataTypeCast( 'float32', 'float64' ); + * // returns true + * + * bool = ns.isSafeDataTypeCast( 'float64', 'int32' ); + * // returns false + */ + isSafeDataTypeCast: typeof isSafeDataTypeCast; + + /** + * Returns a boolean indicating if a provided array data type can be safely cast to, or is of the same "kind" as, another array data type. + * + * @param from - array data type + * @param to - array data type + * @returns boolean indicating if a data type can be cast to another data type + * + * @example + * var bool = ns.isSameKindDataTypeCast( 'float32', 'float64' ); + * // returns true + * + * bool = ns.isSameKindDataTypeCast( 'uint16', 'int16' ); + * // returns false + */ + isSameKindDataTypeCast: typeof isSameKindDataTypeCast; + + /** + * Tests whether an input value is a supported array signed integer data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array signed integer data type + * + * @example + * var bool = ns.isSignedIntegerDataType( 'float32' ); + * // returns false + * + * bool = ns.isSignedIntegerDataType( 'float64' ); + * // returns false + * + * bool = ns.isSignedIntegerDataType( 'generic' ); + * // returns false + * + * bool = ns.isSignedIntegerDataType( 'int16' ); + * // returns true + * + * bool = ns.isSignedIntegerDataType( 'int32' ); + * // returns true + * + * bool = ns.isSignedIntegerDataType( 'int8' ); + * // returns true + * + * bool = ns.isSignedIntegerDataType( 'uint16' ); + * // returns false + * + * bool = ns.isSignedIntegerDataType( 'uint32' ); + * // returns false + * + * bool = ns.isSignedIntegerDataType( 'uint8' ); + * // returns false + * + * bool = ns.isSignedIntegerDataType( 'uint8c' ); + * // returns false + * + * bool = ns.isSignedIntegerDataType( 'foo' ); + * // returns false + */ + isSignedIntegerDataType: typeof isSignedIntegerDataType; + + /** + * Tests whether an input value is a supported array unsigned integer data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array unsigned integer data type + * + * @example + * var bool = ns.isUnsignedIntegerDataType( 'float32' ); + * // returns false + * + * bool = ns.isUnsignedIntegerDataType( 'float64' ); + * // returns false + * + * bool = ns.isUnsignedIntegerDataType( 'generic' ); + * // returns false + * + * bool = ns.isUnsignedIntegerDataType( 'int16' ); + * // returns false + * + * bool = ns.isUnsignedIntegerDataType( 'int32' ); + * // returns false + * + * bool = ns.isUnsignedIntegerDataType( 'int8' ); + * // returns false + * + * bool = ns.isUnsignedIntegerDataType( 'uint16' ); + * // returns true + * + * bool = ns.isUnsignedIntegerDataType( 'uint32' ); + * // returns true + * + * bool = ns.isUnsignedIntegerDataType( 'uint8' ); + * // returns true + * + * bool = ns.isUnsignedIntegerDataType( 'uint8c' ); + * // returns true + * + * bool = ns.isUnsignedIntegerDataType( 'foo' ); + * // returns false + */ + isUnsignedIntegerDataType: typeof isUnsignedIntegerDataType; } /** diff --git a/lib/node_modules/@stdlib/array/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/docs/types/index.d.ts index 09b071bf6b06..b5ad9be9f8a0 100644 --- a/lib/node_modules/@stdlib/array/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/docs/types/index.d.ts @@ -63,10 +63,14 @@ import cartesianProduct = require( '@stdlib/array/base/cartesian-product' ); import cartesianSquare = require( '@stdlib/array/base/cartesian-square' ); import copy = require( '@stdlib/array/base/copy' ); import copyIndexed = require( '@stdlib/array/base/copy-indexed' ); +import countFalsy = require( '@stdlib/array/base/count-falsy' ); +import countTruthy = require( '@stdlib/array/base/count-truthy' ); import dedupe = require( '@stdlib/array/base/dedupe' ); import every = require( '@stdlib/array/base/every' ); import everyBy = require( '@stdlib/array/base/every-by' ); import everyByRight = require( '@stdlib/array/base/every-by-right' ); +import fancySlice = require( '@stdlib/array/base/fancy-slice' ); +import fancySliceAssign = require( '@stdlib/array/base/fancy-slice-assign' ); import filled = require( '@stdlib/array/base/filled' ); import filledBy = require( '@stdlib/array/base/filled-by' ); import filled2d = require( '@stdlib/array/base/filled2d' ); @@ -117,8 +121,11 @@ import map2d = require( '@stdlib/array/base/map2d' ); import map3d = require( '@stdlib/array/base/map3d' ); import map4d = require( '@stdlib/array/base/map4d' ); import map5d = require( '@stdlib/array/base/map5d' ); +import minSignedIntegerDataType = require( '@stdlib/array/base/min-signed-integer-dtype' ); +import minUnsignedIntegerDataType = require( '@stdlib/array/base/min-unsigned-integer-dtype' ); import mskbinary2d = require( '@stdlib/array/base/mskbinary2d' ); import mskfilter = require( '@stdlib/array/base/mskfilter' ); +import mskreject = require( '@stdlib/array/base/mskreject' ); import mskunary2d = require( '@stdlib/array/base/mskunary2d' ); import mskunary3d = require( '@stdlib/array/base/mskunary3d' ); import nCartesianProduct = require( '@stdlib/array/base/n-cartesian-product' ); @@ -140,6 +147,7 @@ import quinary2d = require( '@stdlib/array/base/quinary2d' ); import quinary3d = require( '@stdlib/array/base/quinary3d' ); import quinary4d = require( '@stdlib/array/base/quinary4d' ); import quinary5d = require( '@stdlib/array/base/quinary5d' ); +import reject = require( '@stdlib/array/base/reject' ); import resolveGetter = require( '@stdlib/array/base/resolve-getter' ); import resolveSetter = require( '@stdlib/array/base/resolve-setter' ); import reverse = require( '@stdlib/array/base/reverse' ); @@ -1318,6 +1326,34 @@ interface Namespace { */ copyIndexed: typeof copyIndexed; + /** + * Counts the number of falsy values in an array. + * + * @param x - input array + * @returns number of falsy values + * + * @example + * var x = [ 0, 1, 0, 1, 1 ]; + * + * var out = ns.countFalsy( x ); + * // returns 2 + */ + countFalsy: typeof countFalsy; + + /** + * Counts the number of truthy values in an array. + * + * @param x - input array + * @returns number of truthy values + * + * @example + * var x = [ 0, 1, 0, 1, 1 ]; + * + * var out = ns.countTruthy( x ); + * // returns 3 + */ + countTruthy: typeof countTruthy; + /** * Removes consecutive duplicated values. * @@ -1419,6 +1455,55 @@ interface Namespace { */ everyByRight: typeof everyByRight; + /** + * Returns a shallow copy of a portion of an array. + * + * @param x - input array + * @param s - slice object + * @param strict - boolean indicating whether to enforce strict bounds checking + * @returns output array + * + * @example + * var Slice = require( '@stdlib/ns.fancySlice/ctor' ); + * + * var x = [ 1, 2, 3, 4, 5, 6 ]; + * + * var out = ns.fancySlice( x, new Slice( null, null, -1 ), false ); + * // returns [ 6, 5, 4, 3, 2, 1 ] + */ + fancySlice: typeof fancySlice; + + /** + * Assigns element values from a broadcasted input array to corresponding elements in an output array. + * + * ## Notes + * + * - The input array must be broadcast compatible with the output array slice to which elements will be assigned (i.e., contain only one element or the same number of elements as in the slice). + * - The input array must have a data type which can be safely cast to the output array data type. Floating-point data types (both real and complex) are allowed to downcast to a lower precision data type of the same kind (e.g., element values from a `'float64'` input array can be assigned to corresponding elements in a `'float32'` output array). + * + * @param x - input array + * @param y - output array + * @param s - slice object + * @param strict - boolean indicating whether to enforce strict bounds checking + * @returns output array + * + * @example + * var Slice = require( '@stdlib/slice/ctor' ); + * + * var x = [ 1, 2, 3, 4 ]; + * var y = [ 0, 0, 0, 0, 0, 0, 0, 0 ]; + * + * var s = new Slice( null, null, 2 ); + * // returns + * + * var out = ns.fancySliceAssign( x, y, s, false ); + * // returns [ 1, 0, 2, 0, 3, 0, 4, 0 ] + * + * var bool = ( out === y ); + * // returns true + */ + fancySliceAssign: typeof fancySliceAssign; + /** * Returns a filled "generic" array. * @@ -2562,6 +2647,38 @@ interface Namespace { */ map5d: typeof map5d; + /** + * Returns the minimum array data type for storing a provided signed integer value. + * + * @param value - scalar value + * @returns array data type + * + * @example + * var dt = ns.minSignedIntegerDataType( 1280 ); + * // returns 'int16' + * + * @example + * var dt = ns.minSignedIntegerDataType( 3 ); + * // returns 'int8' + */ + minSignedIntegerDataType: typeof minSignedIntegerDataType; + + /** + * Returns the minimum array data type for storing a provided unsigned integer value. + * + * @param value - scalar value + * @returns array data type + * + * @example + * var dt = ns.minUnsignedIntegerDataType( 1280 ); + * // returns 'uint16' + * + * @example + * var dt = ns.minUnsignedIntegerDataType( 3 ); + * // returns 'uint8' + */ + minUnsignedIntegerDataType: typeof minUnsignedIntegerDataType; + /** * Applies a binary callback to elements in two two-dimensional nested input arrays according to elements in a two-dimensional nested mask array and assigns results to elements in a two-dimensional nested output array. * @@ -2609,6 +2726,21 @@ interface Namespace { */ mskfilter: typeof mskfilter; + /** + * 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.mskreject( x, [ 0, 1, 0, 1 ] ); + * // returns [ 1, 3 ] + */ + mskreject: typeof mskreject; + /** * 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. * @@ -3115,6 +3247,22 @@ interface Namespace { */ quinary5d: typeof quinary5d; + /** + * Returns a shallow copy of an array containing only those elements which fail 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.reject( x, isPositiveNumber ); + * // returns [ -2, -3 ] + */ + reject: typeof reject; + /** * Returns an accessor function for retrieving an element from an indexed array-like object. * @@ -3192,6 +3340,12 @@ interface Namespace { * @returns output array * * @example + * var x = [ 1, 2, 3 ]; + * + * var out = ns.slice( x, 0, 3 ); + * // returns [ 1, 2, 3 ] + * + * @example * var x = [ 1, 2, 3, 4, 5, 6 ]; * * var out = ns.slice( x, 0, 3 ); @@ -3308,21 +3462,28 @@ interface Namespace { strided2array5d: typeof strided2array5d; /** - * Takes element from an array. - * - * ## Notes - * - * - The function does **not** perform bounds checking. If an index is less than zero or greater than the maximum index of `x`, the value of the corresponding element in the output array is undefined. + * Takes elements from an array. * * @param x - input array * @param indices - list of element indices + * @param mode - index mode * @returns output array * * @example * var x = [ 1, 2, 3, 4 ]; * - * var y = ns.take( x, [ 1, 3 ] ); + * var y = ns.take( x, [ 1, 3 ], 'throw' ); * // returns [ 2, 4 ] + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * var out = [ 0, 0, 0, 0 ]; + * + * var arr = ns.take.assign( x, [ 1, 3 ], 'throw', out, 2, 0 ); + * // returns [ 2, 0, 4, 0 ] + * + * var bool = ( arr === out ); + * // returns true */ take: typeof take; diff --git a/lib/node_modules/@stdlib/array/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/docs/types/index.d.ts index 017c7847ec6d..67eb0c61e313 100644 --- a/lib/node_modules/@stdlib/array/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/docs/types/index.d.ts @@ -22,51 +22,58 @@ import base = require( '@stdlib/array/base' ); import ArrayBuffer = require( '@stdlib/array/buffer' ); -import acartesianPower = require( '@stdlib/array/cartesian-power' ); -import acartesianProduct = require( '@stdlib/array/cartesian-product' ); -import acartesianSquare = require( '@stdlib/array/cartesian-square' ); +import cartesianPower = require( '@stdlib/array/cartesian-power' ); +import cartesianProduct = require( '@stdlib/array/cartesian-product' ); +import cartesianSquare = require( '@stdlib/array/cartesian-square' ); import Complex64Array = require( '@stdlib/array/complex64' ); import Complex128Array = require( '@stdlib/array/complex128' ); -import convertArray = require( '@stdlib/array/convert' ); -import convertArraySame = require( '@stdlib/array/convert-same' ); -import arrayCtors = require( '@stdlib/array/ctors' ); +import convert = require( '@stdlib/array/convert' ); +import convertSame = require( '@stdlib/array/convert-same' ); +import ctors = require( '@stdlib/array/ctors' ); import DataView = require( '@stdlib/array/dataview' ); import datespace = require( '@stdlib/array/datespace' ); -import arrayDefaults = require( '@stdlib/array/defaults' ); -import arrayDataType = require( '@stdlib/array/dtype' ); -import arrayDataTypes = require( '@stdlib/array/dtypes' ); -import aempty = require( '@stdlib/array/empty' ); -import aemptyLike = require( '@stdlib/array/empty-like' ); -import filledarray = require( '@stdlib/array/filled' ); -import filledarrayBy = require( '@stdlib/array/filled-by' ); +import defaults = require( '@stdlib/array/defaults' ); +import dtype = require( '@stdlib/array/dtype' ); +import dtypes = require( '@stdlib/array/dtypes' ); +import empty = require( '@stdlib/array/empty' ); +import emptyLike = require( '@stdlib/array/empty-like' ); +import filled = require( '@stdlib/array/filled' ); +import filledBy = require( '@stdlib/array/filled-by' ); import Float32Array = require( '@stdlib/array/float32' ); import Float64Array = require( '@stdlib/array/float64' ); import iterator2array = require( '@stdlib/array/from-iterator' ); -import afull = require( '@stdlib/array/full' ); -import afullLike = require( '@stdlib/array/full-like' ); +import scalar2array = require( '@stdlib/array/from-scalar' ); +import full = require( '@stdlib/array/full' ); +import fullLike = require( '@stdlib/array/full-like' ); import incrspace = require( '@stdlib/array/incrspace' ); +import ArrayIndex = require( '@stdlib/array/index' ); import Int8Array = require( '@stdlib/array/int8' ); import Int16Array = require( '@stdlib/array/int16' ); import Int32Array = require( '@stdlib/array/int32' ); import linspace = require( '@stdlib/array/linspace' ); import logspace = require( '@stdlib/array/logspace' ); -import arrayMinDataType = require( '@stdlib/array/min-dtype' ); -import anans = require( '@stdlib/array/nans' ); -import anansLike = require( '@stdlib/array/nans-like' ); -import arrayNextDataType = require( '@stdlib/array/next-dtype' ); -import aoneTo = require( '@stdlib/array/one-to' ); -import aoneToLike = require( '@stdlib/array/one-to-like' ); -import aones = require( '@stdlib/array/ones' ); -import aonesLike = require( '@stdlib/array/ones-like' ); +import minDataType = require( '@stdlib/array/min-dtype' ); +import mostlySafeCasts = require( '@stdlib/array/mostly-safe-casts' ); +import mskfilter = require( '@stdlib/array/mskfilter' ); +import mskreject = require( '@stdlib/array/mskreject' ); +import nans = require( '@stdlib/array/nans' ); +import nansLike = require( '@stdlib/array/nans-like' ); +import nextDataType = require( '@stdlib/array/next-dtype' ); +import oneTo = require( '@stdlib/array/one-to' ); +import oneToLike = require( '@stdlib/array/one-to-like' ); +import ones = require( '@stdlib/array/ones' ); +import onesLike = require( '@stdlib/array/ones-like' ); import typedarraypool = require( '@stdlib/array/pool' ); -import arrayPromotionRules = require( '@stdlib/array/promotion-rules' ); -import reviveTypedArray = require( '@stdlib/array/reviver' ); -import arraySafeCasts = require( '@stdlib/array/safe-casts' ); -import arraySameKindCasts = require( '@stdlib/array/same-kind-casts' ); -import arrayShape = require( '@stdlib/array/shape' ); +import promotionRules = require( '@stdlib/array/promotion-rules' ); +import typedarrayReviver = require( '@stdlib/array/reviver' ); +import safeCasts = require( '@stdlib/array/safe-casts' ); +import sameKindCasts = require( '@stdlib/array/same-kind-casts' ); +import shape = require( '@stdlib/array/shape' ); import SharedArrayBuffer = require( '@stdlib/array/shared-buffer' ); -import aslice = require( '@stdlib/array/slice' ); +import slice = require( '@stdlib/array/slice' ); +import take = require( '@stdlib/array/take' ); import circarray2iterator = require( '@stdlib/array/to-circular-iterator' ); +import array2fancy = require( '@stdlib/array/to-fancy' ); import array2iterator = require( '@stdlib/array/to-iterator' ); import array2iteratorRight = require( '@stdlib/array/to-iterator-right' ); import typedarray2json = require( '@stdlib/array/to-json' ); @@ -98,10 +105,10 @@ import Uint8Array = require( '@stdlib/array/uint8' ); import Uint8ClampedArray = require( '@stdlib/array/uint8c' ); import Uint16Array = require( '@stdlib/array/uint16' ); import Uint32Array = require( '@stdlib/array/uint32' ); -import azeroTo = require( '@stdlib/array/zero-to' ); -import azeroToLike = require( '@stdlib/array/zero-to-like' ); -import azeros = require( '@stdlib/array/zeros' ); -import azerosLike = require( '@stdlib/array/zeros-like' ); +import zeroTo = require( '@stdlib/array/zero-to' ); +import zeroToLike = require( '@stdlib/array/zero-to-like' ); +import zeros = require( '@stdlib/array/zeros' ); +import zerosLike = require( '@stdlib/array/zeros-like' ); import constants = require( '@stdlib/constants/array' ); /** @@ -133,10 +140,10 @@ interface Namespace { * @example * var x = [ 1, 2 ]; * - * var out = ns.acartesianPower( x, 2 ); + * var out = ns.cartesianPower( x, 2 ); * // returns [ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 2, 2 ] ] */ - acartesianPower: typeof acartesianPower; + cartesianPower: typeof cartesianPower; /** * Returns the Cartesian product. @@ -153,10 +160,10 @@ interface Namespace { * var x1 = [ 1, 2, 3 ]; * var x2 = [ 4, 5 ]; * - * var out = ns.acartesianProduct( x1, x2 ); + * var out = ns.cartesianProduct( x1, x2 ); * // returns [ [ 1, 4 ], [ 1, 5 ], [ 2, 4 ], [ 2, 5 ], [ 3, 4 ], [ 3, 5 ] ] */ - acartesianProduct: typeof acartesianProduct; + cartesianProduct: typeof cartesianProduct; /** * Returns the Cartesian square. @@ -171,10 +178,10 @@ interface Namespace { * @example * var x = [ 1, 2 ]; * - * var out = ns.acartesianSquare( x ); + * var out = ns.cartesianSquare( x ); * // returns [ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 2, 2 ] ] */ - acartesianSquare: typeof acartesianSquare; + cartesianSquare: typeof cartesianSquare; /** * 64-bit complex number array constructor. @@ -323,10 +330,10 @@ interface Namespace { * * @example * var arr = [ 1.0, 2.0, 3.0, 4.0 ]; - * var out = ns.convertArray( arr, 'float64' ); + * var out = ns.convert( arr, 'float64' ); * // returns [ 1.0, 2.0, 3.0, 4.0 ] */ - convertArray: typeof convertArray; + convert: typeof convert; /** * Converts an array to the same data type as a second input array. @@ -341,10 +348,10 @@ interface Namespace { * var x = [ 1.0, 2.0, 3.0, 4.0 ]; * var y = new Float64Array( 0 ); * - * var out = ns.convertArraySame( x, y ); + * var out = ns.convertSame( x, y ); * // returns [ 1.0, 2.0, 3.0, 4.0 ] */ - convertArraySame: typeof convertArraySame; + convertSame: typeof convertSame; /** * Returns an array constructor. @@ -353,14 +360,14 @@ interface Namespace { * @returns constructor or null * * @example - * var ctor = ns.arrayCtors( 'float64' ); + * var ctor = ns.ctors( 'float64' ); * // returns * * @example - * var ctor = ns.arrayCtors( 'float' ); + * var ctor = ns.ctors( 'float' ); * // returns null */ - arrayCtors: typeof arrayCtors; + ctors: typeof ctors; /** * Constructor which returns a data view representing a provided array buffer. @@ -403,10 +410,10 @@ interface Namespace { * @returns default settings * * @example - * var o = ns.arrayDefaults(); + * var o = ns.defaults(); * // returns {...} */ - arrayDefaults: typeof arrayDefaults; + defaults: typeof defaults; /** * Returns the data type of an array. @@ -419,13 +426,13 @@ interface Namespace { * @returns data type * * @example - * var dt = ns.arrayDataType( [ 1, 2, 3 ] ); + * var dt = ns.dtype( [ 1, 2, 3 ] ); * // returns 'generic' * - * var dt = ns.arrayDataType( 'beep' ); + * var dt = ns.dtype( 'beep' ); * // returns null */ - arrayDataType: typeof arrayDataType; + dtype: typeof dtype; /** * Returns a list of array data types. @@ -434,14 +441,14 @@ interface Namespace { * @returns list of array data types * * @example - * var list = ns.arrayDataTypes(); + * var list = ns.dtypes(); * // e.g., returns [ 'float32', 'float64', ... ] * * @example - * var list = ns.arrayDataTypes( 'floating_point' ); + * var list = ns.dtypes( 'floating_point' ); * // returns [...] */ - arrayDataTypes: typeof arrayDataTypes; + dtypes: typeof dtypes; /** * Creates an uninitialized array having a specified length. @@ -472,14 +479,14 @@ interface Namespace { * @returns empty array * * @example - * var arr = ns.aempty( 2 ); + * var arr = ns.empty( 2 ); * // returns * * @example - * var arr = ns.aempty( 2, 'float32' ); + * var arr = ns.empty( 2, 'float32' ); * // returns */ - aempty: typeof aempty; + empty: typeof empty; /** * Creates an uninitialized array having the same length and data type as a provided input array. @@ -515,7 +522,7 @@ interface Namespace { * var x = zeros( 2, 'float32' ); * // returns [ 0.0, 0.0 ] * - * var arr = ns.aemptyLike( x ); + * var arr = ns.emptyLike( x ); * // returns * * @example @@ -524,10 +531,10 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var arr = ns.aemptyLike( x ); + * var arr = ns.emptyLike( x ); * // returns */ - aemptyLike: typeof aemptyLike; + emptyLike: typeof emptyLike; /** * Returns a filled typed array view of an `ArrayBuffer`. @@ -545,17 +552,17 @@ interface Namespace { * var ArrayBuffer = require( '@stdlib/array/buffer' ); * * var buf = new ArrayBuffer( 32 ); - * var arr = ns.filledarray( 1.0, buf ); + * var arr = ns.filled( 1.0, buf ); * // returns [ 1.0, 1.0, 1.0, 1.0 ] * * @example * var ArrayBuffer = require( '@stdlib/array/buffer' ); * * var buf = new ArrayBuffer( 32 ); - * var arr = ns.filledarray( 1.0, buf, 'float32' ); + * var arr = ns.filled( 1.0, buf, 'float32' ); * // returns [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] */ - filledarray: typeof filledarray; + filled: typeof filled; /** * Returns a filled typed array view of an `ArrayBuffer` according to a provided callback function. @@ -590,10 +597,10 @@ interface Namespace { * var ArrayBuffer = require( '@stdlib/array/buffer' ); * * var buf = new ArrayBuffer( 32 ); - * var arr = ns.filledarrayBy( buf, 'float64', constantFunction( 1.0 ) ); + * var arr = ns.filledBy( buf, 'float64', constantFunction( 1.0 ) ); * // returns [ 1.0, 1.0, 1.0, 1.0 ] */ - filledarrayBy: typeof filledarrayBy; + filledBy: typeof filledBy; /** * Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order. @@ -632,6 +639,28 @@ interface Namespace { */ iterator2array: typeof iterator2array; + /** + * Returns a single-element array containing a provided scalar value. + * + * ## Notes + * + * - If a `dtype` argument is not provided and `value` + * + * - is a `number`, the default data type is the default real-valued floating-point data type. + * - is a complex number object of a known complex data type, the data type is the same as the provided value. + * - is a complex number object of an unknown complex data type, the default data type is the default complex-valued floating-point data type. + * - is any other value type, the default data type is `'generic'`. + * + * @param value - scalar value + * @param dtype - output array data type + * @returns output array + * + * @example + * var x = ns.scalar2array( 1.0, generic' ); + * // returns [ 1.0 ] + */ + scalar2array: typeof scalar2array; + /** * Creates a filled array having a specified length. * @@ -656,14 +685,14 @@ interface Namespace { * @returns filled array * * @example - * var arr = ns.afull( 2, 1.0 ); + * var arr = ns.full( 2, 1.0 ); * // returns [ 1.0, 1.0 ] * * @example - * var arr = ns.afull( 2, 1.0, 'float32' ); + * var arr = ns.full( 2, 1.0, 'float32' ); * // returns [ 1.0, 1.0 ] */ - afull: typeof afull; + full: typeof full; /** * Creates a filled array having the same length and data type as a provided input array. @@ -694,7 +723,7 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.afullLike( x, 1.0 ); + * var y = ns.fullLike( x, 1.0 ); * // returns [ 1.0, 1.0 ] * * @example @@ -703,10 +732,10 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.afullLike( x, 1.0, 'float32' ); + * var y = ns.fullLike( x, 1.0, 'float32' ); * // returns [ 1.0, 1.0 ] */ - afullLike: typeof afullLike; + fullLike: typeof fullLike; /** * Generates a linearly spaced numeric array using a provided increment. @@ -723,6 +752,24 @@ interface Namespace { */ incrspace: typeof incrspace; + /** + * Array index constructor. + * + * @param x - input array + * @param options - function options + * @param options.persist - boolean indicating whether to continue persisting an index object after first usage + * @returns ArrayIndex instance + * + * @example + * var Uint8Array = require( '@stdlib/array/uint8' ); + * + * var x = new Uint8Array( [ 1, 0, 1, 0 ] ); + * + * var idx = new ns.ArrayIndex( x ); + * // returns + */ + ArrayIndex: typeof ArrayIndex; + /** * Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. */ @@ -791,10 +838,57 @@ interface Namespace { * @returns array data type * * @example - * var dt = ns.arrayMinDataType( 'beep' ); + * var dt = ns.minDataType( 'beep' ); * // returns 'generic' */ - arrayMinDataType: typeof arrayMinDataType; + minDataType: typeof minDataType; + + /** + * Returns a list of array data types to which a provided array data type can be safely cast and, for floating-point data types, can be downcast. + * + * ## Notes + * + * - If not provided an array data type, the function returns a casting table. + * - If provided an unrecognized array data type, the function returns `null`. + * + * @param dtype - array data type value + * @returns list of array data types or null + * + * @example + * var list = ns.mostlySafeCasts( 'float32' ); + * // returns [...] + */ + mostlySafeCasts: typeof mostlySafeCasts; + + /** + * 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; + + /** + * 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.mskreject( x, [ 0, 1, 0, 1 ] ); + * // returns [ 1, 3 ] + */ + mskreject: typeof mskreject; /** * Creates an array filled with NaNs and having a specified length. @@ -812,14 +906,14 @@ interface Namespace { * @returns filled array * * @example - * var arr = ns.anans( 2 ); + * var arr = ns.nans( 2 ); * // returns [ NaN, NaN ] * * @example - * var arr = ns.anans( 2, 'float32' ); + * var arr = ns.nans( 2, 'float32' ); * // returns [ NaN, NaN ] */ - anans: typeof anans; + nans: typeof nans; /** * Creates an array filled with NaNs and having the same length and data type as a provided input array. @@ -842,7 +936,7 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.anansLike( x ); + * var y = ns.nansLike( x ); * // returns [ NaN, NaN ] * * @example @@ -851,10 +945,10 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.anansLike( x, 'float32' ); + * var y = ns.nansLike( x, 'float32' ); * // returns [ NaN, NaN ] */ - anansLike: typeof anansLike; + nansLike: typeof nansLike; /** * Returns the next larger array data type of the same kind. @@ -869,14 +963,14 @@ interface Namespace { * @returns next larger data type(s) or null * * @example - * var table = ns.arrayNextDataType(); + * var table = ns.nextDataType(); * // returns {...} * * @example - * var dt = ns.arrayNextDataType( 'float32' ); + * var dt = ns.nextDataType( 'float32' ); * // returns 'float64' */ - arrayNextDataType: typeof arrayNextDataType; + nextDataType: typeof nextDataType; /** * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. @@ -886,14 +980,14 @@ interface Namespace { * @returns linearly spaced numeric array * * @example - * var arr = ns.aoneTo( 2 ); + * var arr = ns.oneTo( 2 ); * // returns [ 1.0, 2.0 ] * * @example - * var arr = ns.aoneTo( 2, 'float32' ); + * var arr = ns.oneTo( 2, 'float32' ); * // returns [ 1.0, 2.0 ] */ - aoneTo: typeof aoneTo; + oneTo: typeof oneTo; /** * 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. @@ -908,10 +1002,10 @@ interface Namespace { * var x = zeros( 2, 'float32' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.aoneToLike( x ); + * var y = ns.oneToLike( x ); * // returns [ 1.0, 2.0 ] */ - aoneToLike: typeof aoneToLike; + oneToLike: typeof oneToLike; /** * Creates an array filled with ones and having a specified length. @@ -936,14 +1030,14 @@ interface Namespace { * @returns filled array * * @example - * var arr = ns.aones( 2 ); + * var arr = ns.ones( 2 ); * // returns [ 1.0, 1.0 ] * * @example - * var arr = ns.aones( 2, 'float32' ); + * var arr = ns.ones( 2, 'float32' ); * // returns [ 1.0, 1.0 ] */ - aones: typeof aones; + ones: typeof ones; /** * Creates an array filled with ones and having the same length and data type as a provided input array. @@ -973,7 +1067,7 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.aonesLike( x ); + * var y = ns.onesLike( x ); * // returns [ 1.0, 1.0 ] * * @example @@ -982,10 +1076,10 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.aonesLike( x, 'float32' ); + * var y = ns.onesLike( x, 'float32' ); * // returns [ 1.0, 1.0 ] */ - aonesLike: typeof aonesLike; + onesLike: typeof onesLike; /** * Returns an uninitialized typed array. @@ -1023,10 +1117,10 @@ interface Namespace { * @returns promotion rule table * * @example - * var table = ns.arrayPromotionRules(); + * var table = ns.promotionRules(); * // returns {...} */ - arrayPromotionRules: typeof arrayPromotionRules; + promotionRules: typeof promotionRules; /** * Revives a JSON-serialized typed array. @@ -1040,10 +1134,10 @@ interface Namespace { * * var str = '{"type":"Float64Array","data":[5,3]}'; * - * var arr = parseJSON( str, ns.reviveTypedArray ); + * var arr = parseJSON( str, ns.typedarrayReviver ); * // returns [ 5.0, 3.0 ] */ - reviveTypedArray: typeof reviveTypedArray; + typedarrayReviver: typeof typedarrayReviver; /** * Returns a list of array data types to which a provided array data type can be safely cast. @@ -1057,18 +1151,18 @@ interface Namespace { * @returns a casting table, a list of array data types, or null * * @example - * var table = ns.arraySafeCasts(); + * var table = ns.safeCasts(); * // returns {...} * * @example - * var list = ns.arraySafeCasts( 'float32' ); + * var list = ns.safeCasts( 'float32' ); * // returns [...] * * @example - * var list = ns.arraySafeCasts( 'float' ); + * var list = ns.safeCasts( 'float' ); * // returns null */ - arraySafeCasts: typeof arraySafeCasts; + safeCasts: typeof safeCasts; /** * Returns a list of array data types to which a provided array data type can be safely cast or cast within the same "kind". @@ -1082,18 +1176,18 @@ interface Namespace { * @returns a table, a list of array data types, or null * * @example - * var table = ns.arraySameKindCasts(); + * var table = ns.sameKindCasts(); * // returns {...} * * @example - * var list = ns.arraySameKindCasts( 'float32' ); + * var list = ns.sameKindCasts( 'float32' ); * // returns [...] * * @example - * var list = ns.arraySameKindCasts( 'float' ); + * var list = ns.sameKindCasts( 'float' ); * // returns null */ - arraySameKindCasts: typeof arraySameKindCasts; + sameKindCasts: typeof sameKindCasts; /** * Determines (nested) array dimensions. @@ -1104,22 +1198,22 @@ interface Namespace { * @example * var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ]; * - * var shape = ns.arrayShape( arr ); + * var ns.shape = ns.shape( arr ); * // returns [ 3, 3 ] * * @example * var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8 ] ]; * - * var shape = ns.arrayShape( arr ); + * var ns.shape = ns.shape( arr ); * // returns [ 3 ] * * @example * var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], null ]; * - * var shape = ns.arrayShape( arr ); + * var ns.shape = ns.shape( arr ); * // returns [ 3 ] */ - arrayShape: typeof arrayShape; + shape: typeof shape; /** * Constructor returning an object used to represent a generic, fixed-length raw binary data buffer which can be used to create views of shared memory. @@ -1135,18 +1229,34 @@ interface Namespace { * @returns output array * * @example - * var x = [ 1, 2, 3, 4, 5, 6 ]; + * var x = [ 1, 2, 3 ]; * - * var out = ns.aslice( x ); + * var out = ns.slice( x ); * // returns [ 1, 2, 3 ] * * @example * var x = [ 1, 2, 3, 4, 5, 6 ]; * - * var out = ns.aslice( x, 0, 2 ); + * var out = ns.slice( x, 0, 2 ); * // returns [ 1, 2 ] */ - aslice: typeof aslice; + slice: typeof slice; + + /** + * Takes elements from an array. + * + * @param x - input array + * @param indices - list of element indices + * @param options - function options + * @returns output array + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var y = ns.take( x, [ 1, 3 ] ); + * // returns [ 2, 4 ] + */ + take: typeof take; /** * Returns an iterator which repeatedly iterates over each element in an array-like object. @@ -1178,6 +1288,26 @@ interface Namespace { */ circarray2iterator: typeof circarray2iterator; + /** + * Converts an array to an object supporting fancy indexing. + * + * @param x - input array + * @param options - function options + * @param options.strict - boolean indicating whether to enforce strict bounds checking + * @param options.cache - cache for resolving array index objects + * @returns fancy array + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var y = ns.array2fancy( x ); + * // returns + * + * var v = y[ ':' ]; + * // returns [ 1, 2, 3, 4 ] + */ + array2fancy: typeof array2fancy; + /** * Returns an iterator which iterates over each element in an array-like object. * @@ -1456,7 +1586,7 @@ interface Namespace { * * @example * var list = ns.complexarrayDataTypes(); - * // returns [ 'complex64', 'complex128' ] + * // e.g., returns [ 'complex64', ... ] */ complexarrayDataTypes: typeof complexarrayDataTypes; @@ -1483,7 +1613,7 @@ interface Namespace { * * @example * var list = ns.typedarrayDataTypes(); - * // e.g., returns [ 'float32', 'float64', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64' ] + * // e.g., returns [ 'float32', ... ] */ typedarrayDataTypes: typeof typedarrayDataTypes; @@ -1510,7 +1640,7 @@ interface Namespace { * * @example * var list = ns.floatarrayDataTypes(); - * // e.g., returns [ 'float32', 'float64', 'complex64', 'complex128' ] + * // e.g., returns [ 'float32', ... ] */ floatarrayDataTypes: typeof floatarrayDataTypes; @@ -1537,7 +1667,7 @@ interface Namespace { * * @example * var list = ns.intarrayDataTypes(); - * // e.g., returns [ 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c' ] + * // e.g., returns [ 'int16', ... ] */ intarrayDataTypes: typeof intarrayDataTypes; @@ -1583,13 +1713,13 @@ interface Namespace { realarrayCtors: typeof realarrayCtors; /** - * Returns a list of typed array data types. + * Returns a list of typed array real-valued data types. * * @returns list of typed array data types * * @example * var list = ns.realarrayDataTypes(); - * // e.g., returns [ 'float32', 'float64', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c' ] + * // e.g., returns [ 'float32', ... ] */ realarrayDataTypes: typeof realarrayDataTypes; @@ -1616,7 +1746,7 @@ interface Namespace { * * @example * var list = ns.realarrayFloatDataTypes(); - * // e.g., returns [ 'float32', 'float64' ] + * // e.g., returns [ 'float32', ... ] */ realarrayFloatDataTypes: typeof realarrayFloatDataTypes; @@ -1643,7 +1773,7 @@ interface Namespace { * * @example * var list = ns.intarraySignedDataTypes(); - * // e.g., returns [ 'int16', 'int32', 'int8' ] + * // e.g., returns [ 'int16', ... ] */ intarraySignedDataTypes: typeof intarraySignedDataTypes; @@ -1670,7 +1800,7 @@ interface Namespace { * * @example * var list = ns.intarrayUnsignedDataTypes(); - * // e.g., returns [ 'uint16', 'uint32', 'uint8', 'uint8c' ] + * // e.g., returns [ 'uint16', ... ] */ intarrayUnsignedDataTypes: typeof intarrayUnsignedDataTypes; @@ -1702,14 +1832,14 @@ interface Namespace { * @returns linearly spaced numeric array * * @example - * var arr = ns.azeroTo( 2 ); + * var arr = ns.zeroTo( 2 ); * // returns [ 0.0, 1.0 ] * * @example - * var arr = ns.azeroTo( 2, 'float32' ); + * var arr = ns.zeroTo( 2, 'float32' ); * // returns [ 0.0, 1.0 ] */ - azeroTo: typeof azeroTo; + zeroTo: typeof zeroTo; /** * 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. @@ -1724,10 +1854,10 @@ interface Namespace { * var x = zeros( 2, 'float32' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.azeroToLike( x ); + * var y = ns.zeroToLike( x ); * // returns [ 0.0, 1.0 ] */ - azeroToLike: typeof azeroToLike; + zeroToLike: typeof zeroToLike; /** * Creates a zero-filled array having a specified length. @@ -1752,14 +1882,14 @@ interface Namespace { * @returns zero-filled array * * @example - * var arr = ns.azeros( 2 ); + * var arr = ns.zeros( 2 ); * // returns [ 0.0, 0.0 ] * * @example - * var arr = ns.azeros( 2, 'float32' ); + * var arr = ns.zeros( 2, 'float32' ); * // returns [ 0.0, 0.0 ] */ - azeros: typeof azeros; + zeros: typeof zeros; /** * Creates a zero-filled array having the same length and data type as a provided input array. @@ -1789,7 +1919,7 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.azerosLike( x ); + * var y = ns.zerosLike( x ); * // returns [ 0.0, 0.0 ] * * @example @@ -1798,10 +1928,10 @@ interface Namespace { * var x = zeros( 2, 'float64' ); * // returns [ 0.0, 0.0 ] * - * var y = ns.azerosLike( x, 'float32' ); + * var y = ns.zerosLike( x, 'float32' ); * // returns [ 0.0, 0.0 ] */ - azerosLike: typeof azerosLike; + zerosLike: typeof zerosLike; /** * Array constants. diff --git a/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts index 7b62c0345021..351d1702224c 100644 --- a/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts @@ -21,55 +21,55 @@ /* eslint-disable max-lines */ import array = require( '@stdlib/ndarray/array' ); -import ndat = require( '@stdlib/ndarray/at' ); +import at = require( '@stdlib/ndarray/at' ); import base = require( '@stdlib/ndarray/base' ); import broadcastArray = require( '@stdlib/ndarray/broadcast-array' ); import broadcastArrays = require( '@stdlib/ndarray/broadcast-arrays' ); -import ndarrayCastingModes = require( '@stdlib/ndarray/casting-modes' ); +import castingModes = require( '@stdlib/ndarray/casting-modes' ); import ndarray = require( '@stdlib/ndarray/ctor' ); -import ndarrayDataBuffer = require( '@stdlib/ndarray/data-buffer' ); +import dataBuffer = require( '@stdlib/ndarray/data-buffer' ); import defaults = require( '@stdlib/ndarray/defaults' ); import dispatch = require( '@stdlib/ndarray/dispatch' ); -import ndarrayDataType = require( '@stdlib/ndarray/dtype' ); -import ndarrayDataTypes = require( '@stdlib/ndarray/dtypes' ); -import ndempty = require( '@stdlib/ndarray/empty' ); -import ndemptyLike = require( '@stdlib/ndarray/empty-like' ); +import dtype = require( '@stdlib/ndarray/dtype' ); +import dtypes = require( '@stdlib/ndarray/dtypes' ); +import empty = require( '@stdlib/ndarray/empty' ); +import emptyLike = require( '@stdlib/ndarray/empty-like' ); import FancyArray = require( '@stdlib/ndarray/fancy' ); -import ndarrayFlag = require( '@stdlib/ndarray/flag' ); -import ndarrayFlags = require( '@stdlib/ndarray/flags' ); +import flag = require( '@stdlib/ndarray/flag' ); +import flags = require( '@stdlib/ndarray/flags' ); import scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); import ind2sub = require( '@stdlib/ndarray/ind2sub' ); -import ndarrayIndexModes = require( '@stdlib/ndarray/index-modes' ); +import indexModes = require( '@stdlib/ndarray/index-modes' ); import iter = require( '@stdlib/ndarray/iter' ); import maybeBroadcastArray = require( '@stdlib/ndarray/maybe-broadcast-array' ); import maybeBroadcastArrays = require( '@stdlib/ndarray/maybe-broadcast-arrays' ); -import ndarrayMinDataType = require( '@stdlib/ndarray/min-dtype' ); -import ndarrayMostlySafeCasts = require( '@stdlib/ndarray/mostly-safe-casts' ); +import minDataType = require( '@stdlib/ndarray/min-dtype' ); +import mostlySafeCasts = require( '@stdlib/ndarray/mostly-safe-casts' ); import ndims = require( '@stdlib/ndarray/ndims' ); -import ndarrayNextDataType = require( '@stdlib/ndarray/next-dtype' ); +import nextDataType = require( '@stdlib/ndarray/next-dtype' ); import numel = require( '@stdlib/ndarray/numel' ); import numelDimension = require( '@stdlib/ndarray/numel-dimension' ); -import ndarrayOffset = require( '@stdlib/ndarray/offset' ); -import ndarrayOrder = require( '@stdlib/ndarray/order' ); -import ndarrayOrders = require( '@stdlib/ndarray/orders' ); -import ndarrayOutputDataTypePolicies = require( '@stdlib/ndarray/output-dtype-policies' ); -import ndarrayPromotionRules = require( '@stdlib/ndarray/promotion-rules' ); -import ndarraySafeCasts = require( '@stdlib/ndarray/safe-casts' ); -import ndarraySameKindCasts = require( '@stdlib/ndarray/same-kind-casts' ); -import ndarrayShape = require( '@stdlib/ndarray/shape' ); -import ndslice = require( '@stdlib/ndarray/slice' ); +import offset = require( '@stdlib/ndarray/offset' ); +import order = require( '@stdlib/ndarray/order' ); +import orders = require( '@stdlib/ndarray/orders' ); +import outputDataTypePolicies = require( '@stdlib/ndarray/output-dtype-policies' ); +import promotionRules = require( '@stdlib/ndarray/promotion-rules' ); +import safeCasts = require( '@stdlib/ndarray/safe-casts' ); +import sameKindCasts = require( '@stdlib/ndarray/same-kind-casts' ); +import shape = require( '@stdlib/ndarray/shape' ); +import slice = require( '@stdlib/ndarray/slice' ); import ndsliceAssign = require( '@stdlib/ndarray/slice-assign' ); -import ndsliceDimension = require( '@stdlib/ndarray/slice-dimension' ); -import ndsliceDimensionFrom = require( '@stdlib/ndarray/slice-dimension-from' ); -import ndsliceDimensionTo = require( '@stdlib/ndarray/slice-dimension-to' ); -import ndsliceFrom = require( '@stdlib/ndarray/slice-from' ); -import ndsliceTo = require( '@stdlib/ndarray/slice-to' ); -import ndarrayStride = require( '@stdlib/ndarray/stride' ); -import ndarrayStrides = require( '@stdlib/ndarray/strides' ); +import sliceDimension = require( '@stdlib/ndarray/slice-dimension' ); +import sliceDimensionFrom = require( '@stdlib/ndarray/slice-dimension-from' ); +import sliceDimensionTo = require( '@stdlib/ndarray/slice-dimension-to' ); +import sliceFrom = require( '@stdlib/ndarray/slice-from' ); +import sliceTo = require( '@stdlib/ndarray/slice-to' ); +import stride = require( '@stdlib/ndarray/stride' ); +import strides = require( '@stdlib/ndarray/strides' ); import sub2ind = require( '@stdlib/ndarray/sub2ind' ); import ndarray2array = require( '@stdlib/ndarray/to-array' ); -import ndzeros = require( '@stdlib/ndarray/zeros' ); -import ndzerosLike = require( '@stdlib/ndarray/zeros-like' ); +import zeros = require( '@stdlib/ndarray/zeros' ); +import zerosLike = require( '@stdlib/ndarray/zeros-like' ); /** * Interface describing the `ndarray` namespace. @@ -152,13 +152,13 @@ interface Namespace { * }); * // returns * - * var v = ns.ndat( x, 0, 0 ); + * var v = ns.at( x, 0, 0 ); * // returns 0 * - * v = ns.ndat( x, 5, 5 ); + * v = ns.at( x, 5, 5 ); * // returns undefined */ - ndat: typeof ndat; + at: typeof at; /** * Base ndarray. @@ -310,10 +310,10 @@ interface Namespace { * @returns list of ndarray casting modes * * @example - * var list = ns.ndarrayCastingModes(); + * var list = ns.castingModes(); * // returns [ 'none', 'equiv', 'safe', 'mostly-safe', 'same-kind', 'unsafe' ] */ - ndarrayCastingModes: typeof ndarrayCastingModes; + castingModes: typeof castingModes; /** * ndarray constructor. @@ -363,10 +363,10 @@ interface Namespace { * 'dtype': 'float64' * }); * - * var out = ns.ndarrayDataBuffer( x ); + * var out = ns.dataBuffer( x ); * // returns */ - ndarrayDataBuffer: typeof ndarrayDataBuffer; + dataBuffer: typeof dataBuffer; /** * Returns default ndarray settings. @@ -443,47 +443,29 @@ interface Namespace { * var zeros = require( '@stdlib/ndarray/zeros' ); * * var x = zeros( [ 3, 3, 3 ], { - * 'ns.ndarrayDataType': 'float64' + * 'ns.dtype': 'float64' * }); * - * var dt = ns.ndarrayDataType( x ); + * var dt = ns.dtype( x ); * // returns 'float64' */ - ndarrayDataType: typeof ndarrayDataType; + dtype: typeof dtype; /** * Returns a list of ndarray data types. * - * ## Notes - * - * - When not provided a data type "kind", the function returns an array containing the following data types: - * - * - `binary`: binary. - * - `complex64`: single-precision complex floating-point numbers. - * - `complex128`: double-precision complex floating-point numbers. - * - `float32`: single-precision floating-point numbers. - * - `float64`: double-precision floating-point numbers. - * - `generic`: values of any type. - * - `int16`: signed 16-bit integers. - * - `int32`: signed 32-bit integers. - * - `int8`: signed 8-bit integers. - * - `uint16`: unsigned 16-bit integers. - * - `uint32`: unsigned 32-bit integers. - * - `uint8`: unsigned 8-bit integers. - * - `uint8c`: unsigned clamped 8-bit integers. - * * @param kind - data type kind * @returns list of ndarray data types * * @example - * var list = ns.ndarrayDataTypes(); + * var list = ns.dtypes(); * // returns [...] * * @example - * var list = ns.ndarrayDataTypes( 'floating_point' ); + * var list = ns.dtypes( 'floating_point' ); * // returns [...] */ - ndarrayDataTypes: typeof ndarrayDataTypes; + dtypes: typeof dtypes; /** * Creates an uninitialized array having a specified shape and data type. @@ -497,7 +479,7 @@ interface Namespace { * @returns zero-filled array * * @example - * var arr = ns.ndempty( [ 2, 2 ] ); + * var arr = ns.empty( [ 2, 2 ] ); * // returns * * var sh = arr.shape; @@ -506,7 +488,7 @@ interface Namespace { * var dt = arr.dtype; * // returns 'float64' */ - ndempty: typeof ndempty; + empty: typeof empty; /** * Creates an uninitialized array having the same shape and data type as a provided input ndarray. @@ -534,7 +516,7 @@ interface Namespace { * var dt = x.dtype; * // returns 'generic' * - * var y = ns.ndemptyLike( x ); + * var y = ns.emptyLike( x ); * // returns * * sh = y.shape; @@ -543,7 +525,7 @@ interface Namespace { * dt = y.dtype; * // returns 'generic' */ - ndemptyLike: typeof ndemptyLike; + emptyLike: typeof emptyLike; /** * Fancy array constructor. @@ -590,10 +572,10 @@ interface Namespace { * @example * var zeros = require( '@stdlib/ndarray/zeros' ); * - * var o = ns.ndarrayFlag( zeros( [ 3, 3, 3 ] ), 'READONLY' ); + * var o = ns.flag( zeros( [ 3, 3, 3 ] ), 'READONLY' ); * // returns */ - ndarrayFlag: typeof ndarrayFlag; + flag: typeof flag; /** * Returns the flags of a provided ndarray. @@ -604,10 +586,10 @@ interface Namespace { * @example * var zeros = require( '@stdlib/ndarray/zeros' ); * - * var o = ns.ndarrayFlags( zeros( [ 3, 3, 3 ] ) ); + * var o = ns.flags( zeros( [ 3, 3, 3 ] ) ); * // returns {...} */ - ndarrayFlags: typeof ndarrayFlags; + flags: typeof flags; /** * Returns a zero-dimensional ndarray containing a provided scalar value. @@ -616,8 +598,9 @@ interface Namespace { * * - If a `dtype` option is not provided and `value` * - * - is a `number`, the default data type is `'float64'`. - * - is a complex number object, the default data type is `'complex128'`. + * - is a `number`, the default data type is the default real-valued floating-point data type. + * - is a complex number object of a known complex data type, the data type is the same as the provided value. + * - is a complex number object of an unknown complex data type, the default data type is the default complex-valued floating-point data type. * - is any other value type, the default data type is `'generic'`. * * @param value - scalar value @@ -698,10 +681,10 @@ interface Namespace { * @returns list of ndarray index modes * * @example - * var list = ns.ndarrayIndexModes(); + * var list = ns.indexModes(); * // returns [ 'throw', 'normalize', 'clamp', 'wrap' ] */ - ndarrayIndexModes: typeof ndarrayIndexModes; + indexModes: typeof indexModes; /** * Multidimensional array iterators. @@ -830,14 +813,14 @@ interface Namespace { * @returns ndarray data type * * @example - * var dt = ns.ndarrayMinDataType( 3.141592653589793 ); + * var dt = ns.minDataType( 3.141592653589793 ); * // returns 'float32' * * @example - * var dt = ns.ndarrayMinDataType( 3 ); + * var dt = ns.minDataType( 3 ); * // returns 'uint8' */ - ndarrayMinDataType: typeof ndarrayMinDataType; + minDataType: typeof minDataType; /** * Returns a list of ndarray data types to which a provided ndarray data type can be safely cast and, for floating-point data types, can be downcast. @@ -851,10 +834,10 @@ interface Namespace { * @returns list of ndarray data types or null * * @example - * var list = ns.ndarrayMostlySafeCasts( 'float32' ); + * var list = ns.mostlySafeCasts( 'float32' ); * // returns [...] */ - ndarrayMostlySafeCasts: typeof ndarrayMostlySafeCasts; + mostlySafeCasts: typeof mostlySafeCasts; /** * Returns the number of ndarray dimensions. @@ -883,10 +866,10 @@ interface Namespace { * @returns next larger data type(s) or null * * @example - * var dt = ns.ndarrayNextDataType( 'float32' ); + * var dt = ns.nextDataType( 'float32' ); * // returns 'float64' */ - ndarrayNextDataType: typeof ndarrayNextDataType; + nextDataType: typeof nextDataType; /** * Returns the number of elements in an ndarray. @@ -926,10 +909,10 @@ interface Namespace { * @example * var zeros = require( '@stdlib/ndarray/zeros' ); * - * var n = ns.ndarrayOffset( zeros( [ 3, 3, 3 ] ) ); + * var n = ns.offset( zeros( [ 3, 3, 3 ] ) ); * // returns 0 */ - ndarrayOffset: typeof ndarrayOffset; + offset: typeof offset; /** * Returns the layout order of a provided ndarray. @@ -945,13 +928,13 @@ interface Namespace { * var zeros = require( '@stdlib/ndarray/zeros' ); * * var x = zeros( [ 3, 3, 3 ], { - * 'ns.ndarrayOrder': 'row-major' + * 'ns.order': 'row-major' * }); * - * var o = ns.ndarrayOrder( x ); + * var o = ns.order( x ); * // returns 'row-major' */ - ndarrayOrder: typeof ndarrayOrder; + order: typeof order; /** * Returns a list of ndarray orders. @@ -966,10 +949,10 @@ interface Namespace { * @returns list of ndarray orders * * @example - * var list = ns.ndarrayOrders(); + * var list = ns.orders(); * // returns [ 'row-major', 'column-major' ] */ - ndarrayOrders: typeof ndarrayOrders; + orders: typeof orders; /** * Returns a list of output ndarray data type policies. @@ -994,10 +977,10 @@ interface Namespace { * @returns list of data type policies * * @example - * var list = ns.ndarrayOutputDataTypePolicies(); + * var list = ns.outputDataTypePolicies(); * // returns [...] */ - ndarrayOutputDataTypePolicies: typeof ndarrayOutputDataTypePolicies; + outputDataTypePolicies: typeof outputDataTypePolicies; /** * Returns a type promotion table displaying the ndarray data types with the smallest size and closest "kind" to which ndarray data types can be safely cast. @@ -1005,10 +988,10 @@ interface Namespace { * @returns promotion rule table * * @example - * var table = ns.ndarrayPromotionRules(); + * var table = ns.promotionRules(); * // returns {...} */ - ndarrayPromotionRules: typeof ndarrayPromotionRules; + promotionRules: typeof promotionRules; /** * Returns a list of ndarray data types to which a provided ndarray data type can be safely cast. @@ -1022,10 +1005,10 @@ interface Namespace { * @returns list of ndarray data types or null * * @example - * var list = ns.ndarraySafeCasts( 'float32' ); + * var list = ns.safeCasts( 'float32' ); * // returns [...] */ - ndarraySafeCasts: typeof ndarraySafeCasts; + safeCasts: typeof safeCasts; /** * Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". @@ -1039,10 +1022,10 @@ interface Namespace { * @returns list of ndarray data types or null * * @example - * var list = ns.ndarraySameKindCasts( 'float32' ); + * var list = ns.sameKindCasts( 'float32' ); * // returns [...] */ - ndarraySameKindCasts: typeof ndarraySameKindCasts; + sameKindCasts: typeof sameKindCasts; /** * Returns the shape of a provided ndarray. @@ -1053,10 +1036,10 @@ interface Namespace { * @example * var zeros = require( '@stdlib/ndarray/zeros' ); * - * var sh = ns.ndarrayShape( zeros( [ 3, 3, 3 ] ) ); + * var sh = ns.shape( zeros( [ 3, 3, 3 ] ) ); * // returns [ 3, 3, 3 ] */ - ndarrayShape: typeof ndarrayShape; + shape: typeof shape; /** * Returns a read-only view of an input ndarray. @@ -1068,8 +1051,8 @@ interface Namespace { * @returns output array * * @example - * var Slice = require( '@stdlib/ns.ndslice/ctor' ); - * var MultiSlice = require( '@stdlib/ns.ndslice/multi' ); + * var Slice = require( '@stdlib/ns.slice/ctor' ); + * var MultiSlice = require( '@stdlib/ns.slice/multi' ); * var ndarray = require( '@stdlib/ndarray/ctor' ); * var ndarray2array = require( '@stdlib/ndarray/to-array' ); * @@ -1090,7 +1073,7 @@ interface Namespace { * var s0 = new Slice( null, null, -2 ); * var s1 = new Slice( null, null, -1 ); * - * var y = ns.ndslice( x, s0, s1 ); + * var y = ns.slice( x, s0, s1 ); * // returns * * sh = y.shape; @@ -1099,7 +1082,7 @@ interface Namespace { * arr = ndarray2array( y ); * // returns [ [ 6, 5 ], [ 2, 1 ] ] */ - ndslice: typeof ndslice; + slice: typeof slice; /** * Assigns element values from a broadcasted input ndarray to corresponding elements in an output ndarray view. @@ -1193,7 +1176,7 @@ interface Namespace { * var s = new Slice( null, null, -1 ); * // returns * - * var y = ns.ndsliceDimension( x, 0, s ); + * var y = ns.sliceDimension( x, 0, s ); * // returns * * sh = y.shape; @@ -1202,7 +1185,7 @@ interface Namespace { * arr = ndarray2array( y ); * // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ] */ - ndsliceDimension: typeof ndsliceDimension; + sliceDimension: typeof sliceDimension; /** * Returns a read-only shifted view of an input ndarray along a specified dimension. @@ -1231,7 +1214,7 @@ interface Namespace { * var arr = ndarray2array( x ); * // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] * - * var y = ns.ndsliceDimensionFrom( x, 0, 1 ); + * var y = ns.sliceDimensionFrom( x, 0, 1 ); * // returns * * sh = y.shape; @@ -1240,7 +1223,7 @@ interface Namespace { * arr = ndarray2array( y ); * // returns [ [ 3, 4 ], [ 5, 6 ] ] */ - ndsliceDimensionFrom: typeof ndsliceDimensionFrom; + sliceDimensionFrom: typeof sliceDimensionFrom; /** * Returns a read-only truncated view of an input ndarray along a specified dimension. @@ -1269,7 +1252,7 @@ interface Namespace { * var arr = ndarray2array( x ); * // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] * - * var y = ns.ndsliceDimensionTo( x, 0, 2 ); + * var y = ns.sliceDimensionTo( x, 0, 2 ); * // returns * * sh = y.shape; @@ -1278,7 +1261,7 @@ interface Namespace { * arr = ndarray2array( y ); * // returns [ [ 1, 2 ], [ 3, 4 ] ] */ - ndsliceDimensionTo: typeof ndsliceDimensionTo; + sliceDimensionTo: typeof sliceDimensionTo; /** * Returns a read-only shifted view of an input ndarray. @@ -1307,7 +1290,7 @@ interface Namespace { * var arr = ndarray2array( x ); * // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] * - * var y = ns.ndsliceFrom( x, 1, null ); + * var y = ns.sliceFrom( x, 1, null ); * // returns * * sh = y.shape; @@ -1316,7 +1299,7 @@ interface Namespace { * arr = ndarray2array( y ); * // returns [ [ 3, 4 ], [ 5, 6 ] ] */ - ndsliceFrom: typeof ndsliceFrom; + sliceFrom: typeof sliceFrom; /** * Returns a read-only truncated view of an input ndarray. @@ -1345,7 +1328,7 @@ interface Namespace { * var arr = ndarray2array( x ); * // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] * - * var y = ns.ndsliceTo( x, 2, null ); + * var y = ns.sliceTo( x, 2, null ); * // returns * * sh = y.shape; @@ -1354,7 +1337,7 @@ interface Namespace { * arr = ndarray2array( y ); * // returns [ [ 1, 2 ], [ 3, 4 ] ] */ - ndsliceTo: typeof ndsliceTo; + sliceTo: typeof sliceTo; /** * Returns the stride along a specified dimension for a provided ndarray. @@ -1370,10 +1353,10 @@ interface Namespace { * @example * var zeros = require( '@stdlib/ndarray/zeros' ); * - * var st = ns.ndarrayStride( zeros( [ 3, 3, 3 ] ), 0 ); + * var st = ns.stride( zeros( [ 3, 3, 3 ] ), 0 ); * // returns 9 */ - ndarrayStride: typeof ndarrayStride; + stride: typeof stride; /** * Returns the strides of a provided ndarray. @@ -1384,10 +1367,10 @@ interface Namespace { * @example * var zeros = require( '@stdlib/ndarray/zeros' ); * - * var sh = ns.ndarrayStrides( zeros( [ 3, 3, 3 ] ) ); + * var sh = ns.strides( zeros( [ 3, 3, 3 ] ) ); * // returns [ 9, 3, 1 ] */ - ndarrayStrides: typeof ndarrayStrides; + strides: typeof strides; /** * Converts subscripts to a linear index. @@ -1446,7 +1429,7 @@ interface Namespace { * @returns zero-filled array * * @example - * var arr = ns.ndzeros( [ 2, 2 ] ); + * var arr = ns.zeros( [ 2, 2 ] ); * // returns * * var sh = arr.shape; @@ -1455,7 +1438,7 @@ interface Namespace { * var dt = arr.dtype; * // returns 'float64' */ - ndzeros: typeof ndzeros; + zeros: typeof zeros; /** * Creates a zero-filled array having the same shape and data type as a provided input ndarray. @@ -1484,7 +1467,7 @@ interface Namespace { * var dt = x.dtype; * // returns 'generic' * - * var y = ns.ndzerosLike( x ); + * var y = ns.zerosLike( x ); * // returns * * sh = y.shape; @@ -1493,7 +1476,7 @@ interface Namespace { * dt = y.dtype; * // returns 'generic' */ - ndzerosLike: typeof ndzerosLike; + zerosLike: typeof zerosLike; } /** diff --git a/lib/node_modules/@stdlib/random/array/tools/docs/types/index.d.ts b/lib/node_modules/@stdlib/random/array/tools/docs/types/index.d.ts index 2b7e075c29a1..b7e29d5d78e8 100644 --- a/lib/node_modules/@stdlib/random/array/tools/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/random/array/tools/docs/types/index.d.ts @@ -21,19 +21,105 @@ /* eslint-disable max-lines */ import binary = require( '@stdlib/random/array/tools/binary' ); +import binaryFactory = require( '@stdlib/random/array/tools/binary-factory' ); +import nullary = require( '@stdlib/random/array/tools/nullary' ); +import ternary = require( '@stdlib/random/array/tools/ternary' ); +import ternaryFactory = require( '@stdlib/random/array/tools/ternary-factory' ); +import unary = require( '@stdlib/random/array/tools/unary' ); +import unaryFactory = require( '@stdlib/random/array/tools/unary-factory' ); /** * Interface describing the `tools` namespace. */ interface Namespace { /** - * TODO + * Constructor for creating arrays filled with pseudorandom values drawn from a binary PRNG. + * + * @param prng - binary pseudorandom value generator + * @param dtypes - list of supported output data types + * @param dtype - default output data type + * @returns instance + * + * @example + * var arcsine = require( '@stdlib/random/base/arcsine' ); + * + * var dtypes = [ 'float64', 'float32', 'generic' ]; + * var defaultDType = 'float64'; + * + * var rand = new RandomArray( arcsine, dtypes, defaultDType ); + * + * var v = rand.generate( 10, 2.0, 5.0 ); + * // returns */ binary: typeof binary; + + /** + * Constructor for creating arrays filled with pseudorandom values drawn from a nullary PRNG. + * + * @param prng - nullary pseudorandom value generator + * @param dtypes - list of supported output data types + * @param dtype - default output data type + * @returns instance + * + * @example + * var exponential = require( '@stdlib/random/base/exponential' ); + * + * var dtypes = [ 'float64', 'float32', 'generic' ]; + * var defaultDType = 'float64'; + * + * var rand = new RandomArray( exponential.fanullaryy( 2.0 ), dtypes, defaultDType ); + * + * var v = rand.generate( 10 ); + * // returns + */ + nullary: typeof nullary; + + /** + * Constructor for creating arrays filled with pseudorandom values drawn from a ternary PRNG. + * + * @param prng - ternary pseudorandom value generator + * @param dtypes - list of supported output data types + * @param dtype - default output data type + * @returns instance + * + * @example + * var triangular = require( '@stdlib/random/base/triangular' ); + * + * var dtypes = [ 'float64', 'float32', 'generic' ]; + * var defaultDType = 'float64'; + * + * var rand = new RandomArray( triangular, dtypes, defaultDType ); + * + * var v = rand.generate( 10, 2.0, 5.0, 3.33 ); + * // returns + */ + ternary: typeof ternary; + + /** + * Constructor for creating arrays filled with pseudorandom values drawn from a unary PRNG. + * + * @param prng - unary pseudorandom value generator + * @param dtypes - list of supported output data types + * @param dtype - default output data type + * @returns instance + * + * @example + * var exponential = require( '@stdlib/random/base/exponential' ); + * + * var dtypes = [ 'float64', 'float32', 'generic' ]; + * var defaultDType = 'float64'; + * + * var rand = new RandomArray( exponential, dtypes, defaultDType ); + * + * var v = rand.generate( 10, 2.0 ); + * // returns + */ + unary: typeof unary; + } /** -* TODO +* Pseudorandom number generator array creation function tools. */ declare var ns: Namespace; diff --git a/lib/node_modules/@stdlib/random/strided/docs/types/index.d.ts b/lib/node_modules/@stdlib/random/strided/docs/types/index.d.ts index c1c2e5aa15c2..acdb3a0b7c3d 100644 --- a/lib/node_modules/@stdlib/random/strided/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/random/strided/docs/types/index.d.ts @@ -21,19 +21,26 @@ /* eslint-disable max-lines */ import arcsine = require( '@stdlib/random/strided/arcsine' ); +import bernoulli = require( '@stdlib/random/strided/bernoulli' ); import beta = require( '@stdlib/random/strided/beta' ); import betaprime = require( '@stdlib/random/strided/betaprime' ); +import chi = require( '@stdlib/random/strided/chi' ); +import chisquare = require( '@stdlib/random/strided/chisquare' ); import cosine = require( '@stdlib/random/strided/cosine' ); import discreteUniform = require( '@stdlib/random/strided/discrete-uniform' ); import exponential = require( '@stdlib/random/strided/exponential' ); import gamma = require( '@stdlib/random/strided/gamma' ); +import geometric = require( '@stdlib/random/strided/geometric' ); import invgamma = require( '@stdlib/random/strided/invgamma' ); import lognormal = require( '@stdlib/random/strided/lognormal' ); import minstd = require( '@stdlib/random/strided/minstd' ); import minstdShuffle = require( '@stdlib/random/strided/minstd-shuffle' ); import mt19937 = require( '@stdlib/random/strided/mt19937' ); import normal = require( '@stdlib/random/strided/normal' ); +import poisson = require( '@stdlib/random/strided/poisson' ); import randu = require( '@stdlib/random/strided/randu' ); +import rayleigh = require( '@stdlib/random/strided/rayleigh' ); +import t = require( '@stdlib/random/strided/t' ); import uniform = require( '@stdlib/random/strided/uniform' ); import weibull = require( '@stdlib/random/strided/weibull' ); @@ -77,6 +84,36 @@ interface Namespace { */ arcsine: typeof arcsine; + /** + * Fills a strided array with pseudorandom numbers drawn from a Bernoulli distribution. + * + * @param N - number of indexed elements + * @param p - success probability + * @param sp - `p` stride length + * @param out - output array + * @param so - `out` stride length + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.bernoulli( out.length, [ 0.5 ], 0, out, 1 ); + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.bernoulli.ndarray( out.length, [ 0.5 ], 0, 0, out, 1, 0 ); + */ + bernoulli: typeof bernoulli; + /** * Fills a strided array with pseudorandom numbers drawn from a beta distribution. * @@ -149,6 +186,66 @@ interface Namespace { */ betaprime: typeof betaprime; + /** + * Fills a strided array with pseudorandom numbers drawn from a chi distribution. + * + * @param N - number of indexed elements + * @param k - degrees of freedom + * @param sk - `k` stride length + * @param out - output array + * @param so - `out` stride length + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.chi( out.length, [ 2.0 ], 0, out, 1 ); + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.chi.ndarray( out.length, [ 2.0 ], 0, 0, out, 1, 0 ); + */ + chi: typeof chi; + + /** + * Fills a strided array with pseudorandom numbers drawn from a chi-square distribution. + * + * @param N - number of indexed elements + * @param k - degrees of freedom + * @param sk - `k` stride length + * @param out - output array + * @param so - `out` stride length + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.chisquare( out.length, [ 2.0 ], 0, out, 1 ); + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.chisquare.ndarray( out.length, [ 2.0 ], 0, 0, out, 1, 0 ); + */ + chisquare: typeof chisquare; + /** * Fills a strided array with pseudorandom numbers drawn from a raised cosine distribution. * @@ -287,6 +384,36 @@ interface Namespace { */ gamma: typeof gamma; + /** + * Fills a strided array with pseudorandom numbers drawn from a geometric distribution. + * + * @param N - number of indexed elements + * @param p - success probability + * @param sp - `p` stride length + * @param out - output array + * @param so - `out` stride length + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.geometric( out.length, [ 0.01 ], 0, out, 1 ); + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.geometric.ndarray( out.length, [ 0.01 ], 0, 0, out, 1, 0 ); + */ + geometric: typeof geometric; + /** * Fills a strided array with pseudorandom numbers drawn from an inverse gamma distribution. * @@ -542,6 +669,36 @@ interface Namespace { */ normal: typeof normal; + /** + * Fills a strided array with pseudorandom numbers drawn from a Poisson distribution. + * + * @param N - number of indexed elements + * @param lambda - mean parameter + * @param sl - `lambda` stride length + * @param out - output array + * @param so - `out` stride length + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.poisson( out.length, [ 2.0 ], 0, out, 1 ); + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.poisson.ndarray( out.length, [ 2.0 ], 0, 0, out, 1, 0 ); + */ + poisson: typeof poisson; + /** * Fills a strided array with uniformly distributed pseudorandom numbers between `0` and `1`. * @@ -573,6 +730,66 @@ interface Namespace { */ randu: typeof randu; + /** + * Fills a strided array with pseudorandom numbers drawn from a Rayleigh distribution. + * + * @param N - number of indexed elements + * @param sigma - scale parameter + * @param ss - `sigma` stride length + * @param out - output array + * @param so - `out` stride length + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.rayleigh( out.length, [ 2.0 ], 0, out, 1 ); + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill the array with pseudorandom numbers: + * ns.rayleigh.ndarray( out.length, [ 2.0 ], 0, 0, out, 1, 0 ); + */ + rayleigh: typeof rayleigh; + + /** + * Fills a strided array with pseudorandom numbers drawn from a Student's t distribution. + * + * @param N - number of indexed elements + * @param v - degrees of freedom + * @param sv - `v` stride length + * @param out - output array + * @param so - `out` stride length + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill ns.the array with pseudorandom numbers: + * ns.t( out.length, [ 2.0 ], 0, out, 1 ); + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create an array: + * var out = new Float64Array( 10 ); + * + * // Fill ns.the array with pseudorandom numbers: + * ns.t.ndarray( out.length, [ 2.0 ], 0, 0, out, 1, 0 ); + */ + t: typeof t; + /** * Fills a strided array with pseudorandom numbers drawn from a continuous uniform distribution. * diff --git a/lib/node_modules/@stdlib/random/strided/tools/docs/types/index.d.ts b/lib/node_modules/@stdlib/random/strided/tools/docs/types/index.d.ts index 322756fbd73c..70a411643605 100644 --- a/lib/node_modules/@stdlib/random/strided/tools/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/random/strided/tools/docs/types/index.d.ts @@ -20,20 +20,19 @@ /* eslint-disable max-lines */ -import binaryFactory = require( '@stdlib/random/array/tools/binary-factory' ); +import binaryFactory = require( '@stdlib/random/strided/tools/binary-factory' ); +import ternaryFactory = require( '@stdlib/random/strided/tools/ternary-factory' ); +import unaryFactory = require( '@stdlib/random/strided/tools/unary-factory' ); /** * Interface describing the `tools` namespace. */ interface Namespace { - /** - * TODO - */ - binaryFactory: typeof binaryFactory; + } /** -* TODO +* Pseudorandom number generator strided array function tools. */ declare var ns: Namespace; diff --git a/lib/node_modules/@stdlib/slice/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/slice/base/docs/types/index.d.ts index eeee5cfa916b..f10665d4c386 100644 --- a/lib/node_modules/@stdlib/slice/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/slice/base/docs/types/index.d.ts @@ -21,6 +21,7 @@ /* eslint-disable max-lines */ import args2multislice = require( '@stdlib/slice/base/args2multislice' ); +import int2slice = require( '@stdlib/slice/base/int2slice' ); import sliceLength = require( '@stdlib/slice/base/length' ); import nonreducedDimensions = require( '@stdlib/slice/base/nonreduced-dimensions' ); import normalizeMultiSlice = require( '@stdlib/slice/base/normalize-multi-slice' ); @@ -82,6 +83,33 @@ interface Namespace { */ args2multislice: typeof args2multislice; + /** + * Converts an integer to a Slice object. + * + * ## Notes + * + * - If `strict` is `true`, the function returns an error object when an input value exceeds index bounds. + * + * @param value - input value + * @param max - index upper bound (exclusive) + * @param strict - boolean indicating whether to enforce strict bounds checking + * @returns Slice object (or an error object) + * + * @example + * var s = ns.int2slice( -4, 10, false ); + * // returns + * + * var start = s.start; + * // returns 6 + * + * var stop = s.stop; + * // returns 7 + * + * var step = s.step; + * // returns 1 + */ + int2slice: typeof int2slice; + /** * Returns the number of elements in a normalized slice. * diff --git a/lib/node_modules/@stdlib/strided/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/strided/base/docs/types/index.d.ts index 4769e4c35c45..6ae9086f2c5f 100644 --- a/lib/node_modules/@stdlib/strided/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/strided/base/docs/types/index.d.ts @@ -47,6 +47,7 @@ import nullaryAddonDispatch = require( '@stdlib/strided/base/nullary-addon-dispa import offsetView = require( '@stdlib/strided/base/offset-view' ); import quaternary = require( '@stdlib/strided/base/quaternary' ); import quinary = require( '@stdlib/strided/base/quinary' ); +import reinterpretComplex = require( '@stdlib/strided/base/reinterpret-complex' ); import reinterpretComplex64 = require( '@stdlib/strided/base/reinterpret-complex64' ); import reinterpretComplex128 = require( '@stdlib/strided/base/reinterpret-complex128' ); import smap = require( '@stdlib/strided/base/smap' ); @@ -1047,6 +1048,25 @@ interface Namespace { */ quinary: typeof quinary; + /** + * Reinterprets a `Complex128Array` as a `Float64Array`. + * + * @param x - input array + * @param offset - starting index + * @returns `Float64Array` view + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var x = new Complex128Array( 10 ); + * + * var out = ns.reinterpretComplex( x, 0 ); + * // returns + * + * var bool = ( out.buffer === x.buffer ); + */ + reinterpretComplex: typeof reinterpretComplex; + /** * Reinterprets a `Complex64Array` as a `Float32Array`. * diff --git a/lib/node_modules/@stdlib/string/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/docs/types/index.d.ts index 095cbea3af5b..c3e0732e326c 100644 --- a/lib/node_modules/@stdlib/string/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/docs/types/index.d.ts @@ -54,7 +54,7 @@ import removeWords = require( '@stdlib/string/remove-words' ); import repeat = require( '@stdlib/string/repeat' ); import replace = require( '@stdlib/string/replace' ); import replaceBefore = require( '@stdlib/string/replace-before' ); -import reverseString = require( '@stdlib/string/reverse' ); +import reverse = require( '@stdlib/string/reverse' ); import rpad = require( '@stdlib/string/right-pad' ); import rtrim = require( '@stdlib/string/right-trim' ); import rtrimN = require( '@stdlib/string/right-trim-n' ); @@ -877,18 +877,18 @@ interface Namespace { * @returns reversed string * * @example - * var out = ns.reverseString( 'last man standing', { + * var out = ns.reverse( 'last man standing', { * 'mode': 'code_unit' * }); * // returns 'gnidnats nam tsal' * * @example - * var out = ns.reverseString( '🐶🐮🐷🐰🐸', { + * var out = ns.reverse( '🐶🐮🐷🐰🐸', { * 'mode': 'grapheme' * }); * // returns '🐸🐰🐷🐮🐶' */ - reverseString: typeof reverseString; + reverse: typeof reverse; /** * Right pads a string such that the padded string has a length of at least `len`.