Skip to content

Commit b1623fe

Browse files
authored
feat: update ndarray/base TypeScript declarations
PR-URL: #9420 Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com>
1 parent 50367fe commit b1623fe

1 file changed

Lines changed: 133 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/ndarray/base/docs/types

lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import dtypeStrings = require( '@stdlib/ndarray/base/dtype-strings' );
6666
import dtype2c = require( '@stdlib/ndarray/base/dtype2c' );
6767
import dtypes2enums = require( '@stdlib/ndarray/base/dtypes2enums' );
6868
import dtypes2signatures = require( '@stdlib/ndarray/base/dtypes2signatures' );
69+
import dtypes2strings = require( '@stdlib/ndarray/base/dtypes2strings' );
6970
import empty = require( '@stdlib/ndarray/base/empty' );
7071
import emptyLike = require( '@stdlib/ndarray/base/empty-like' );
7172
import every = require( '@stdlib/ndarray/base/every' );
@@ -147,8 +148,11 @@ import strides2offset = require( '@stdlib/ndarray/base/strides2offset' );
147148
import strides2order = require( '@stdlib/ndarray/base/strides2order' );
148149
import sub2ind = require( '@stdlib/ndarray/base/sub2ind' );
149150
import ndarray2array = require( '@stdlib/ndarray/base/to-array' );
151+
import toFlippedlr = require( '@stdlib/ndarray/base/to-flippedlr' );
152+
import toFlippedud = require( '@stdlib/ndarray/base/to-flippedud' );
150153
import toNormalizedIndices = require( '@stdlib/ndarray/base/to-normalized-indices' );
151154
import toReversed = require( '@stdlib/ndarray/base/to-reversed' );
155+
import toReversedDimension = require( '@stdlib/ndarray/base/to-reversed-dimension' );
152156
import toUniqueNormalizedIndices = require( '@stdlib/ndarray/base/to-unique-normalized-indices' );
153157
import transpose = require( '@stdlib/ndarray/base/transpose' );
154158
import unary = require( '@stdlib/ndarray/base/unary' );
@@ -1434,6 +1438,26 @@ interface Namespace {
14341438
*/
14351439
dtypes2signatures: typeof dtypes2signatures;
14361440

1441+
/**
1442+
* Resolves a list of data type strings.
1443+
*
1444+
* ## Notes
1445+
*
1446+
* - If the function is unable to resolve a data type string for a provided data type, the corresponding element in the returned array will be `null`.
1447+
*
1448+
* @param dtypes - list of data types
1449+
* @returns results
1450+
*
1451+
* @example
1452+
* var out = ns.dtypes2strings( [ 'float32', 'float64' ] );
1453+
* // returns [...]
1454+
*
1455+
* @example
1456+
* var out = ns.dtypes2strings( [ 'foo', 'bar' ] );
1457+
* // returns [ null, null ]
1458+
*/
1459+
dtypes2strings: typeof dtypes2strings;
1460+
14371461
/**
14381462
* Creates an uninitialized array having a specified shape and data type.
14391463
*
@@ -4105,6 +4129,78 @@ interface Namespace {
41054129
*/
41064130
ndarray2array: typeof ndarray2array;
41074131

4132+
/**
4133+
* Returns a new ndarray where the order of elements along the last dimension of an input ndarray is reversed.
4134+
*
4135+
* @param x - input array
4136+
* @returns output array
4137+
*
4138+
* @example
4139+
* var typedarray = require( '@stdlib/array/typed' );
4140+
* var ndarray = require( '@stdlib/ndarray/ctor' );
4141+
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
4142+
*
4143+
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' );
4144+
* var shape = [ 3, 2 ];
4145+
* var strides = [ 2, 1 ];
4146+
* var offset = 0;
4147+
*
4148+
* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
4149+
* // returns <ndarray>
4150+
*
4151+
* var sh = x.shape;
4152+
* // returns [ 3, 2 ]
4153+
*
4154+
* var arr = ndarray2array( x );
4155+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
4156+
*
4157+
* var y = ns.toFlippedlr( x );
4158+
* // returns <ndarray>
4159+
*
4160+
* sh = y.shape;
4161+
* // returns [ 3, 2 ]
4162+
*
4163+
* arr = ndarray2array( y );
4164+
* // returns [ [ 2.0, 1.0 ], [ 4.0, 3.0 ], [ 6.0, 5.0 ] ]
4165+
*/
4166+
toFlippedlr: typeof toFlippedlr;
4167+
4168+
/**
4169+
* Returns a new ndarray where the order of elements along the second-to-last dimension of an input ndarray is reversed.
4170+
*
4171+
* @param x - input array
4172+
* @returns output array
4173+
*
4174+
* @example
4175+
* var typedarray = require( '@stdlib/array/typed' );
4176+
* var ndarray = require( '@stdlib/ndarray/ctor' );
4177+
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
4178+
*
4179+
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' );
4180+
* var shape = [ 3, 2 ];
4181+
* var strides = [ 2, 1 ];
4182+
* var offset = 0;
4183+
*
4184+
* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
4185+
* // returns <ndarray>
4186+
*
4187+
* var sh = x.shape;
4188+
* // returns [ 3, 2 ]
4189+
*
4190+
* var arr = ndarray2array( x );
4191+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
4192+
*
4193+
* var y = ns.toFlippedud( x );
4194+
* // returns <ndarray>
4195+
*
4196+
* sh = y.shape;
4197+
* // returns [ 3, 2 ]
4198+
*
4199+
* arr = ndarray2array( y );
4200+
* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
4201+
*/
4202+
toFlippedud: typeof toFlippedud;
4203+
41084204
/**
41094205
* Normalizes a list of indices to the interval `[0,max]`.
41104206
*
@@ -4161,6 +4257,43 @@ interface Namespace {
41614257
*/
41624258
toReversed: typeof toReversed;
41634259

4260+
/**
4261+
* Returns a new ndarray where the order of elements of an input ndarray along a specified dimension is reversed.
4262+
*
4263+
* @param x - input array
4264+
* @param dim - index of dimension to reverse
4265+
* @returns output array
4266+
*
4267+
* @example
4268+
* var typedarray = require( '@stdlib/array/typed' );
4269+
* var ndarray = require( '@stdlib/ndarray/ctor' );
4270+
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
4271+
*
4272+
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' );
4273+
* var shape = [ 3, 2 ];
4274+
* var strides = [ 2, 1 ];
4275+
* var offset = 0;
4276+
*
4277+
* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
4278+
* // returns <ndarray>
4279+
*
4280+
* var sh = x.shape;
4281+
* // returns [ 3, 2 ]
4282+
*
4283+
* var arr = ndarray2array( x );
4284+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
4285+
*
4286+
* var y = ns.toReversedDimension( x, 0 );
4287+
* // returns <ndarray>
4288+
*
4289+
* sh = y.shape;
4290+
* // returns [ 3, 2 ]
4291+
*
4292+
* arr = ndarray2array( y );
4293+
* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
4294+
*/
4295+
toReversedDimension: typeof toReversedDimension;
4296+
41644297
/**
41654298
* Returns a list of unique indices after normalizing to the interval `[0,max]`.
41664299
*

0 commit comments

Comments
 (0)