Skip to content

Commit efe1fd2

Browse files
committed
chore: clean-up
--- 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: passed - 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: passed - 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 187e029 commit efe1fd2

File tree

11 files changed

+291
-390
lines changed

11 files changed

+291
-390
lines changed

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

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ limitations under the License.
2020

2121
# NullaryStrided1dDispatch
2222

23-
> Constructor for applying a strided function to an output ndarray.
23+
> Constructor for applying a strided function to an ndarray.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
2430

2531
<section class="usage">
2632

@@ -30,9 +36,9 @@ limitations under the License.
3036
var NullaryStrided1dDispatch = require( '@stdlib/ndarray/base/nullary-strided1d-dispatch' );
3137
```
3238

33-
#### NullaryStrided1dDispatch( table, odtypes, policies\[, options] )
39+
#### NullaryStrided1dDispatch( table, idtypes, odtypes\[, options] )
3440

35-
Returns an interface for applying a strided function to an output ndarray.
41+
Returns an interface for applying a strided function to an ndarray.
3642

3743
```javascript
3844
var base = require( '@stdlib/blas/ext/base/ndarray/gsorthp' );
@@ -42,11 +48,8 @@ var table = {
4248
};
4349

4450
var dtypes = [ 'float64', 'float32', 'generic' ];
45-
var policies = {
46-
'output': 'same'
47-
};
4851

