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