Skip to content

Commit 697b9ed

Browse files
committed
docs: update examples and docs to accommodate data type instances
--- 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: passed - 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: passed - task: lint_license_headers status: passed ---
1 parent 452cc00 commit 697b9ed

File tree

6 files changed

+21
-54
lines changed

6 files changed

+21
-54
lines changed

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,7 @@ var ybuf = [ 2.0, 6.0, -1.0, -4.0, 8.0 ];
103103
var y = new ndarray( 'generic', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
104104

105105
var z = binary( x, y );
106-
// returns <ndarray>
107-
108-
var v = z.get();
109-
// returns -5.0
106+
// returns <ndarray>[ -5.0 ]
110107
```
111108

112109
The function has the following parameters:
@@ -154,7 +151,7 @@ var z = binary( x, y, {
154151
});
155152
// returns <ndarray>
156153

157-
var dt = getDType( z );
154+
var dt = String( getDType( z ) );
158155
// returns 'float64'
159156
```
160157

@@ -191,10 +188,7 @@ var zbuf = [ 0.0 ];
191188
var z = new ndarray( 'generic', zbuf, [], [ 0 ], 0, 'row-major' );
192189

193190
var out = binary.assign( x, y, z );
194-
// returns <ndarray>
195-
196-
var v = out.get();
197-
// returns -5.0
191+
// returns <ndarray>[ -5.0 ]
198192

199193
var bool = ( out === z );
200194
// returns true
@@ -300,7 +294,7 @@ var z = dot( x, y, {
300294
301295
// Resolve the output array data type:
302296
var dt = dtype( z );
303-
console.log( dt );
297+
console.log( String( dt ) );
304298
305299
// Print the results:
306300
console.log( ndarray2array( z ) );

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
- arrays: array containing two input ndarrays, followed by any
2929
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
@@ -104,9 +104,8 @@ fcn( x, y[, ...args][, options] )
104104
> var ord = 'row-major';
105105
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, sx, oo, ord );
106106
> var y = new {{alias:@stdlib/ndarray/ctor}}( dt, ybuf, sh, sx, oo, ord );
107-
> var z = f( x, y );
108-
> var v = z.get()
109-
30.0
107+
> var z = f( x, y )
108+
<ndarray>[ 30.0 ]
110109

111110

112111
fcn.assign( x, y[, ...args], out[, options] )
@@ -157,11 +156,9 @@ fcn.assign( x, y[, ...args], out[, options] )
157156
> var y = new {{alias:@stdlib/ndarray/ctor}}( dt, ybuf, sh, sx, oo, ord );
158157
> var out = {{alias:@stdlib/ndarray/zeros}}( [], { 'dtype': dt } );
159158
> var z = f.assign( x, y, out )
160-
<ndarray>
159+
<ndarray>[ 30.0 ]
161160
> var bool = ( out === z )
162161
true
163-
> var v = out.get()
164-
30.0
165162

166163
See Also
167164
--------

lib/node_modules/@stdlib/ndarray/base/binary-reduce-strided1d-dispatch-factory/docs/types/index.d.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,7 @@ interface BinaryFunction<T, U> {
152152
* var y = new ndarray( 'generic', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
153153
*
154154
* var z = dot( x, y );
155-
* // returns <ndarray>
156-
*
157-
* var v = z.get();
158-
* // returns -5.0
155+
* // returns <ndarray>[ -5.0 ]
159156
*/
160157
( x: InputArray<T>, y: InputArray<T>, ...args: Array<InputArray<T> | Options> ): OutputArray<U>; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how the input ndarrays interact with output data type policy and whether that policy has been overridden by `options.dtype`. In principle, as well, based on the policy, it is possible to know more exactly which `InputArray` types are actually allowed.
161158

@@ -195,10 +192,7 @@ interface BinaryFunction<T, U> {
195192
* var z = new ndarray( 'generic', zbuf, [], [ 0 ], 0, 'row-major' );
196193
*
197194
* var out = dot.assign( x, y, z );
198-
* // returns <ndarray>
199-
*
200-
* var v = out.get();
201-
* // returns -5.0
195+
* // returns <ndarray>[ -5.0 ]
202196
*
203197
* var bool = ( out === z );
204198
* // returns true
@@ -241,10 +235,7 @@ interface BinaryFunction<T, U> {
241235
* var z = new ndarray( 'generic', zbuf, [], [ 0 ], 0, 'row-major' );
242236
*
243237
* var out = dot.assign( x, y, z );
244-
* // returns <ndarray>
245-
*
246-
* var v = out.get();
247-
* // returns -5.0
238+
* // returns <ndarray>[ -5.0 ]
248239
*
249240
* var bool = ( out === z );
250241
* // returns true
@@ -285,10 +276,7 @@ interface BinaryFunction<T, U> {
285276
* var y = new ndarray( 'generic', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
286277
*
287278
* var z = dot( x, y );
288-
* // returns <ndarray>
289-
*
290-
* var v = z.get();
291-
* // returns -5.0
279+
* // returns <ndarray>[ -5.0 ]
292280
*/
293281
declare function factory<T = unknown, U = unknown>( table: DispatchTable<T, U> | BaseDispatchTable<T, U>, idtypes: ArrayLike<ArrayLike<DataType>>, odtypes: ArrayLike<DataType>, policies: Policies ): BinaryFunction<T, U>;
294282

lib/node_modules/@stdlib/ndarray/base/binary-reduce-strided1d-dispatch-factory/examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var z = dot( x, y, {
7575

7676
// Resolve the output array data type:
7777
var dt = dtype( z );
78-
console.log( dt );
78+
console.log( String( dt ) );
7979

8080
// Print the results:
8181
console.log( ndarray2array( z ) );

lib/node_modules/@stdlib/ndarray/base/binary-reduce-strided1d-dispatch-factory/lib/index.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@
4848
* var y = new ndarray( 'generic', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
4949
*
5050
* var z = dot( x, y );
51-
* // returns <ndarray>
52-
*
53-
* var v = z.get();
54-
* // returns -5.0
51+
* // returns <ndarray>[ -5.0 ]
5552
*
5653
* @example
5754
* var base = require( '@stdlib/blas/base/ndarray/gdot' );
@@ -81,10 +78,7 @@
8178
* var z = new ndarray( 'generic', zbuf, [], [ 0 ], 0, 'row-major' );
8279
*
8380
* var out = dot.assign( x, y, z );
84-
* // returns <ndarray>
85-
*
86-
* var v = out.get();
87-
* // returns -5.0
81+
* // returns <ndarray>[ -5.0 ]
8882
*
8983
* var bool = ( out === z );
9084
* // returns true

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ var BinaryStrided1dDispatch = require( '@stdlib/ndarray/base/binary-reduce-strid
3131
*
3232
* @param {Object} table - dispatch table
3333
* @param {Function} table.default - default strided reduction function
34-
* @param {StringArray} [table.types] - one-dimensional list of ndarray data types describing specialized input ndarray argument signatures
34+
* @param {ArrayLikeObject} [table.types] - one-dimensional list of ndarray data types describing specialized input ndarray argument signatures
3535
* @param {ArrayLikeObject<Function>} [table.fcns] - list of strided reduction functions which are specific to specialized input 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
@@ -69,10 +69,7 @@ var BinaryStrided1dDispatch = require( '@stdlib/ndarray/base/binary-reduce-strid
6969
* var y = new ndarray( 'generic', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
7070
*
7171
* var z = dot( x, y );
72-
* // returns <ndarray>
73-
*
74-
* var v = z.get();
75-
* // returns -5.0
72+
* // returns <ndarray>[ -5.0 ]
7673
*
7774
* @example
7875
* var base = require( '@stdlib/blas/base/ndarray/gdot' );
@@ -101,10 +98,7 @@ var BinaryStrided1dDispatch = require( '@stdlib/ndarray/base/binary-reduce-strid
10198
* var z = new ndarray( 'generic', zbuf, [], [ 0 ], 0, 'row-major' );
10299
*
103100
* var out = dot.assign( x, y, z );
104-
* // returns <ndarray>
105-
*
106-
* var v = out.get();
107-
* // returns -5.0
101+
* // returns <ndarray>[ -5.0 ]
108102
*
109103
* var bool = ( out === z );
110104
* // returns true

0 commit comments

Comments
 (0)