49-
var nullary = new NullaryStrided1dDispatch( table, [ dtypes ], policies );
52+
var nullary = new NullaryStrided1dDispatch( table, [ dtypes ], dtypes );
5053
```
5154

5255
The constructor has the following parameters:
@@ -60,19 +63,17 @@ The constructor has the following parameters:
6063
- **types**: one-dimensional list of ndarray data types describing specialized output ndarray argument signatures. Only the output ndarray argument data types should be specified. Additional ndarray argument data types should be omitted and are not considered during dispatch. The length of `types` must equal the number of strided functions specified by `fcns`.
6164
- **fcns**: list of strided functions which are specific to specialized output ndarray argument signatures.
6265

63-
- **odtypes**: list of supported output data types.
64-
65-
- **policies**: dispatch policies. Must have the following properties:
66+
- **idtypes**: list containing lists of supported input data types for each input ndarray argument.
6667

67-
- **output**: output data type [policy][@stdlib/ndarray/output-dtype-policies].
68+
- **odtypes**: list of supported output data types.
6869

6970
- **options**: function options (_optional_).
7071

7172
The constructor supports the following options:
7273

73-
- **strictTraversalOrder**: boolean specifying whether the order of element traversal must match the memory layout order of an input ndarray. Default: `false`.
74+
- **strictTraversalOrder**: boolean specifying whether the order of element traversal must match the memory layout order of an output ndarray. Default: `false`.
7475

75-
#### NullaryStrided1dDispatch.prototype.assign( x\[, ...args]\[, options] )
76+
#### NullaryStrided1dDispatch.prototype.assign( out\[, ...args]\[, options] )
7677

7778
Applies a strided function and assigns results to a provided output ndarray.
7879

@@ -84,24 +85,22 @@ var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
8485
var ndarray = require( '@stdlib/ndarray/base/ctor' );
8586
var NullaryStrided1dDispatch = require( '@stdlib/ndarray/base/nullary-strided1d-dispatch' );
8687

88+
var idt = dtypes( 'real_and_generic' );
8789
var odt = dtypes( 'all' );
88-
var policies = {
89-
'output': 'same'
90-
};
9190

9291
var table = {
9392
'default': base
9493
};
95-
var nullary = new NullaryStrided1dDispatch( table, [ odt ], policies );
94+
var nullary = new NullaryStrided1dDispatch( table, [ idt ], odt );
9695

9796
var xbuf = [ -1.0, 2.0, -3.0 ];
9897
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
9998

100-
var o = scalar2ndarray( 1.0, {
99+
var order = scalar2ndarray( 1.0, {
101100
'dtype': 'generic'
102101
});
103102

104-
var out = nullary.assign( x, o, {
103+
var out = nullary.assign( x, order, {
105104
'dims': [ 0 ]
106105
});
107106
// returns <ndarray>
@@ -115,7 +114,7 @@ var bool = ( out === x );
115114

116115
The method has the following parameters:
117116

118-
- **x**: output ndarray.
117+
- **out**: output ndarray.
119118
- **args**: additional input ndarray arguments (_optional_).
120119
- **options**: function options (_optional_).
121120

@@ -139,7 +138,7 @@ The method accepts the following options:
139138
140139
where
141140
142-
- **arrays**: array containing an an output ndarray, followed by any additional ndarray arguments.
141+
- **arrays**: array containing an output ndarray, followed by any additional ndarray arguments.
143142
144143
</section>
145144
@@ -164,19 +163,15 @@ var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
164163
var ndarray = require( '@stdlib/ndarray/ctor' );
165164
var NullaryStrided1dDispatch = require( '@stdlib/ndarray/base/nullary-strided1d-dispatch' );
166165
167-
// Define the supported output data types:
166+
// Define the supported input and output data types:
167+
var idt = dtypes( 'real_and_generic' );
168168
var odt = dtypes( 'all' );
169169
170-
// Define dispatch policies:
171-
var policies = {
172-
'output': 'same'
173-
};
174-
175170
// Define a dispatch table:
176171
var table = {
177172
'types': [
178-
'float64',
179-
'float32'
173+
'float64', // input/output
174+
'float32' // input/output
180175
],
181176
'fcns': [
182177
dsorthp,
@@ -186,7 +181,7 @@ var table = {
186181
};
187182
188183
// Create an interface for performing operation:
189-
var sorthp = new NullaryStrided1dDispatch( table, [ odt ], policies );
184+
var sorthp = new NullaryStrided1dDispatch( table, [ idt ], odt );
190185
191186
// Generate an array of random numbers:
192187
var xbuf = discreteUniform( 25, -10, 10, {
@@ -197,12 +192,13 @@ var xbuf = discreteUniform( 25, -10, 10, {
197192
var x = new ndarray( 'float64', xbuf, [ 5, 5 ], [ 5, 1 ], 0, 'row-major' );
198193
console.log( ndarray2array( x ) );
199194
200-
var o = scalar2ndarray( 1.0, {
195+
// Specify the sort order:
196+
var order = scalar2ndarray( 1.0, {
201197
'dtype': 'generic'
202198
});
203199
204200
// Perform operation:
205-
sorthp.assign( x, o, {
201+
sorthp.assign( x, order, {
206202
'dims': [ 0, 1 ]
207203
});
208204
@@ -226,8 +222,6 @@ console.log( ndarray2array( x ) );
226222

227223
<section class="links">
228224

229-
[@stdlib/ndarray/output-dtype-policies]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/output-dtype-policies
230-
231225
</section>
232226

233227
<!-- /.links -->

lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch/benchmark/benchmark.assign.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,19 @@ var NullaryStrided1dDispatch = require( './../lib' );
4242
* @returns {Function} benchmark function
4343
*/
4444
function createBenchmark( len ) {
45-
var policies;
4645
var nullary;
4746
var table;
48-
var dt;
47+
var idt;
48+
var odt;
4949
var x;
5050
var o;
5151

5252
table = {
5353
'default': gsorthp
5454
};
55-
dt = dtypes( 'all' );
56-
policies = {
57-
'output': 'same'
58-
};
59-
nullary = new NullaryStrided1dDispatch( table, [ dt ], policies );
55+
idt = dtypes( 'real_and_generic' );
56+
odt = dtypes( 'all' );
57+
nullary = new NullaryStrided1dDispatch( table, [ idt ], odt );
6058

6159
x = uniform( len, -50.0, 50.0, {
6260
'dtype': 'float64'

lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch/benchmark/benchmark.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var NullaryStrided1dDispatch = require( './../lib' );
2929
// MAIN //
3030

3131
bench( pkg+'::new', function benchmark( b ) {
32-
var policies;
3332
var dtypes;
3433
var table;
3534
var v;
@@ -43,13 +42,10 @@ bench( pkg+'::new', function benchmark( b ) {
4342
'float32',
4443
'generic'
4544
];
46-
policies = {
47-
'output': 'same'
48-
};
4945

5046
b.tic();
5147
for ( i = 0; i < b.iterations; i++ ) {
52-
v = new NullaryStrided1dDispatch( table, [ dtypes ], policies );
48+
v = new NullaryStrided1dDispatch( table, [ dtypes ], dtypes );
5349
if ( typeof v !== 'object' ) {
5450
b.fail( 'should return an object' );
5551
}
@@ -63,7 +59,6 @@ bench( pkg+'::new', function benchmark( b ) {
6359
});
6460

6561
bench( pkg+'::no_new', function benchmark( b ) {
66-
var policies;
6762
var dtypes;
6863
var table;
6964
var fcn;
@@ -78,15 +73,12 @@ bench( pkg+'::no_new', function benchmark( b ) {
7873
'float32',
7974
'generic'
8075
];
81-
policies = {
82-
'output': 'same'
83-
};
8476

8577
fcn = NullaryStrided1dDispatch;
8678

8779
b.tic();
8880
for ( i = 0; i < b.iterations; i++ ) {
89-
v = fcn( table, [ dtypes ], policies );
81+
v = fcn( table, [ dtypes ], dtypes );
9082
if ( typeof v !== 'object' ) {
9183
b.fail( 'should return an object' );
9284
}

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

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
{{alias}}( table, odtypes, policies[, options] )
2+
{{alias}}( table, idtypes, odtypes[, options] )
33
Returns an ndarray function interface for applying a strided function to an
4-
output ndarray.
4+
ndarray.
55

66
Parameters
77
----------
@@ -29,21 +29,19 @@
2929
- arrays: array containing an output ndarray, followed by any additional
3030
ndarray arguments.
3131

32-
odtypes: Array<Array<string>>
33-
List containing lists of supported output array data types for each
34-
output ndarray argument.
32+
idtypes: Array<Array<string>>
33+
List containing lists of supported input array data types for each input
34+
ndarray argument.
3535

36-
policies: Object
37-
Dispatch policies. Must have the following properties:
38-
39-
- output: output data type policy.
36+
odtypes: Array<string>
37+
List of supported output array data types.
4038

4139
options: Object (optional)
4240
Function options.
4341

4442
options.strictTraversalOrder: boolean (optional)
4543
Boolean specifying whether the order of element traversal must match the
46-
memory layout order of an input ndarray.
44+
memory layout order of an output ndarray.
4745

4846
Returns
4947
-------
@@ -53,16 +51,16 @@
5351
Examples
5452
--------
5553
> var dts = [ 'float64', 'float32', 'generic' ];
56-
> var p = { 'output': 'same' };
5754
> var t = { 'default': {{alias:@stdlib/blas/ext/base/ndarray/gsorthp}} };
58-
> var out = new {{alias}}( t, [ dts ], p );
55+
> var out = new {{alias}}( t, [ dts ], dts );
56+
5957

60-
{{alias}}.prototype.assign( x[, ...args][, options] )
58+
{{alias}}.prototype.assign( out[, ...args][, options] )
6159
Applies a strided function and assigns results to a provided output ndarray.
6260

6361
Parameters
6462
----------
65-
x: ndarray
63+
out: ndarray
6664
Output array.
6765

6866
args: ...ndarray (optional)
@@ -73,7 +71,7 @@
7371

7472
options.dims: Array<integer> (optional)
7573
List of dimensions over which to perform operation. If not provided, the
76-
function performs the operation over all elements in a provided input
74+
function performs the operation over all elements in a provided output
7775
ndarray.
7876

7977
Returns
@@ -84,9 +82,8 @@
8482
Examples
8583
--------
8684
> var dts = [ 'float64', 'float32', 'generic' ];
87-
> var p = { 'output': 'same' };
88-
> var t = { 'default': {{alias:@stdlib/blas/ext/base/gsorthp}} };
89-
> var f = new {{alias}}( t, [ dts ], p );
85+
> var t = { 'default': {{alias:@stdlib/blas/ext/base/ndarray/gsorthp}} };
86+
> var f = new {{alias}}( t, [ dts ], dts );
9087
> var buf = [ -1.0, 2.0, -3.0, -4.0 ];
9188
> var dt = 'generic';
9289
> var sh = [ buf.length ];

0 commit comments

Comments
 (0)