diff --git a/lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts index 5f16277634d6..b560053b37e6 100644 --- a/lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts @@ -50,6 +50,7 @@ import dtypes2signatures = require( '@stdlib/ndarray/base/dtypes2signatures' ); import empty = require( '@stdlib/ndarray/base/empty' ); import emptyLike = require( '@stdlib/ndarray/base/empty-like' ); import expandDimensions = require( '@stdlib/ndarray/base/expand-dimensions' ); +import fill = require( '@stdlib/ndarray/base/fill' ); import flag = require( '@stdlib/ndarray/base/flag' ); import flags = require( '@stdlib/ndarray/base/flags' ); import fliplr = require( '@stdlib/ndarray/base/fliplr' ); @@ -59,10 +60,13 @@ import scalar2ndarray = require( '@stdlib/ndarray/base/from-scalar' ); import ind = require( '@stdlib/ndarray/base/ind' ); import ind2sub = require( '@stdlib/ndarray/base/ind2sub' ); import iterationOrder = require( '@stdlib/ndarray/base/iteration-order' ); +import map = require( '@stdlib/ndarray/base/map' ); import maxViewBufferIndex = require( '@stdlib/ndarray/base/max-view-buffer-index' ); import maybeBroadcastArray = require( '@stdlib/ndarray/base/maybe-broadcast-array' ); import maybeBroadcastArrays = require( '@stdlib/ndarray/base/maybe-broadcast-arrays' ); import metaDataProps = require( '@stdlib/ndarray/base/meta-data-props' ); +import minSignedIntegerDataType = require( '@stdlib/ndarray/base/min-signed-integer-dtype' ); +import minUnsignedIntegerDataType = require( '@stdlib/ndarray/base/min-unsigned-integer-dtype' ); import minViewBufferIndex = require( '@stdlib/ndarray/base/min-view-buffer-index' ); import minmaxViewBufferIndex = require( '@stdlib/ndarray/base/minmax-view-buffer-index' ); import ndarraylike2ndarray = require( '@stdlib/ndarray/base/ndarraylike2ndarray' ); @@ -103,6 +107,7 @@ import strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); import strides2order = require( '@stdlib/ndarray/base/strides2order' ); import sub2ind = require( '@stdlib/ndarray/base/sub2ind' ); import ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +import toReversed = require( '@stdlib/ndarray/base/to-reversed' ); import transpose = require( '@stdlib/ndarray/base/transpose' ); import unary = require( '@stdlib/ndarray/base/unary' ); import unaryBy = require( '@stdlib/ndarray/base/unary-by' ); @@ -938,6 +943,44 @@ interface Namespace { */ expandDimensions: typeof expandDimensions; + /** + * Fills an input ndarray with a specified value. + * + * @param x - input ndarray + * @param value - scalar value + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * // Create a data buffer: + * var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * + * // Define the shape of the input array: + * var shape = [ 3, 1, 2 ]; + * + * // Define the array strides: + * var sx = [ 2, 2, 1 ]; + * + * // Define the index offset: + * var ox = 0; + * + * // Create the input ndarray-like object: + * var x = { + * 'dtype': 'float64', + * 'data': xbuf, + * 'shape': shape, + * 'strides': sx, + * 'offset': ox, + * 'order': 'row-major' + * }; + * + * ns.fill( x, 10.0 ); + * + * console.log( x.data ); + * // => [ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ] + */ + fill: typeof fill; + /** * Returns a specified flag for a provided ndarray. * @@ -1291,6 +1334,50 @@ interface Namespace { */ iterationOrder: typeof iterationOrder; + /** + * Applies a callback function to the elements in an input ndarray and assigns results to the elements in an output ndarray. + * + * @param arrays - array-like object containing one input ndarray and one output ndarray + * @param fcn - callback function + * @param thisArg - callback function execution context + * @throws arrays must have the same number of dimensions + * @throws arrays must have the same shape + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * // Create data buffers: + * var xbuf = 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 ybuf = new Float64Array( 6 ); + * + * // Define the shape of the input and output arrays: + * var shape = [ 3, 1, 2 ]; + * + * // Define the array strides: + * var sx = [ 4, 4, 1 ]; + * var sy = [ 2, 2, 1 ]; + * + * // Define the index offsets: + * var ox = 1; + * var oy = 0; + * + * // Create the input and output ndarrays: + * var x = ndarray( 'float64', xbuf, shape, sx, ox, 'row-major' ); + * var y = ndarray( 'float64', ybuf, shape, sy, oy, 'row-major' ); + * + * // Apply the ns.map function: + * ns.map( [ x, y ], scale ); + * + * console.log( y.data ); + * // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] + */ + map: typeof map; + /** * Computes the maximum linear index in an underlying data buffer accessible to an array view. * @@ -1484,6 +1571,38 @@ interface Namespace { */ metaDataProps: typeof metaDataProps; + /** + * Returns the minimum ndarray data type for storing a provided signed integer value. + * + * @param value - scalar value + * @returns ndarray data type + * + * @example + * var dt = ns.minSignedIntegerDataType( 1280 ); + * // returns 'int16' + * + * @example + * var dt = ns.minSignedIntegerDataType( 3 ); + * // returns 'int8' + */ + minSignedIntegerDataType: typeof minSignedIntegerDataType; + + /** + * Returns the minimum ndarray data type for storing a provided unsigned integer value. + * + * @param value - scalar value + * @returns ndarray data type + * + * @example + * var dt = ns.minUnsignedIntegerDataType( 1280 ); + * // returns 'uint16' + * + * @example + * var dt = ns.minUnsignedIntegerDataType( 3 ); + * // returns 'uint8' + */ + minUnsignedIntegerDataType: typeof minUnsignedIntegerDataType; + /** * Computes the minimum linear index in an underlying data buffer accessible to an array view. * @@ -2718,6 +2837,42 @@ interface Namespace { */ ndarray2array: typeof ndarray2array; + /** + * Returns a new ndarray where the order of elements of an input ndarray is reversed along each dimension. + * + * @param x - input array + * @returns output array + * + * @example + * var typedarray = require( '@stdlib/array/typed' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' ); + * var shape = [ 3, 2 ]; + * var strides = [ 2, 1 ]; + * var offset = 0; + * + * var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' ); + * // returns + * + * var sh = x.shape; + * // returns [ 3, 2 ] + * + * var arr = ndarray2array( x ); + * // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ] + * + * var y = ns.toReversed( x ); + * // returns + * + * sh = y.shape; + * // returns [ 3, 2 ] + * + * arr = ndarray2array( y ); + * // returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ] + */ + toReversed: typeof toReversed; + /** * Transposes a matrix (or a stack of matrices). *