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 146e161375a8..cf7562cf31a2 100644 --- a/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts @@ -69,6 +69,7 @@ import flattenFromBy = require( '@stdlib/ndarray/flatten-from-by' ); import fliplr = require( '@stdlib/ndarray/fliplr' ); import flipud = require( '@stdlib/ndarray/flipud' ); import forEach = require( '@stdlib/ndarray/for-each' ); +import arraybuffer2ndarray = require( '@stdlib/ndarray/from-arraybuffer' ); import scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); import scalar2ndarrayLike = require( '@stdlib/ndarray/from-scalar-like' ); import hconcat = require( '@stdlib/ndarray/hconcat' ); @@ -950,7 +951,6 @@ interface Namespace { * @param options.readonly - specifies whether an array should be read-only (default: false) * @throws `buffer` argument `get` and `set` properties must be functions * @throws `shape` argument must be an array-like object containing nonnegative integers - * @throws `shape` argument length must equal the number of dimensions * @throws `strides` argument must be an array-like object containing integers * @throws `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`) * @throws for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0` @@ -1985,6 +1985,98 @@ interface Namespace { */ forEach: typeof forEach; + /** + * Creates an ndarray from an ArrayBuffer. + * + * @param dtype - data type + * @param buffer - data buffer + * @param shape - array shape + * @param strides - array strides + * @param byteOffset - byte offset (in units of bytes) specifying the location of the first indexed element in the data buffer + * @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style) + * @param options - function options + * @param options.mode - specifies how to handle indices which exceed array dimensions (default: 'throw') + * @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: [options.mode]) + * @param options.readonly - specifies whether an array should be read-only (default: false) + * @throws data type must be compatible with the provided ArrayBuffer + * @throws `shape` argument must be an array-like object containing nonnegative integers + * @throws `strides` argument must be an array-like object containing integers + * @throws `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`) + * @throws for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0` + * @throws `byteOffset` argument must be a nonnegative integer + * @throws `buffer` argument must be compatible with specified meta data + * @throws must provide valid options + * @throws too many dimensions + * @returns ndarray instance + * + * @example + * var numel = require( '@stdlib/ndarray/numel' ); + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * + * var buf = new ArrayBuffer( 32 ); + * var v = ns.arraybuffer2ndarray( 'float64', buf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); + * // returns + * + * var N = numel( v ); + * // returns 4 + * + * @example + * var numel = require( '@stdlib/ndarray/numel' ); + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * + * var buf = new ArrayBuffer( 32 ); + * var v = ns.arraybuffer2ndarray( 'float32', buf, [ 4, 2 ], [ 2, 1 ], 0, 'row-major' ); + * // returns + * + * var N = numel( v ); + * // returns 8 + * + * @example + * var numel = require( '@stdlib/ndarray/numel' ); + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * + * var buf = new ArrayBuffer( 32 ); + * var v = ns.arraybuffer2ndarray( 'float64', buf, [ 2, 2 ], [ -2, -1 ], 0, 'row-major' ); + * // returns + * + * var N = numel( v ); + * // returns 4 + * + * @example + * var numel = require( '@stdlib/ndarray/numel' ); + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * + * var buf = new ArrayBuffer( 32 ); + * var v = ns.arraybuffer2ndarray( 'float64', buf, [ 2, 2 ], [ -1, -2 ], 0, 'column-major' ); + * // returns + * + * var N = numel( v ); + * // returns 4 + * + * @example + * var numel = require( '@stdlib/ndarray/numel' ); + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * + * var buf = new ArrayBuffer( 64 ); + * var v = ns.arraybuffer2ndarray( 'float64', buf, [ 2, 2, 2 ], [ 2, -4, 1 ], 0, 'row-major' ); + * // returns + * + * var N = numel( v ); + * // returns 8 + * + * @example + * var numel = require( '@stdlib/ndarray/numel' ); + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * + * var buf = new ArrayBuffer( 32 ); + * var v = ns.arraybuffer2ndarray( 'float64', buf, [ 1, 2 ], [ -2, -1 ], 8, 'row-major' ); + * // returns + * + * var N = numel( v ); + * // returns 2 + */ + arraybuffer2ndarray: typeof arraybuffer2ndarray; + /** * Returns a zero-dimensional ndarray containing a provided scalar value. *