Skip to content

Commit b6cd4ce

Browse files
authored
feat: update ndarray/base TypeScript declarations
PR-URL: #11113 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 60ced5c commit b6cd4ce

File tree

1 file changed

+64
-0
lines changed
  • lib/node_modules/@stdlib/ndarray/base/docs/types

1 file changed

+64
-0
lines changed

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

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import any = require( '@stdlib/ndarray/base/any' );
2424
import anyBy = require( '@stdlib/ndarray/base/any-by' );
2525
import assert = require( '@stdlib/ndarray/base/assert' );
2626
import assign = require( '@stdlib/ndarray/base/assign' );
27+
import assignScalar = require( '@stdlib/ndarray/base/assign-scalar' );
2728
import atleastnd = require( '@stdlib/ndarray/base/atleastnd' );
2829
import binary = require( '@stdlib/ndarray/base/binary' );
2930
import binaryInputCastingDataType = require( '@stdlib/ndarray/base/binary-input-casting-dtype' );
@@ -87,6 +88,7 @@ import forEach = require( '@stdlib/ndarray/base/for-each' );
8788
import array2ndarray = require( '@stdlib/ndarray/base/from-array' );
8889
import scalar2ndarray = require( '@stdlib/ndarray/base/from-scalar' );
8990
import scalar2ndarrayLike = require( '@stdlib/ndarray/base/from-scalar-like' );
91+
import full = require( '@stdlib/ndarray/base/full' );
9092
import includes = require( '@stdlib/ndarray/base/includes' );
9193
import ind = require( '@stdlib/ndarray/base/ind' );
9294
import ind2sub = require( '@stdlib/ndarray/base/ind2sub' );
@@ -305,6 +307,44 @@ interface Namespace {
305307
*/
306308
assign: typeof assign;
307309

310+
/**
311+
* Assigns a scalar value to every element of an output ndarray.
312+
*
313+
* @param arrays - array-like object containing a zero-dimensional input ndarray containing the scalar value and one output ndarray
314+
*
315+
* @example
316+
* var Float64Array = require( '@stdlib/array/float64' );
317+
* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
318+
* var ndarray = require( '@stdlib/ndarray/ctor' );
319+
*
320+
* // Create a zero-dimensional ndarray containing the scalar value:
321+
* var x = scalar2ndarray( 5.0, {
322+
* 'dtype': 'float64'
323+
* });
324+
*
325+
* // Create a data buffer:
326+
* var ybuf = new Float64Array( 4 );
327+
*
328+
* // Define the shape of the output array:
329+
* var shape = [ 2, 2 ];
330+
*
331+
* // Define the array strides:
332+
* var sy = [ 2, 1 ];
333+
*
334+
* // Define the index offset:
335+
* var oy = 0;
336+
*
337+
* // Create the output ndarray:
338+
* var y = ndarray( 'float64', ybuf, shape, sy, oy, 'row-major' );
339+
*
340+
* // Assign the scalar value:
341+
* ns.assignScalar( [ x, y ] );
342+
*
343+
* console.log( y.data );
344+
* // => <Float64Array>[ 5.0, 5.0, 5.0, 5.0 ]
345+
*/
346+
assignScalar: typeof assignScalar;
347+
308348
/**
309349
* Converts a list of values (scalars and/or ndarrays) to ndarrays having at least a specified number of dimensions.
310350
*
@@ -2041,6 +2081,30 @@ interface Namespace {
20412081
*/
20422082
scalar2ndarrayLike: typeof scalar2ndarrayLike;
20432083

2084+
/**
2085+
* Returns an ndarray filled with a specified value and having a specified shape and data type.
2086+
*
2087+
* @param value - fill value
2088+
* @param dtype - underlying data type
2089+
* @param shape - array shape
2090+
* @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
2091+
* @returns output array
2092+
*
2093+
* @example
2094+
* var getShape = require( '@stdlib/ndarray/shape' );
2095+
* var getDType = require( '@stdlib/ndarray/dtype' );
2096+
*
2097+
* var arr = ns.full( 10.0, 'float32', [ 2, 2 ], 'row-major' );
2098+
* // returns <ndarray>[ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ]
2099+
*
2100+
* var sh = getShape( arr );
2101+
* // returns [ 2, 2 ]
2102+
*
2103+
* var dt = String( getDType( arr ) );
2104+
* // returns 'float32'
2105+
*/
2106+
full: typeof full;
2107+
20442108
/**
20452109
* Tests whether an ndarray contains a specified value.
20462110
*

0 commit comments

Comments
 (0)