diff --git a/lib/node_modules/@stdlib/blas/ext/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/docs/types/index.d.ts index 6084ed22d403..9706926f3052 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/docs/types/index.d.ts @@ -1344,7 +1344,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example 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 05bc9b1b4a4b..27c1381c8b3f 100644 --- a/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts @@ -35,12 +35,15 @@ 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 filter = require( '@stdlib/ndarray/filter' ); +import filterMap = require( '@stdlib/ndarray/filter-map' ); 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 indexModes = require( '@stdlib/ndarray/index-modes' ); import iter = require( '@stdlib/ndarray/iter' ); +import map = require( '@stdlib/ndarray/map' ); import maybeBroadcastArray = require( '@stdlib/ndarray/maybe-broadcast-array' ); import maybeBroadcastArrays = require( '@stdlib/ndarray/maybe-broadcast-arrays' ); import minDataType = require( '@stdlib/ndarray/min-dtype' ); @@ -55,6 +58,7 @@ 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 reject = require( '@stdlib/ndarray/reject' ); import safeCasts = require( '@stdlib/ndarray/safe-casts' ); import sameKindCasts = require( '@stdlib/ndarray/same-kind-casts' ); import shape = require( '@stdlib/ndarray/shape' ); @@ -563,6 +567,83 @@ interface Namespace { */ FancyArray: typeof FancyArray; + /** + * Returns a shallow copy of an ndarray containing only those elements which pass a test implemented by a predicate function. + * + * @param x - input ndarray + * @param options - options + * @param options.dtype - output ndarray data type + * @param options.order - iteration order + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns output ndarray + * + * @example + * var isEven = require( '@stdlib/assert/is-even' ).isPrimitive; + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * var buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + * var shape = [ 2, 3 ]; + * var strides = [ 6, 1 ]; + * var offset = 1; + * + * var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' ); + * // returns + * + * var opts = { + * 'dtype': 'generic' + * }; + * var y = ns.filter( x, opts, isEven ); + * // returns + * + * var arr = ndarray2array( y ); + * // returns [ 2.0, 4.0, 8.0, 10.0 ] + */ + filter: typeof filter; + + /** + * Filters and maps elements in an input ndarray to elements in a new output ndarray according to a callback function. + * + * @param x - input ndarray + * @param options - options + * @param options.dtype - output ndarray data type + * @param options.order - iteration order + * @param fcn - callback function + * @param thisArg - callback function execution context + * @returns output ndarray + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * function scale( z ) { + * if ( z > 5.0 ) { + * return z * 10.0; + * } + * } + * + * var buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + * var shape = [ 2, 3 ]; + * var strides = [ 6, 1 ]; + * var offset = 1; + * + * var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' ); + * // returns + * + * var opts = { + * 'dtype': 'generic' + * }; + * var y = ns.filterMap( x, opts, scale ); + * // returns + * + * var arr = ndarray2array( y ); + * // returns [ 80.0, 90.0, 100.0 ] + */ + filterMap: typeof filterMap; + /** * Returns a specified flag for a provided ndarray. * @@ -693,6 +774,44 @@ interface Namespace { */ iter: typeof iter; + /** + * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. + * + * @param x - input ndarray + * @param options - options + * @param options.dtype - output ndarray data type + * @param fcn - callback function + * @param thisArg - callback function execution context + * @returns output ndarray + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * function scale( z ) { + * return z * 10.0; + * } + * + * var buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + * var shape = [ 2, 3 ]; + * var strides = [ 6, 1 ]; + * var offset = 1; + * + * var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' ); + * // returns + * + * var opts = { + * 'dtype': 'generic' + * }; + * var y = ns.map( x, opts, scale ); + * // returns + * + * var arr = ndarray2array( y ); + * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] + */ + map: typeof map; + /** * Broadcasts an ndarray to a specified shape if and only if the specified shape differs from the provided ndarray's shape. * @@ -1019,6 +1138,42 @@ interface Namespace { */ promotionRules: typeof promotionRules; + /** + * Returns a shallow copy of an ndarray containing only those elements which fail a test implemented by a predicate function. + * + * @param x - input ndarray + * @param options - options + * @param options.dtype - output ndarray data type + * @param options.order - iteration order + * @param predicate - predicate function + * @param thisArg - predicate function execution context + * @returns output ndarray + * + * @example + * var isOdd = require( '@stdlib/assert/is-odd' ).isPrimitive; + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * var buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + * var shape = [ 2, 3 ]; + * var strides = [ 6, 1 ]; + * var offset = 1; + * + * var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' ); + * // returns + * + * var opts = { + * 'dtype': 'generic' + * }; + * var y = ns.reject( x, opts, isOdd ); + * // returns + * + * var arr = ndarray2array( y ); + * // returns [ 2.0, 4.0, 8.0, 10.0 ] + */ + reject: typeof reject; + /** * Returns a list of ndarray data types to which a provided ndarray data type can be safely cast. *