From b9d974327b74e87889da484e2191406bbd9c1f08 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 20 Mar 2026 03:08:22 +0000 Subject: [PATCH] feat: update `ndarray` TypeScript declarations Signed-off-by: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> --- .../@stdlib/ndarray/docs/types/index.d.ts | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) 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 c22f1cfc468c..507a1f465c41 100644 --- a/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts @@ -45,6 +45,7 @@ import dtypes = require( '@stdlib/ndarray/dtypes' ); import empty = require( '@stdlib/ndarray/empty' ); import emptyLike = require( '@stdlib/ndarray/empty-like' ); import every = require( '@stdlib/ndarray/every' ); +import everyBy = require( '@stdlib/ndarray/every-by' ); import FancyArray = require( '@stdlib/ndarray/fancy' ); import fill = require( '@stdlib/ndarray/fill' ); import fillBy = require( '@stdlib/ndarray/fill-by' ); @@ -109,6 +110,8 @@ 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 toFlippedlr = require( '@stdlib/ndarray/to-flippedlr' ); +import toFlippedud = require( '@stdlib/ndarray/to-flippedud' ); import ndarray2json = require( '@stdlib/ndarray/to-json' ); import toReversed = require( '@stdlib/ndarray/to-reversed' ); import toReversedDimension = require( '@stdlib/ndarray/to-reversed-dimension' ); @@ -1123,6 +1126,82 @@ interface Namespace { */ every: typeof every; + /** + * Tests whether all elements along one or more ndarray dimensions pass a test implemented by a predicate function. + * + * @param x - input ndarray + * @param options - function options + * @param options.dims - list of dimensions over which to perform a reduction + * @param options.keepdims - boolean indicating whether the reduced dimensions should be included in the returned ndarray as singleton dimensions (default: false) + * @param predicate - predicate function + * @param thisArg - predicate execution context + * @returns output ndarray + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * + * function isPositive( value ) { + * return value > 0.0; + * } + * + * // Create a data buffer: + * 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 ] ); + * + * // Define the shape of the input array: + * var sh = [ 3, 1, 2 ]; + * + * // Define the array strides: + * var sx = [ 4, 4, 1 ]; + * + * // Define the index offset: + * var ox = 1; + * + * // Create an input ndarray: + * var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' ); + * + * // Perform reduction: + * var out = ns.everyBy( x, isPositive ); + * // returns [ true ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * var empty = require( '@stdlib/ndarray/empty' ); + * + * function isPositive( value ) { + * return value > 0.0; + * } + * + * // Create a data buffer: + * 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 ] ); + * + * // Define the shape of the input array: + * var shape = [ 3, 1, 2 ]; + * + * // Define the array strides: + * var sx = [ 4, 4, 1 ]; + * + * // Define the index offset: + * var ox = 1; + * + * // Create an input ndarray: + * var x = new ndarray( 'float64', xbuf, shape, sx, ox, 'row-major' ); + * + * // Create an output ndarray: + * var y = empty( [], { + * 'dtype': 'bool' + * }); + * + * // Perform reduction: + * var out = ns.everyBy.assign( x, y, isPositive ); + * // returns [ true ] + * + * var bool = ( out === y ); + * // returns true + */ + everyBy: typeof everyBy; + /** * Fancy array constructor. * @@ -3119,6 +3198,50 @@ interface Namespace { */ ndarray2array: typeof ndarray2array; + /** + * Returns a new ndarray where the order of elements along the last dimension of an input ndarray is reversed. + * + * @param x - input array + * @returns output ndarray + * + * @example + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * + * var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; + * var shape = [ 3, 2 ]; + * var strides = [ 2, 1 ]; + * var offset = 0; + * + * var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); + * // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ] + * + * var y = ns.toFlippedlr( x ); + * // returns [ [ 2.0, 1.0 ], [ 4.0, 3.0 ], [ 6.0, 5.0 ] ] + */ + toFlippedlr: typeof toFlippedlr; + + /** + * Returns a new ndarray where the order of elements along the second-to-last dimension of an input ndarray is reversed. + * + * @param x - input array + * @returns output ndarray + * + * @example + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * + * var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; + * var shape = [ 3, 2 ]; + * var strides = [ 2, 1 ]; + * var offset = 0; + * + * var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); + * // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ] + * + * var y = ns.toFlippedud( x ); + * // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ] + */ + toFlippedud: typeof toFlippedud; + /** * Serializes an ndarray as a JSON object. *