Skip to content

Commit 9d455ea

Browse files
committed
Auto-generated commit
1 parent 03ab039 commit 9d455ea

File tree

3 files changed

+176
-1
lines changed

3 files changed

+176
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-12-15)
7+
## Unreleased (2024-12-16)
88

99
<section class="packages">
1010

@@ -20,6 +20,7 @@
2020

2121
##### Features
2222

23+
- [`58e795d`](https://github.com/stdlib-js/stdlib/commit/58e795db467b7bd1d3dc6c5847f91a97fed2ccff) - update namespace TypeScript declarations [(#3937)](https://github.com/stdlib-js/stdlib/pull/3937)
2324
- [`14427c7`](https://github.com/stdlib-js/stdlib/commit/14427c79bc62f82b16cbadc9d34749901e48d105) - add `fill`, `map`, and `toReversed` to namespace
2425
- [`a0d6619`](https://github.com/stdlib-js/stdlib/commit/a0d66193409576538d0f16aa89cbaeedec7898be) - add `minSignedIntegerDataType` and `minUnsignedIntegerDataType` to namespace
2526
- [`8b1548f`](https://github.com/stdlib-js/stdlib/commit/8b1548fb45c1ff131f5edac20cb984344a2d28ec) - update namespace TypeScript declarations [(#3190)](https://github.com/stdlib-js/stdlib/pull/3190)
@@ -482,6 +483,10 @@ A total of 3 people contributed to this release. Thank you to the following cont
482483

483484
<details>
484485

486+
- [`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)_
487+
- [`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)_
488+
- [`58f02bf`](https://github.com/stdlib-js/stdlib/commit/58f02bf605d6879cd80152f11f913451df2ad494) - **docs:** fix comment _(by Athan Reines)_
489+
- [`baffefb`](https://github.com/stdlib-js/stdlib/commit/baffefb25177147fa3bafa5c1d0562a7528d5054) - **docs:** fix comment _(by Athan Reines)_
485490
- [`14427c7`](https://github.com/stdlib-js/stdlib/commit/14427c79bc62f82b16cbadc9d34749901e48d105) - **feat:** add `fill`, `map`, and `toReversed` to namespace _(by Athan Reines)_
486491
- [`a0d6619`](https://github.com/stdlib-js/stdlib/commit/a0d66193409576538d0f16aa89cbaeedec7898be) - **feat:** add `minSignedIntegerDataType` and `minUnsignedIntegerDataType` to namespace _(by Athan Reines)_
487492
- [`97e8c1a`](https://github.com/stdlib-js/stdlib/commit/97e8c1aff4f7c1a3b0946d15354a926d82e2120a) - **feat:** add `ndarray/base/min-unsigned-integer-dtype` _(by Athan Reines)_

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ var o = ns;
105105
- <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>
106106
- <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>
107107
- <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>
108+
- <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>
108109
- <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>
109110
- <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>
110111
- <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>
@@ -114,10 +115,13 @@ var o = ns;
114115
- <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>
115116
- <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>
116117
- <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>
118+
- <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>
117119
- <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>
118120
- <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>
119121
- <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>
120122
- <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>
123+
- <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>
124+
- <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>
121125
- <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>
122126
- <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>
123127
- <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>
@@ -158,6 +162,7 @@ var o = ns;
158162
- <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>
159163
- <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>
160164
- <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>
165+
- <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>
161166
- <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>
162167
- <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>
163168
- <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>
@@ -350,6 +355,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
350355

351356
[@stdlib/ndarray/base/expand-dimensions]: https://github.com/stdlib-js/ndarray-base-expand-dimensions
352357

358+
[@stdlib/ndarray/base/fill]: https://github.com/stdlib-js/ndarray-base-fill
359+
353360
[@stdlib/ndarray/base/flag]: https://github.com/stdlib-js/ndarray-base-flag
354361

355362
[@stdlib/ndarray/base/flags]: https://github.com/stdlib-js/ndarray-base-flags
@@ -368,6 +375,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
368375

369376
[@stdlib/ndarray/base/iteration-order]: https://github.com/stdlib-js/ndarray-base-iteration-order
370377

378+
[@stdlib/ndarray/base/map]: https://github.com/stdlib-js/ndarray-base-map
379+
371380
[@stdlib/ndarray/base/max-view-buffer-index]: https://github.com/stdlib-js/ndarray-base-max-view-buffer-index
372381

373382
[@stdlib/ndarray/base/maybe-broadcast-array]: https://github.com/stdlib-js/ndarray-base-maybe-broadcast-array
@@ -376,6 +385,10 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
376385

377386
[@stdlib/ndarray/base/meta-data-props]: https://github.com/stdlib-js/ndarray-base-meta-data-props
378387

388+
[@stdlib/ndarray/base/min-signed-integer-dtype]: https://github.com/stdlib-js/ndarray-base-min-signed-integer-dtype
389+
390+
[@stdlib/ndarray/base/min-unsigned-integer-dtype]: https://github.com/stdlib-js/ndarray-base-min-unsigned-integer-dtype
391+
379392
[@stdlib/ndarray/base/min-view-buffer-index]: https://github.com/stdlib-js/ndarray-base-min-view-buffer-index
380393

381394
[@stdlib/ndarray/base/minmax-view-buffer-index]: https://github.com/stdlib-js/ndarray-base-minmax-view-buffer-index
@@ -456,6 +469,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
456469

457470
[@stdlib/ndarray/base/to-array]: https://github.com/stdlib-js/ndarray-base-to-array
458471

472+
[@stdlib/ndarray/base/to-reversed]: https://github.com/stdlib-js/ndarray-base-to-reversed
473+
459474
[@stdlib/ndarray/base/transpose]: https://github.com/stdlib-js/ndarray-base-transpose
460475

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

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( '@stdlib/ndarray-base-dtypes2signatures' );
5050
import empty = require( '@stdlib/ndarray-base-empty' );
5151
import emptyLike = require( '@stdlib/ndarray-base-empty-like' );
5252
import expandDimensions = require( '@stdlib/ndarray-base-expand-dimensions' );
53+
import fill = require( '@stdlib/ndarray-base-fill' );
5354
import flag = require( '@stdlib/ndarray-base-flag' );
5455
import flags = require( '@stdlib/ndarray-base-flags' );
5556
import fliplr = require( '@stdlib/ndarray-base-fliplr' );
@@ -59,10 +60,13 @@ import scalar2ndarray = require( '@stdlib/ndarray-base-from-scalar' );
5960
import ind = require( '@stdlib/ndarray-base-ind' );
6061
import ind2sub = require( '@stdlib/ndarray-base-ind2sub' );
6162
import iterationOrder = require( '@stdlib/ndarray-base-iteration-order' );
63+
import map = require( '@stdlib/ndarray-base-map' );
6264
import maxViewBufferIndex = require( '@stdlib/ndarray-base-max-view-buffer-index' );
6365
import maybeBroadcastArray = require( '@stdlib/ndarray-base-maybe-broadcast-array' );
6466
import maybeBroadcastArrays = require( '@stdlib/ndarray-base-maybe-broadcast-arrays' );
6567
import metaDataProps = require( '@stdlib/ndarray-base-meta-data-props' );
68+
import minSignedIntegerDataType = require( '@stdlib/ndarray-base-min-signed-integer-dtype' );
69+
import minUnsignedIntegerDataType = require( '@stdlib/ndarray-base-min-unsigned-integer-dtype' );
6670
import minViewBufferIndex = require( '@stdlib/ndarray-base-min-view-buffer-index' );
6771
import minmaxViewBufferIndex = require( '@stdlib/ndarray-base-minmax-view-buffer-index' );
6872
import ndarraylike2ndarray = require( '@stdlib/ndarray-base-ndarraylike2ndarray' );
@@ -103,6 +107,7 @@ import strides2offset = require( '@stdlib/ndarray-base-strides2offset' );
103107
import strides2order = require( '@stdlib/ndarray-base-strides2order' );
104108
import sub2ind = require( '@stdlib/ndarray-base-sub2ind' );
105109
import ndarray2array = require( '@stdlib/ndarray-base-to-array' );
110+
import toReversed = require( '@stdlib/ndarray-base-to-reversed' );
106111
import transpose = require( '@stdlib/ndarray-base-transpose' );
107112
import unary = require( '@stdlib/ndarray-base-unary' );
108113
import unaryBy = require( '@stdlib/ndarray-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( '@stdlib/ndarray-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( '@stdlib/ndarray-ctor' );
2849+
* var ndarray2array = require( '@stdlib/ndarray-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)