Skip to content

Commit ff1c6e2

Browse files
committed
docs: update docs and examples to accommodate dtype instances
1 parent 8112cea commit ff1c6e2

File tree

6 files changed

+149
-521
lines changed

6 files changed

+149
-521
lines changed

lib/node_modules/@stdlib/ndarray/empty-like/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var getDType = require( '@stdlib/ndarray/dtype' );
5050
var zeros = require( '@stdlib/ndarray/zeros' );
5151

5252
var x = zeros( [ 2, 2 ] );
53-
// returns <ndarray>
53+
// returns <ndarray>[ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]
5454

5555
var y = emptyLike( x );
5656
// returns <ndarray>
@@ -67,8 +67,8 @@ The function supports the following `options`:
6767
- **dtype**: output [ndarray][@stdlib/ndarray/ctor] [data type][@stdlib/ndarray/dtypes]. Overrides the input ndarray's inferred [data type][@stdlib/ndarray/dtypes].
6868
- **shape**: output [ndarray][@stdlib/ndarray/ctor] shape. Overrides the input ndarray's inferred shape.
6969
- **order**: specifies whether the output [ndarray][@stdlib/ndarray/ctor] should be `'row-major'` (C-style) or `'column-major'` (Fortran-style). Overrides the input ndarray's inferred order.
70-
- **mode**: specifies how to handle indices which exceed array dimensions (see [`ndarray`][@stdlib/ndarray/ctor]). Default: `'throw'`.
71-
- **submode**: a mode array which specifies for each dimension how to handle subscripts which exceed array dimensions (see [`ndarray`][@stdlib/ndarray/ctor]). If provided fewer modes than dimensions, the constructor recycles modes using modulo arithmetic. Default: `[ options.mode ]`.
70+
- **mode**: specifies how to handle indices which exceed array dimensions (see [ndarray][@stdlib/ndarray/ctor]). Default: `'throw'`.
71+
- **submode**: a mode array which specifies for each dimension how to handle subscripts which exceed array dimensions (see [ndarray][@stdlib/ndarray/ctor]). If provided fewer modes than dimensions, the constructor recycles modes using modulo arithmetic. Default: `[ options.mode ]`.
7272

7373
To override either the `dtype`, `shape`, or `order`, specify the corresponding option. For example, to override the inferred [data type][@stdlib/ndarray/dtypes],
7474

@@ -78,7 +78,7 @@ var getDType = require( '@stdlib/ndarray/dtype' );
7878
var zeros = require( '@stdlib/ndarray/zeros' );
7979

8080
var x = zeros( [ 2, 2 ] );
81-
// returns <ndarray>
81+
// returns <ndarray>[ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]
8282

8383
var dt = String( getDType( x ) );
8484
// returns 'float64'
@@ -121,9 +121,9 @@ dt = String( getDType( y ) );
121121
<!-- eslint no-undef: "error" -->
122122

123123
```javascript
124-
var getData = require( '@stdlib/ndarray/data-buffer' );
125124
var dtypes = require( '@stdlib/ndarray/dtypes' );
126125
var empty = require( '@stdlib/ndarray/empty' );
126+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
127127
var emptyLike = require( '@stdlib/ndarray/empty-like' );
128128

129129
// Get a list of data types:
@@ -138,7 +138,7 @@ for ( i = 0; i < dt.length; i++ ) {
138138
'dtype': dt[ i ]
139139
});
140140
y = emptyLike( x );
141-
console.log( getData( y ) );
141+
console.log( ndarray2array( y ) );
142142
}
143143
```
144144

lib/node_modules/@stdlib/ndarray/empty-like/docs/repl.txt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
options.shape: ArrayLikeObject<integer>|integer (optional)
2929
Array shape. Overrides the input array's inferred shape.
3030

31-
options.dtype: string (optional)
31+
options.dtype: string|DataType (optional)
3232
Array data type. Overrides the input array's inferred data type.
3333

3434
options.order: string (optional)
@@ -65,18 +65,10 @@
6565

6666
Examples
6767
--------
68-
> var x = {{alias:@stdlib/ndarray/base/zeros}}( 'float64', [ 2, 2 ], 'row-major' )
69-
<ndarray>
70-
> var sh = {{alias:@stdlib/ndarray/shape}}( x )
71-
[ 2, 2 ]
72-
> var dt = {{alias:@stdlib/ndarray/dtype}}( x ).toString()
73-
'float64'
68+
> var x = {{alias:@stdlib/ndarray/zeros}}( [ 2, 2 ] )
69+
<ndarray>[ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]
7470
> var y = {{alias}}( x )
7571
<ndarray>
76-
> sh = {{alias:@stdlib/ndarray/shape}}( y )
77-
[ 2, 2 ]
78-
> dt = {{alias:@stdlib/ndarray/dtype}}( y ).toString()
79-
'float64'
8072

8173
See Also
8274
--------

0 commit comments

Comments
 (0)