Skip to content

Commit 4b2a4ab

Browse files
authored
feat: update ndarray TypeScript declarations
PR-URL: #11150 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 475f496 commit 4b2a4ab

1 file changed

Lines changed: 41 additions & 8 deletions

File tree

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

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

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import nextDataType = require( '@stdlib/ndarray/next-dtype' );
8282
import numel = require( '@stdlib/ndarray/numel' );
8383
import numelDimension = require( '@stdlib/ndarray/numel-dimension' );
8484
import offset = require( '@stdlib/ndarray/offset' );
85+
import ones = require( '@stdlib/ndarray/ones' );
8586
import order = require( '@stdlib/ndarray/order' );
8687
import orders = require( '@stdlib/ndarray/orders' );
8788
import outputDataTypePolicies = require( '@stdlib/ndarray/output-dtype-policies' );
@@ -1007,16 +1008,19 @@ interface Namespace {
10071008
* @param options.order - specifies whether an array is row-major (C-style) or column-major (Fortran-style) (default: 'row-major')
10081009
* @param options.mode - specifies how to handle a linear index which exceeds array dimensions
10091010
* @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis
1010-
* @returns zero-filled array
1011+
* @returns output array
10111012
*
10121013
* @example
1014+
* var getShape = require( '@stdlib/ndarray/shape' );
1015+
* var getDType = require( '@stdlib/ndarray/dtype' );
1016+
*
10131017
* var arr = ns.empty( [ 2, 2 ] );
10141018
* // returns <ndarray>
10151019
*
1016-
* var sh = arr.shape;
1020+
* var sh = getShape( arr );
10171021
* // returns [ 2, 2 ]
10181022
*
1019-
* var dt = arr.dtype;
1023+
* var dt = String( getDType( arr ) );
10201024
* // returns 'float64'
10211025
*/
10221026
empty: typeof empty;
@@ -1034,26 +1038,28 @@ interface Namespace {
10341038
* @returns output array
10351039
*
10361040
* @example
1041+
* var getShape = require( '@stdlib/ndarray/shape' );
1042+
* var getDType = require( '@stdlib/ndarray/dtype' );
10371043
* var zeros = require( '@stdlib/ndarray/zeros' );
10381044
*
10391045
* var x = zeros( [ 2, 2 ], {
10401046
* 'dtype': 'float64'
10411047
* });
1042-
* // returns <ndarray>
1048+
* // returns <ndarray>[ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]
10431049
*
1044-
* var sh = x.shape;
1050+
* var sh = getShape( x );
10451051
* // returns [ 2, 2 ]
10461052
*
1047-
* var dt = x.dtype;
1053+
* var dt = String( getDType( x ) );
10481054
* // returns 'float64'
10491055
*
10501056
* var y = ns.emptyLike( x );
10511057
* // returns <ndarray>
10521058
*
1053-
* sh = y.shape;
1059+
* sh = getShape( y );
10541060
* // returns [ 2, 2 ]
10551061
*
1056-
* dt = y.dtype;
1062+
* dt = String( getDType( y ) );
10571063
* // returns 'float64'
10581064
*/
10591065
emptyLike: typeof emptyLike;
@@ -2304,6 +2310,33 @@ interface Namespace {
23042310
*/
23052311
offset: typeof offset;
23062312

2313+
/**
2314+
* Creates a ones-filled array having a specified shape and data type.
2315+
*
2316+
* @param shape - array shape
2317+
* @param options - options
2318+
* @param options.dtype - underlying data type (default: 'float64')
2319+
* @param options.order - specifies whether an array is row-major (C-style) or column-major (Fortran-style) (default: 'row-major')
2320+
* @param options.mode - specifies how to handle a linear index which exceeds array dimensions
2321+
* @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis
2322+
* @param options.readonly - boolean indicating whether an array should be read-only
2323+
* @returns ones-filled array
2324+
*
2325+
* @example
2326+
* var getShape = require( '@stdlib/ndarray/shape' );
2327+
* var getDType = require( '@stdlib/ndarray/dtype' );
2328+
*
2329+
* var arr = ns.ones( [ 2, 2 ] );
2330+
* // returns <ndarray>[ [ 1.0, 1.0 ], [ 1.0, 1.0 ] ]
2331+
*
2332+
* var sh = getShape( arr );
2333+
* // returns [ 2, 2 ]
2334+
*
2335+
* var dt = String( getDType( arr ) );
2336+
* // returns 'float64'
2337+
*/
2338+
ones: typeof ones;
2339+
23072340
/**
23082341
* Returns the layout order of a provided ndarray.
23092342
*

0 commit comments

Comments
 (0)