From d235c187aed0c1b17c358a46413ac0ba54cd7e9b Mon Sep 17 00:00:00 2001 From: stdlib-bot <noreply@stdlib.io> Date: Sat, 9 Dec 2023 22:03:01 +0000 Subject: [PATCH] Auto-generated commit --- base/docs/types/index.d.ts | 534 +++++++++++++++++++++++++++++++++++-- 1 file changed, 506 insertions(+), 28 deletions(-) diff --git a/base/docs/types/index.d.ts b/base/docs/types/index.d.ts index b491cf35..dc3abf04 100644 --- a/base/docs/types/index.d.ts +++ b/base/docs/types/index.d.ts @@ -70,11 +70,21 @@ import flatten4d = require( './../../../base/flatten4d' ); import flatten4dBy = require( './../../../base/flatten4d-by' ); import flatten5d = require( './../../../base/flatten5d' ); import flatten5dBy = require( './../../../base/flatten5d-by' ); +import fliplr2d = require( './../../../base/fliplr2d' ); +import fliplr3d = require( './../../../base/fliplr3d' ); +import fliplr4d = require( './../../../base/fliplr4d' ); +import fliplr5d = require( './../../../base/fliplr5d' ); +import flipud2d = require( './../../../base/flipud2d' ); +import strided2array = require( './../../../base/from-strided' ); import getter = require( './../../../base/getter' ); import incrspace = require( './../../../base/incrspace' ); import last = require( './../../../base/last' ); import linspace = require( './../../../base/linspace' ); import logspace = require( './../../../base/logspace' ); +import map2d = require( './../../../base/map2d' ); +import map3d = require( './../../../base/map3d' ); +import map4d = require( './../../../base/map4d' ); +import map5d = require( './../../../base/map5d' ); import mskbinary2d = require( './../../../base/mskbinary2d' ); import mskunary2d = require( './../../../base/mskunary2d' ); import mskunary3d = require( './../../../base/mskunary3d' ); @@ -87,13 +97,20 @@ import ones4d = require( './../../../base/ones4d' ); import ones5d = require( './../../../base/ones5d' ); import onesnd = require( './../../../base/onesnd' ); import quaternary2d = require( './../../../base/quaternary2d' ); +import quaternary3d = require( './../../../base/quaternary3d' ); +import quaternary4d = require( './../../../base/quaternary4d' ); +import quaternary5d = require( './../../../base/quaternary5d' ); import quinary2d = require( './../../../base/quinary2d' ); +import resolveGetter = require( './../../../base/resolve-getter' ); import setter = require( './../../../base/setter' ); import strided2array2d = require( './../../../base/strided2array2d' ); import strided2array3d = require( './../../../base/strided2array3d' ); import strided2array4d = require( './../../../base/strided2array4d' ); import strided2array5d = require( './../../../base/strided2array5d' ); import take = require( './../../../base/take' ); +import takeIndexed = require( './../../../base/take-indexed' ); +import take2d = require( './../../../base/take2d' ); +import take3d = require( './../../../base/take3d' ); import ternary2d = require( './../../../base/ternary2d' ); import ternary3d = require( './../../../base/ternary3d' ); import ternary4d = require( './../../../base/ternary4d' ); @@ -607,13 +624,10 @@ interface Namespace { * @param fcn - quaternary callback * * @example + * var add = require( `@stdlib/math/base/ops/add4` ); * var ones2d = require( `@stdlib/array/base/ones2d` ); * var zeros2d = require( `@stdlib/array/base/zeros2d` ); * - * function add( x, y, z, w ) { - * return x + y + z + w; - * } - * * var shapes = [ * [ 1, 2 ], * [ 2, 1 ], @@ -691,10 +705,7 @@ interface Namespace { * @example * var ones2d = require( `@stdlib/array/base/ones2d` ); * var zeros2d = require( `@stdlib/array/base/zeros2d` ); - * - * function add( x, y, z ) { - * return x + y + z; - * } + * var add = require( `@stdlib/math/base/ops/add3` ); * * var shapes = [ * [ 1, 2 ], @@ -1443,6 +1454,117 @@ interface Namespace { */ flatten5dBy: typeof flatten5dBy; + /** + * Reverses the order of elements along the last dimension of a two-dimensional nested input array. + * + * ## Notes + * + * - The function does **not** perform a deep copy of nested array elements. + * + * @param x - input nested array + * @returns output array + * + * @example + * var x = [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]; + * + * var out = ns.fliplr2d( x ); + * // returns [ [ 2, 1 ], [ 4, 3 ], [ 6, 5 ] ] + */ + fliplr2d: typeof fliplr2d; + + /** + * Reverses the order of elements along the last dimension of a three-dimensional nested input array. + * + * ## Notes + * + * - The function does **not** perform a deep copy of nested array elements. + * + * @param x - input nested array + * @returns output array + * + * @example + * var x = [ [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] ]; + * + * var out = ns.fliplr3d( x ); + * // returns [ [ [ 2, 1 ], [ 4, 3 ], [ 6, 5 ] ] ] + */ + fliplr3d: typeof fliplr3d; + + /** + * Reverses the order of elements along the last dimension of a four-dimensional nested input array. + * + * ## Notes + * + * - The function does **not** perform a deep copy of nested array elements. + * + * @param x - input nested array + * @returns output array + * + * @example + * var x = [ [ [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] ] ]; + * + * var out = ns.fliplr4d( x ); + * // returns [ [ [ [ 2, 1 ], [ 4, 3 ], [ 6, 5 ] ] ] ] + */ + fliplr4d: typeof fliplr4d; + + /** + * Reverses the order of elements along the last dimension of a five-dimensional nested input array. + * + * ## Notes + * + * - The function does **not** perform a deep copy of nested array elements. + * + * @param x - input nested array + * @returns output array + * + * @example + * var x = [ [ [ [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] ] ] ]; + * + * var out = ns.fliplr5d( x ); + * // returns [ [ [ [ [ 2, 1 ], [ 4, 3 ], [ 6, 5 ] ] ] ] ] + */ + fliplr5d: typeof fliplr5d; + + /** + * Reverses the order of elements along the first dimension of a two-dimensional nested input array. + * + * ## Notes + * + * - The function does **not** perform a deep copy of nested array elements. + * + * @param x - input nested array + * @returns output array + * + * @example + * var x = [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]; + * + * var out = ns.flipud2d( x ); + * // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ] + */ + flipud2d: typeof flipud2d; + + /** + * Converts a strided array to a non-strided generic array. + * + * ## Notes + * + * - The function assumes that the input array is compatible with the specified number of elements, index stride, and index offset. + * + * @param N - number of indexed elements + * @param x - input array + * @param stride - index stride + * @param offset - index of the first indexed value in the input array + * @returns two-dimensional nested array + * + * @example + * var x = [ 1, 2, 3, 4, 5, 6 ]; + * + * var arr = ns.strided2array( 3, x, 2, 0 ); + * // returns [ 1, 3, 5 ] + */ + strided2array: typeof strided2array; + /** * Returns an accessor function for retrieving an element from an indexed array-like object. * @@ -1516,6 +1638,206 @@ interface Namespace { */ logspace: typeof logspace; + /** + * Applies a function to elements in a two-dimensional nested input array and assigns results to elements in a new two-dimensional nested output array. + * + * ## Notes + * + * - The applied function is provided the following arguments: + * + * - **value**: array element. + * - **indices**: current array element indices. + * -- **array**: input nested array. + * + * @param x - input nested array + * @param shape - array shape + * @param fcn - function to apply + * @param thisArg - function execution context + * + * @example + * var ones2d = require( `@stdlib/array/base/ones2d` ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * var shape = [ 2, 2 ]; + * + * var x = ones2d( shape ); + * var y = ns.map2d( x, shape, scale ); + * // returns [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] + * + * @example + * var ones2d = require( `@stdlib/array/base/ones2d` ); + * var zeros2d = require( `@stdlib/array/base/zeros2d` ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * var shape = [ 2, 2 ]; + * + * var x = ones2d( shape ); + * var y = zeros2d( shape ); + * + * var out = ns.map2d.assign( x, y, shape, scale ); + * // returns [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] + * + * var bool = ( out === y ); + * // returns true + */ + map2d: typeof map2d; + + /** + * Applies a function to elements in a three-dimensional nested input array and assigns results to elements in a new three-dimensional nested output array. + * + * ## Notes + * + * - The applied function is provided the following arguments: + * + * - **value**: array element. + * - **indices**: current array element indices. + * -- **array**: input nested array. + * + * @param x - input nested array + * @param shape - array shape + * @param fcn - function to apply + * @param thisArg - function execution context + * + * @example + * var ones3d = require( `@stdlib/array/base/ones3d` ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * var shape = [ 1, 2, 2 ]; + * + * var x = ones3d( shape ); + * var y = ns.map3d( x, shape, scale ); + * // returns [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] + * + * @example + * var ones3d = require( `@stdlib/array/base/ones3d` ); + * var zeros3d = require( `@stdlib/array/base/zeros3d` ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * var shape = [ 1, 2, 2 ]; + * + * var x = ones3d( shape ); + * var y = zeros3d( shape ); + * + * var out = ns.map3d.assign( x, y, shape, scale ); + * // returns [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] + * + * var bool = ( out === y ); + * // returns true + */ + map3d: typeof map3d; + + /** + * Applies a function to elements in a four-dimensional nested input array and assigns results to elements in a new four-dimensional nested output array. + * + * ## Notes + * + * - The applied function is provided the following arguments: + * + * - **value**: array element. + * - **indices**: current array element indices. + * -- **array**: input nested array. + * + * @param x - input nested array + * @param shape - array shape + * @param fcn - function to apply + * @param thisArg - function execution context + * + * @example + * var ones4d = require( `@stdlib/array/base/ones4d` ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * var shape = [ 1, 1, 2, 2 ]; + * + * var x = ones4d( shape ); + * var y = ns.map4d( x, shape, scale ); + * // returns [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] + * + * @example + * var ones4d = require( `@stdlib/array/base/ones4d` ); + * var zeros4d = require( `@stdlib/array/base/zeros4d` ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * var shape = [ 1, 1, 2, 2 ]; + * + * var x = ones4d( shape ); + * var y = zeros4d( shape ); + * + * var out = ns.map4d.assign( x, y, shape, scale ); + * // returns [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] + * + * var bool = ( out === y ); + * // returns true + */ + map4d: typeof map4d; + + /** + * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. + * + * ## Notes + * + * - The applied function is provided the following arguments: + * + * - **value**: array element. + * - **indices**: current array element indices. + * -- **array**: input nested array. + * + * @param x - input nested array + * @param shape - array shape + * @param fcn - function to apply + * @param thisArg - function execution context + * + * @example + * var ones5d = require( `@stdlib/array/base/ones5d` ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * var shape = [ 1, 1, 1, 2, 2 ]; + * + * var x = ones5d( shape ); + * var y = ns.map5d( x, shape, scale ); + * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] + * + * @example + * var ones5d = require( `@stdlib/array/base/ones5d` ); + * var zeros5d = require( `@stdlib/array/base/zeros5d` ); + * + * function scale( x ) { + * return x * 10.0; + * } + * + * var shape = [ 1, 1, 1, 2, 2 ]; + * + * var x = ones5d( shape ); + * var y = zeros5d( shape ); + * + * var out = ns.map5d.assign( x, y, shape, scale ); + * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] + * + * var bool = ( out === y ); + * // returns true + */ + map5d: typeof map5d; + /** * 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. * @@ -1733,13 +2055,10 @@ interface Namespace { * @param fcn - quaternary callback * * @example + * var add = require( `@stdlib/math/base/ops/add4` ); * var ones2d = require( `@stdlib/array/base/ones2d` ); * var zeros2d = require( `@stdlib/array/base/zeros2d` ); * - * function add( x, y, z, w ) { - * return x + y + z + w; - * } - * * var shape = [ 2, 2 ]; * * var x = ones2d( shape ); @@ -1755,6 +2074,99 @@ interface Namespace { */ quaternary2d: typeof quaternary2d; + /** + * Applies a quaternary callback to elements in four three-dimensional nested input arrays and assigns results to elements in a three-dimensional nested output array. + * + * ## Notes + * + * - The function assumes that the input and output arrays have the same shape. + * + * @param arrays - array containing four input nested arrays and one output nested array + * @param shape - array shape + * @param fcn - quaternary callback + * + * @example + * var add = require( `@stdlib/math/base/ops/add4` ); + * var ones3d = require( `@stdlib/array/base/ones3d` ); + * var zeros3d = require( `@stdlib/array/base/zeros3d` ); + * + * var shape = [ 1, 2, 2 ]; + * + * var x = ones3d( shape ); + * var y = ones3d( shape ); + * var z = ones3d( shape ); + * var w = ones3d( shape ); + * var out = zeros3d( shape ); + * + * ns.quaternary3d( [ x, y, z, w, out ], shape, add ); + * + * console.log( out ); + * // => [ [ [ 4.0, 4.0 ], [ 4.0, 4.0 ] ] ] + */ + quaternary3d: typeof quaternary3d; + + /** + * Applies a quaternary callback to elements in four four-dimensional nested input arrays and assigns results to elements in a four-dimensional nested output array. + * + * ## Notes + * + * - The function assumes that the input and output arrays have the same shape. + * + * @param arrays - array containing four input nested arrays and one output nested array + * @param shape - array shape + * @param fcn - quaternary callback + * + * @example + * var add = require( `@stdlib/math/base/ops/add4` ); + * var ones4d = require( `@stdlib/array/base/ones4d` ); + * var zeros4d = require( `@stdlib/array/base/zeros4d` ); + * + * var shape = [ 1, 1, 2, 2 ]; + * + * var x = ones4d( shape ); + * var y = ones4d( shape ); + * var z = ones4d( shape ); + * var w = ones4d( shape ); + * var out = zeros4d( shape ); + * + * ns.quaternary4d( [ x, y, z, w, out ], shape, add ); + * + * console.log( out ); + * // => [ [ [ [ 4.0, 4.0 ], [ 4.0, 4.0 ] ] ] ] + */ + quaternary4d: typeof quaternary4d; + + /** + * Applies a quaternary callback to elements in four five-dimensional nested input arrays and assigns results to elements in a five-dimensional nested output array. + * + * ## Notes + * + * - The function assumes that the input and output arrays have the same shape. + * + * @param arrays - array containing four input nested arrays and one output nested array + * @param shape - array shape + * @param fcn - quaternary callback + * + * @example + * var add = require( `@stdlib/math/base/ops/add4` ); + * var ones5d = require( `@stdlib/array/base/ones5d` ); + * var zeros5d = require( `@stdlib/array/base/zeros5d` ); + * + * var shape = [ 1, 1, 1, 2, 2 ]; + * + * var x = ones5d( shape ); + * var y = ones5d( shape ); + * var z = ones5d( shape ); + * var w = ones5d( shape ); + * var out = zeros5d( shape ); + * + * ns.quaternary5d( [ x, y, z, w, out ], shape, add ); + * + * console.log( out ); + * // => [ [ [ [ [ 4.0, 4.0 ], [ 4.0, 4.0 ] ] ] ] ] + */ + quaternary5d: typeof quaternary5d; + /** * Applies a quinary callback to elements in five two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. * @@ -1790,6 +2202,21 @@ interface Namespace { */ quinary2d: typeof quinary2d; + /** + * Returns an accessor function for retrieving an element from an indexed array-like object. + * + * @param x - input array + * @returns accessor function + * + * @example + * var arr = [ 1, 2, 3, 4 ]; + * + * var get = ns.resolveGetter( arr ); + * var v = get( arr, 2 ); + * // returns 3 + */ + resolveGetter: typeof resolveGetter; + /** * Returns an accessor function for setting an element in an indexed array-like object. * @@ -1936,6 +2363,69 @@ interface Namespace { */ take: typeof take; + /** + * Takes element from an indexed 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. + * + * @param x - input array + * @param indices - list of element indices + * @returns output array + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * + * var y = ns.takeIndexed( x, [ 1, 3 ] ); + * // returns [ 2, 4 ] + */ + takeIndexed: typeof takeIndexed; + + /** + * Takes elements from a two-dimensional nested array. + * + * ## Notes + * + * - The function does **not** deep copy nested array elements. + * + * @param x - input nested array + * @param indices - list of indices + * @param dimension - dimension along which to take elements + * @param mode - index mode specifying how to handle an index which is out-of-bounds + * @returns output array + * + * @example + * var x = [ [ 1, 2 ], [ 3, 4 ] ]; + * var indices = [ 1, 1, 0, 0, -1, -1 ]; + * + * var y = ns.take2d( x, indices, 1, 'normalize' ); + * // returns [ [ 2, 2, 1, 1, 2, 2 ], [ 4, 4, 3, 3, 4, 4 ] ] + */ + take2d: typeof take2d; + + /** + * Takes elements from a three-dimensional nested array. + * + * ## Notes + * + * - The function does **not** deep copy nested array elements. + * + * @param x - input nested array + * @param indices - list of indices + * @param dimension - dimension along which to take elements + * @param mode - index mode specifying how to handle an index which is out-of-bounds + * @returns output array + * + * @example + * var x = [ [ [ 1, 2 ], [ 3, 4 ] ] ]; + * var indices = [ 1, 1, 0, 0, -1, -1 ]; + * + * var y = ns.take3d( x, indices, 2, 'normalize' ); + * // returns [ [ [ 2, 2, 1, 1, 2, 2 ], [ 4, 4, 3, 3, 4, 4 ] ] ] + */ + take3d: typeof take3d; + /** * Applies a ternary callback to elements in three two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. * @@ -1948,13 +2438,10 @@ interface Namespace { * @param fcn - ternary callback * * @example + * var add = require( `@stdlib/math/base/ops/add3` ); * var ones2d = require( `@stdlib/array/base/ones2d` ); * var zeros2d = require( `@stdlib/array/base/zeros2d` ); * - * function add( x, y, z ) { - * return x + y + z; - * } - * * var shape = [ 2, 2 ]; * * var x = ones2d( shape ); @@ -1981,13 +2468,10 @@ interface Namespace { * @param fcn - ternary callback * * @example + * var add = require( `@stdlib/math/base/ops/add3` ); * var ones3d = require( `@stdlib/array/base/ones3d` ); * var zeros3d = require( `@stdlib/array/base/zeros3d` ); * - * function add( x, y, z ) { - * return x + y + z; - * } - * * var shape = [ 1, 2, 2 ]; * * var x = ones3d( shape ); @@ -2014,13 +2498,10 @@ interface Namespace { * @param fcn - ternary callback * * @example + * var add = require( `@stdlib/math/base/ops/add3` ); * var ones4d = require( `@stdlib/array/base/ones4d` ); * var zeros4d = require( `@stdlib/array/base/zeros4d` ); * - * function add( x, y, z ) { - * return x + y + z; - * } - * * var shape = [ 1, 1, 2, 2 ]; * * var x = ones4d( shape ); @@ -2047,13 +2528,10 @@ interface Namespace { * @param fcn - ternary callback * * @example + * var add = require( `@stdlib/math/base/ops/add3` ); * var ones5d = require( `@stdlib/array/base/ones5d` ); * var zeros5d = require( `@stdlib/array/base/zeros5d` ); * - * function add( x, y, z ) { - * return x + y + z; - * } - * * var shape = [ 1, 1, 1, 2, 2 ]; * * var x = ones5d( shape );