Skip to content

Commit 2041e12

Browse files
committed
docs: ensure support for dtype instances and update examples
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: skipped - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 88a7c4d commit 2041e12

3 files changed

Lines changed: 10 additions & 18 deletions

File tree

lib/node_modules/@stdlib/ndarray/base/unary-strided1d-dispatch-factory/README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ Applies a strided function to a provided input ndarray.
8787
<!-- eslint-disable id-length -->
8888

8989
```javascript
90-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
9190
var ndarray = require( '@stdlib/ndarray/base/ctor' );
9291
var base = require( '@stdlib/stats/base/ndarray/cumax' );
9392

@@ -107,10 +106,7 @@ var xbuf = [ -1.0, 2.0, -3.0 ];
107106
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
108107

109108
var y = unary( x );
110-
// returns <ndarray>
111-
112-
var arr = ndarray2array( y );
113-
// returns [ -1.0, 2.0, 2.0 ]
109+
// returns <ndarray>[ -1.0, 2.0, 2.0 ]
114110
```
115111

116112
The function has the following parameters:
@@ -153,7 +149,7 @@ var y = unary( x, {
153149
});
154150
// returns <ndarray>
155151

156-
var dt = getDType( y );
152+
var dt = String( getDType( y ) );
157153
// returns 'float64'
158154
```
159155

@@ -166,7 +162,6 @@ Applies a strided function to a provided input ndarray and assigns results to a
166162
```javascript
167163
var base = require( '@stdlib/stats/base/ndarray/cumax' );
168164
var dtypes = require( '@stdlib/ndarray/dtypes' );
169-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
170165
var ndarray = require( '@stdlib/ndarray/base/ctor' );
171166

172167
var idt = dtypes( 'real_and_generic' );
@@ -188,10 +183,7 @@ var ybuf = [ 0.0, 0.0, 0.0 ];
188183
var y = new ndarray( 'generic', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
189184

190185
var out = unary.assign( x, y );
191-
// returns <ndarray>
192-
193-
var arr = ndarray2array( out );
194-
// returns [ -1.0, 2.0, 2.0 ]
186+
// returns <ndarray>[ -1.0, 2.0, 2.0 ]
195187

196188
var bool = ( out === y );
197189
// returns true

lib/node_modules/@stdlib/ndarray/base/unary-strided1d-dispatch-factory/docs/repl.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
- arrays: array containing an input and an output ndarray, followed by
2929
any additional ndarray arguments.
3030

31-
idtypes: Array<Array<string>>
31+
idtypes: Array<Array<string|DataType>>
3232
List containing lists of supported input array data types for each input
3333
ndarray argument.
3434

35-
odtypes: Array<string>
35+
odtypes: Array<string|DataType>
3636
List of supported output array data types.
3737

3838
policies: Object
@@ -75,7 +75,7 @@ fcn( x[, ...args][, options] )
7575
options: Object (optional)
7676
Function options.
7777

78-
options.dtype: string (optional)
78+
options.dtype: string|DataType (optional)
7979
Output array data type. Setting this option overrides the output data
8080
type policy.
8181

lib/node_modules/@stdlib/ndarray/base/unary-strided1d-dispatch-factory/lib/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ var UnaryStrided1dDispatch = require( '@stdlib/ndarray/base/unary-strided1d-disp
3131
*
3232
* @param {Object} table - dispatch table
3333
* @param {Function} table.default - default strided function
34-
* @param {StringArray} [table.types] - one-dimensional list of ndarray data types describing specialized input and output ndarray argument signatures
34+
* @param {ArrayLikeObject} [table.types] - one-dimensional list of ndarray data types describing specialized input and output ndarray argument signatures
3535
* @param {ArrayLikeObject<Function>} [table.fcns] - list of strided functions which are specific to specialized input and output ndarray argument signatures
36-
* @param {ArrayLikeObject<StringArray>} idtypes - list containing lists of supported input data types for each ndarray argument
37-
* @param {StringArray} odtypes - list of supported output data types
36+
* @param {ArrayLikeObject<ArrayLikeObject>} idtypes - list containing lists of supported input data types for each ndarray argument
37+
* @param {ArrayLikeObject} odtypes - list of supported output data types
3838
* @param {Object} policies - policies
3939
* @param {string} policies.output - output data type policy
4040
* @param {string} policies.casting - input ndarray casting policy
@@ -127,7 +127,7 @@ function factory( table, idtypes, odtypes, policies, options ) {
127127
* @param {...ndarrayLike} [args] - additional ndarray arguments
128128
* @param {Options} [options] - function options
129129
* @param {IntegerArray} [options.dims] - list of dimensions over which to perform operation
130-
* @param {string} [options.dtype] - output ndarray data type
130+
* @param {*} [options.dtype] - output ndarray data type
131131
* @throws {TypeError} first argument must be an ndarray
132132
* @throws {TypeError} options argument must be an object
133133
* @throws {RangeError} dimension indices must not exceed input ndarray bounds

0 commit comments

Comments
 (0)