Skip to content

Commit 8b71ded

Browse files
committed
Auto-generated commit
1 parent 7762b2f commit 8b71ded

File tree

3 files changed

+173
-0
lines changed

3 files changed

+173
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858

5959
##### Features
6060

61+
- [`58e795d`](https://github.com/stdlib-js/stdlib/commit/58e795db467b7bd1d3dc6c5847f91a97fed2ccff) - update namespace TypeScript declarations [(#3937)](https://github.com/stdlib-js/stdlib/pull/3937)
6162
- [`14427c7`](https://github.com/stdlib-js/stdlib/commit/14427c79bc62f82b16cbadc9d34749901e48d105) - add `fill`, `map`, and `toReversed` to namespace
6263
- [`a0d6619`](https://github.com/stdlib-js/stdlib/commit/a0d66193409576538d0f16aa89cbaeedec7898be) - add `minSignedIntegerDataType` and `minUnsignedIntegerDataType` to namespace
6364
- [`8b1548f`](https://github.com/stdlib-js/stdlib/commit/8b1548fb45c1ff131f5edac20cb984344a2d28ec) - update namespace TypeScript declarations [(#3190)](https://github.com/stdlib-js/stdlib/pull/3190)
@@ -386,6 +387,8 @@ A total of 3 people contributed to this release. Thank you to the following cont
386387

387388
<details>
388389

390+
- [`58e795d`](https://github.com/stdlib-js/stdlib/commit/58e795db467b7bd1d3dc6c5847f91a97fed2ccff) - **feat:** update namespace TypeScript declarations [(#3937)](https://github.com/stdlib-js/stdlib/pull/3937) _(by stdlib-bot, Philipp Burckhardt)_
391+
- [`c106b69`](https://github.com/stdlib-js/stdlib/commit/c106b69cc141efc8c32e79d55ad8acf07f3c9c0a) - **docs:** update namespace table of contents [(#3939)](https://github.com/stdlib-js/stdlib/pull/3939) _(by stdlib-bot, Philipp Burckhardt)_
389392
- [`58f02bf`](https://github.com/stdlib-js/stdlib/commit/58f02bf605d6879cd80152f11f913451df2ad494) - **docs:** fix comment _(by Athan Reines)_
390393
- [`baffefb`](https://github.com/stdlib-js/stdlib/commit/baffefb25177147fa3bafa5c1d0562a7528d5054) - **docs:** fix comment _(by Athan Reines)_
391394
- [`0546f39`](https://github.com/stdlib-js/stdlib/commit/0546f395abecb502fd703aa364e758bd733cd18e) - **docs:** disable lint rule _(by Athan Reines)_

base/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ var o = ns;
7272
- <span class="signature">[`emptyLike( x )`][@stdlib/ndarray/base/empty-like]</span><span class="delimiter">: </span><span class="description">create an uninitialized ndarray having the same shape and data type as a provided ndarray.</span>
7373
- <span class="signature">[`empty( dtype, shape, order )`][@stdlib/ndarray/base/empty]</span><span class="delimiter">: </span><span class="description">create an uninitialized ndarray having a specified shape and data type.</span>
7474
- <span class="signature">[`expandDimensions( x, axis )`][@stdlib/ndarray/base/expand-dimensions]</span><span class="delimiter">: </span><span class="description">expand the shape of an array by inserting a new dimension of size one at a specified axis.</span>
75+
- <span class="signature">[`fill( x, value )`][@stdlib/ndarray/base/fill]</span><span class="delimiter">: </span><span class="description">fill an input ndarray with a specified value.</span>
7576
- <span class="signature">[`flag( x, name )`][@stdlib/ndarray/base/flag]</span><span class="delimiter">: </span><span class="description">return a specified flag for a provided ndarray.</span>
7677
- <span class="signature">[`flags( x, copy )`][@stdlib/ndarray/base/flags]</span><span class="delimiter">: </span><span class="description">return the flags of a provided ndarray.</span>
7778
- <span class="signature">[`fliplr( x, writable )`][@stdlib/ndarray/base/fliplr]</span><span class="delimiter">: </span><span class="description">return a view of an input ndarray in which the order of elements along the last dimension is reversed.</span>
@@ -81,10 +82,13 @@ var o = ns;
8182
- <span class="signature">[`ind( idx, max, mode )`][@stdlib/ndarray/base/ind]</span><span class="delimiter">: </span><span class="description">return an index given an index mode.</span>
8283
- <span class="signature">[`ind2sub( shape, strides, offset, order, idx, mode )`][@stdlib/ndarray/base/ind2sub]</span><span class="delimiter">: </span><span class="description">convert a linear index to an array of subscripts.</span>
8384
- <span class="signature">[`iterationOrder( strides )`][@stdlib/ndarray/base/iteration-order]</span><span class="delimiter">: </span><span class="description">given a stride array, determine array iteration order.</span>
85+
- <span class="signature">[`map( arrays, fcn[, thisArg] )`][@stdlib/ndarray/base/map]</span><span class="delimiter">: </span><span class="description">apply a callback function to elements in an input ndarray and assign results to elements in an output ndarray.</span>
8486
- <span class="signature">[`maxViewBufferIndex( shape, strides, offset )`][@stdlib/ndarray/base/max-view-buffer-index]</span><span class="delimiter">: </span><span class="description">compute the maximum linear index in an underlying data buffer accessible to an array view.</span>
8587
- <span class="signature">[`maybeBroadcastArray( arr, shape )`][@stdlib/ndarray/base/maybe-broadcast-array]</span><span class="delimiter">: </span><span class="description">broadcast an ndarray to a specified shape if and only if the specified shape differs from the provided ndarray's shape.</span>
8688
- <span class="signature">[`maybeBroadcastArrays( arrays )`][@stdlib/ndarray/base/maybe-broadcast-arrays]</span><span class="delimiter">: </span><span class="description">broadcast ndarrays to a common shape.</span>
8789
- <span class="signature">[`metaDataProps( meta, dtypes, obj )`][@stdlib/ndarray/base/meta-data-props]</span><span class="delimiter">: </span><span class="description">define non-enumerable read-only properties which expose ndarray function meta data.</span>
90+
- <span class="signature">[`minSignedIntegerDataType( value )`][@stdlib/ndarray/base/min-signed-integer-dtype]</span><span class="delimiter">: </span><span class="description">determine the minimum ndarray data type for storing a provided signed integer value.</span>
91+
- <span class="signature">[`minUnsignedIntegerDataType( value )`][@stdlib/ndarray/base/min-unsigned-integer-dtype]</span><span class="delimiter">: </span><span class="description">determine the minimum ndarray data type for storing a provided unsigned integer value.</span>
8892
- <span class="signature">[`minViewBufferIndex( shape, strides, offset )`][@stdlib/ndarray/base/min-view-buffer-index]</span><span class="delimiter">: </span><span class="description">compute the minimum linear index in an underlying data buffer accessible to an array view.</span>
8993
- <span class="signature">[`minmaxViewBufferIndex( shape, strides, offset )`][@stdlib/ndarray/base/minmax-view-buffer-index]</span><span class="delimiter">: </span><span class="description">compute the minimum and maximum linear indices in an underlying data buffer which are accessible to an array view.</span>
9094
- <span class="signature">[`ndarraylike2ndarray( x )`][@stdlib/ndarray/base/ndarraylike2ndarray]</span><span class="delimiter">: </span><span class="description">convert an ndarray-like object to an `ndarray`.</span>
@@ -125,6 +129,7 @@ var o = ns;
125129
- <span class="signature">[`strides2order( strides )`][@stdlib/ndarray/base/strides2order]</span><span class="delimiter">: </span><span class="description">determine the order of a multidimensional array based on a provided stride array.</span>
126130
- <span class="signature">[`sub2ind( shape, strides, offset, ...subscripts, mode )`][@stdlib/ndarray/base/sub2ind]</span><span class="delimiter">: </span><span class="description">convert subscripts to a linear index.</span>
127131
- <span class="signature">[`ndarray2array( buffer, shape, strides, offset, order )`][@stdlib/ndarray/base/to-array]</span><span class="delimiter">: </span><span class="description">convert an ndarray buffer to a generic array.</span>
132+
- <span class="signature">[`toReversed( x )`][@stdlib/ndarray/base/to-reversed]</span><span class="delimiter">: </span><span class="description">return a new ndarray where the order of elements of an input ndarray is reversed along each dimension.</span>
128133
- <span class="signature">[`transpose( x )`][@stdlib/ndarray/base/transpose]</span><span class="delimiter">: </span><span class="description">transpose a matrix (or a stack of matrices).</span>
129134
- <span class="signature">[`unaryBy( arrays, fcn, clbk[, thisArg] )`][@stdlib/ndarray/base/unary-by]</span><span class="delimiter">: </span><span class="description">apply a unary function to each element in an input ndarray according to a callback function and assign results to elements in an output ndarray.</span>
130135
- <span class="signature">[`unaryLoopOrder( shape, stridesX, stridesY )`][@stdlib/ndarray/base/unary-loop-interchange-order]</span><span class="delimiter">: </span><span class="description">reorder ndarray dimensions and associated strides for loop interchange.</span>
@@ -249,6 +254,8 @@ console.log( objectKeys( ns ) );
249254

250255
[@stdlib/ndarray/base/expand-dimensions]: https://github.com/stdlib-js/ndarray/tree/main/base/expand-dimensions
251256

257+
[@stdlib/ndarray/base/fill]: https://github.com/stdlib-js/ndarray/tree/main/base/fill
258+
252259
[@stdlib/ndarray/base/flag]: https://github.com/stdlib-js/ndarray/tree/main/base/flag
253260

254261
[@stdlib/ndarray/base/flags]: https://github.com/stdlib-js/ndarray/tree/main/base/flags
@@ -267,6 +274,8 @@ console.log( objectKeys( ns ) );
267274

268275
[@stdlib/ndarray/base/iteration-order]: https://github.com/stdlib-js/ndarray/tree/main/base/iteration-order
269276

277+
[@stdlib/ndarray/base/map]: https://github.com/stdlib-js/ndarray/tree/main/base/map
278+
270279
[@stdlib/ndarray/base/max-view-buffer-index]: https://github.com/stdlib-js/ndarray/tree/main/base/max-view-buffer-index
271280

272281
[@stdlib/ndarray/base/maybe-broadcast-array]: https://github.com/stdlib-js/ndarray/tree/main/base/maybe-broadcast-array
@@ -275,6 +284,10 @@ console.log( objectKeys( ns ) );
275284

276285
[@stdlib/ndarray/base/meta-data-props]: https://github.com/stdlib-js/ndarray/tree/main/base/meta-data-props
277286

287+
[@stdlib/ndarray/base/min-signed-integer-dtype]: https://github.com/stdlib-js/ndarray/tree/main/base/min-signed-integer-dtype
288+
289+
[@stdlib/ndarray/base/min-unsigned-integer-dtype]: https://github.com/stdlib-js/ndarray/tree/main/base/min-unsigned-integer-dtype
290+
278291
[@stdlib/ndarray/base/min-view-buffer-index]: https://github.com/stdlib-js/ndarray/tree/main/base/min-view-buffer-index
279292

280293
[@stdlib/ndarray/base/minmax-view-buffer-index]: https://github.com/stdlib-js/ndarray/tree/main/base/minmax-view-buffer-index
@@ -355,6 +368,8 @@ console.log( objectKeys( ns ) );
355368

356369
[@stdlib/ndarray/base/to-array]: https://github.com/stdlib-js/ndarray/tree/main/base/to-array
357370

371+
[@stdlib/ndarray/base/to-reversed]: https://github.com/stdlib-js/ndarray/tree/main/base/to-reversed
372+
358373
[@stdlib/ndarray/base/transpose]: https://github.com/stdlib-js/ndarray/tree/main/base/transpose
359374

360375
[@stdlib/ndarray/base/unary-by]: https://github.com/stdlib-js/ndarray/tree/main/base/unary-by

base/docs/types/index.d.ts

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import dtypes2signatures = require( './../../../base/dtypes2signatures' );
5050
import empty = require( './../../../base/empty' );
5151
import emptyLike = require( './../../../base/empty-like' );
5252
import expandDimensions = require( './../../../base/expand-dimensions' );
53+
import fill = require( './../../../base/fill' );
5354
import flag = require( './../../../base/flag' );
5455
import flags = require( './../../../base/flags' );
5556
import fliplr = require( './../../../base/fliplr' );
@@ -59,10 +60,13 @@ import scalar2ndarray = require( './../../../base/from-scalar' );
5960
import ind = require( './../../../base/ind' );
6061
import ind2sub = require( './../../../base/ind2sub' );
6162
import iterationOrder = require( './../../../base/iteration-order' );
63+
import map = require( './../../../base/map' );
6264
import maxViewBufferIndex = require( './../../../base/max-view-buffer-index' );
6365
import maybeBroadcastArray = require( './../../../base/maybe-broadcast-array' );
6466
import maybeBroadcastArrays = require( './../../../base/maybe-broadcast-arrays' );
6567
import metaDataProps = require( './../../../base/meta-data-props' );
68+
import minSignedIntegerDataType = require( './../../../base/min-signed-integer-dtype' );
69+
import minUnsignedIntegerDataType = require( './../../../base/min-unsigned-integer-dtype' );
6670
import minViewBufferIndex = require( './../../../base/min-view-buffer-index' );
6771
import minmaxViewBufferIndex = require( './../../../base/minmax-view-buffer-index' );
6872
import ndarraylike2ndarray = require( './../../../base/ndarraylike2ndarray' );
@@ -103,6 +107,7 @@ import strides2offset = require( './../../../base/strides2offset' );
103107
import strides2order = require( './../../../base/strides2order' );
104108
import sub2ind = require( './../../../base/sub2ind' );
105109
import ndarray2array = require( './../../../base/to-array' );
110+
import toReversed = require( './../../../base/to-reversed' );
106111
import transpose = require( './../../../base/transpose' );
107112
import unary = require( './../../../base/unary' );
108113
import unaryBy = require( './../../../base/unary-by' );
@@ -938,6 +943,44 @@ interface Namespace {
938943
*/
939944
expandDimensions: typeof expandDimensions;
940945

946+
/**
947+
* Fills an input ndarray with a specified value.
948+
*
949+
* @param x - input ndarray
950+
* @param value - scalar value
951+
*
952+
* @example
953+
* var Float64Array = require( '@stdlib/array/float64' );
954+
*
955+
* // Create a data buffer:
956+
* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
957+
*
958+
* // Define the shape of the input array:
959+
* var shape = [ 3, 1, 2 ];
960+
*
961+
* // Define the array strides:
962+
* var sx = [ 2, 2, 1 ];
963+
*
964+
* // Define the index offset:
965+
* var ox = 0;
966+
*
967+
* // Create the input ndarray-like object:
968+
* var x = {
969+
* 'dtype': 'float64',
970+
* 'data': xbuf,
971+
* 'shape': shape,
972+
* 'strides': sx,
973+
* 'offset': ox,
974+
* 'order': 'row-major'
975+
* };
976+
*
977+
* ns.fill( x, 10.0 );
978+
*
979+
* console.log( x.data );
980+
* // => <Float64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
981+
*/
982+
fill: typeof fill;
983+
941984
/**
942985
* Returns a specified flag for a provided ndarray.
943986
*
@@ -1291,6 +1334,50 @@ interface Namespace {
12911334
*/
12921335
iterationOrder: typeof iterationOrder;
12931336

1337+
/**
1338+
* Applies a callback function to the elements in an input ndarray and assigns results to the elements in an output ndarray.
1339+
*
1340+
* @param arrays - array-like object containing one input ndarray and one output ndarray
1341+
* @param fcn - callback function
1342+
* @param thisArg - callback function execution context
1343+
* @throws arrays must have the same number of dimensions
1344+
* @throws arrays must have the same shape
1345+
*
1346+
* @example
1347+
* var Float64Array = require( '@stdlib/array/float64' );
1348+
* var ndarray = require( './../../../ctor' );
1349+
*
1350+
* function scale( x ) {
1351+
* return x * 10.0;
1352+
* }
1353+
*
1354+
* // Create data buffers:
1355+
* 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 ] );
1356+
* var ybuf = new Float64Array( 6 );
1357+
*
1358+
* // Define the shape of the input and output arrays:
1359+
* var shape = [ 3, 1, 2 ];
1360+
*
1361+
* // Define the array strides:
1362+
* var sx = [ 4, 4, 1 ];
1363+
* var sy = [ 2, 2, 1 ];
1364+
*
1365+
* // Define the index offsets:
1366+
* var ox = 1;
1367+
* var oy = 0;
1368+
*
1369+
* // Create the input and output ndarrays:
1370+
* var x = ndarray( 'float64', xbuf, shape, sx, ox, 'row-major' );
1371+
* var y = ndarray( 'float64', ybuf, shape, sy, oy, 'row-major' );
1372+
*
1373+
* // Apply the ns.map function:
1374+
* ns.map( [ x, y ], scale );
1375+
*
1376+
* console.log( y.data );
1377+
* // => <Float64Array>[ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]
1378+
*/
1379+
map: typeof map;
1380+
12941381
/**
12951382
* Computes the maximum linear index in an underlying data buffer accessible to an array view.
12961383
*
@@ -1484,6 +1571,38 @@ interface Namespace {
14841571
*/
14851572
metaDataProps: typeof metaDataProps;
14861573

1574+
/**
1575+
* Returns the minimum ndarray data type for storing a provided signed integer value.
1576+
*
1577+
* @param value - scalar value
1578+
* @returns ndarray data type
1579+
*
1580+
* @example
1581+
* var dt = ns.minSignedIntegerDataType( 1280 );
1582+
* // returns 'int16'
1583+
*
1584+
* @example
1585+
* var dt = ns.minSignedIntegerDataType( 3 );
1586+
* // returns 'int8'
1587+
*/
1588+
minSignedIntegerDataType: typeof minSignedIntegerDataType;
1589+
1590+
/**
1591+
* Returns the minimum ndarray data type for storing a provided unsigned integer value.
1592+
*
1593+
* @param value - scalar value
1594+
* @returns ndarray data type
1595+
*
1596+
* @example
1597+
* var dt = ns.minUnsignedIntegerDataType( 1280 );
1598+
* // returns 'uint16'
1599+
*
1600+
* @example
1601+
* var dt = ns.minUnsignedIntegerDataType( 3 );
1602+
* // returns 'uint8'
1603+
*/
1604+
minUnsignedIntegerDataType: typeof minUnsignedIntegerDataType;
1605+
14871606
/**
14881607
* Computes the minimum linear index in an underlying data buffer accessible to an array view.
14891608
*
@@ -2718,6 +2837,42 @@ interface Namespace {
27182837
*/
27192838
ndarray2array: typeof ndarray2array;
27202839

2840+
/**
2841+
* Returns a new ndarray where the order of elements of an input ndarray is reversed along each dimension.
2842+
*
2843+
* @param x - input array
2844+
* @returns output array
2845+
*
2846+
* @example
2847+
* var typedarray = require( '@stdlib/array/typed' );
2848+
* var ndarray = require( './../../../ctor' );
2849+
* var ndarray2array = require( './../../../to-array' );
2850+
*
2851+
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' );
2852+
* var shape = [ 3, 2 ];
2853+
* var strides = [ 2, 1 ];
2854+
* var offset = 0;
2855+
*
2856+
* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
2857+
* // returns <ndarray>
2858+
*
2859+
* var sh = x.shape;
2860+
* // returns [ 3, 2 ]
2861+
*
2862+
* var arr = ndarray2array( x );
2863+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
2864+
*
2865+
* var y = ns.toReversed( x );
2866+
* // returns <ndarray>
2867+
*
2868+
* sh = y.shape;
2869+
* // returns [ 3, 2 ]
2870+
*
2871+
* arr = ndarray2array( y );
2872+
* // returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ]
2873+
*/
2874+
toReversed: typeof toReversed;
2875+
27212876
/**
27222877
* Transposes a matrix (or a stack of matrices).
27232878
*

0 commit comments

Comments
 (0)