From b26d9a0b77a5c56de8360afafb9a4295b81cc3c3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jan 2024 08:11:38 +0000 Subject: [PATCH] Auto-generated commit --- base/docs/types/index.d.ts | 4 ++++ docs/types/index.d.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/base/docs/types/index.d.ts b/base/docs/types/index.d.ts index 2b8408e0..c31a8185 100644 --- a/base/docs/types/index.d.ts +++ b/base/docs/types/index.d.ts @@ -1715,6 +1715,7 @@ interface Namespace { * * - **sh**: dimensions sorted in loop order. * - **sx**: ndarray strides sorted in loop order. + * - **idx**: dimension indices sorted in loop order. * * - When iterating over the elements of a multi-dimensional array, accessing elements which are closer in memory can improve performance. To this end, loop interchange is a technique used in loop nest optimization to improve locality of reference and take advantage of CPU cache. * @@ -1737,6 +1738,9 @@ interface Namespace { * * var ssx = o.sx; * // returns [ 1, 4, 12 ] + * + * var idx = o.idx; + * // returns [ 2, 1, 0 ] */ nullaryLoopOrder: typeof nullaryLoopOrder; diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index 6fa0691c..b4a3aafb 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -21,6 +21,7 @@ /* eslint-disable max-lines */ import array = require( './../../array' ); +import ndat = require( './../../at' ); import base = require( './../../base' ); import broadcastArray = require( './../../broadcast-array' ); import broadcastArrays = require( './../../broadcast-arrays' ); @@ -130,6 +131,35 @@ interface Namespace { */ array: typeof array; + /** + * Returns an ndarray element. + * + * ## Notes + * + * - The number of index arguments must equal the number of ndarray dimensions. + * - Negative indices are resolved relative to the last element along the respective dimension, with the last element corresponding to `-1`. + * - If provided out-of-bounds indices, the function always returns `undefined`. + * + * @param x - input ndarray + * @param indices - index arguments + * @returns ndarray element + * + * @example + * var zeros = require( './../../zeros' ); + * + * var x = zeros( [ 3, 3 ], { + * 'dtype': 'generic' + * }); + * // returns + * + * var v = ns.ndat( x, 0, 0 ); + * // returns 0 + * + * v = ns.ndat( x, 5, 5 ); + * // returns undefined + */ + ndat: typeof ndat; + /** * Base ndarray. */