Skip to content

Commit b04cfeb

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 5c6a11d commit b04cfeb

File tree

9 files changed

+85
-88
lines changed

9 files changed

+85
-88
lines changed

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

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

2121
# nullaryStrided1dDispatchFactory
2222

23-
> Create a function for applying a strided function to an output ndarray.
23+
> Create a function for applying a strided function to an ndarray.
2424
2525
<section class="usage">
2626

@@ -34,7 +34,7 @@ var nullaryStrided1dDispatchFactory = require( '@stdlib/ndarray/base/nullary-str
3434

3535
#### nullaryStrided1dDispatchFactory( table, idtypes, odtypes\[, options] )
3636

37-
Returns a function for applying a strided function to an output ndarray.
37+
Returns a function for applying a strided function to an ndarray.
3838

3939
<!-- eslint-disable id-length -->
4040

@@ -69,9 +69,9 @@ The function has the following parameters:
6969

7070
The function supports the following options:
7171

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

74-
#### unary.assign( x\[, ...args]\[, options] )
74+
#### nullary( out\[, ...args]\[, options] )
7575

7676
Applies a strided function and assigns results to a provided output ndarray.
7777

@@ -95,11 +95,11 @@ var nullary = nullaryStrided1dDispatchFactory( table, [ idt ], odt );
9595
var xbuf = [ -1.0, 2.0, -3.0 ];
9696
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
9797

98-
var o = scalar2ndarray( 1.0, {
98+
var order = scalar2ndarray( 1.0, {
9999
'dtype': 'generic'
100100
});
101101

102-
var out = nullary.assign( x, o );
102+
var out = nullary( x, order );
103103
// returns <ndarray>
104104

105105
var arr = ndarray2array( out );
@@ -111,8 +111,8 @@ var bool = ( out === x );
111111

112112
The method has the following parameters:
113113

114-
- **x**: output ndarray.
115-
- **args**: additional output ndarray arguments (_optional_).
114+
- **out**: output ndarray.
115+
- **args**: additional input ndarray arguments (_optional_).
116116
- **options**: function options (_optional_).
117117

118118
The method accepts the following options:
@@ -137,8 +137,6 @@ The method accepts the following options:
137137
138138
- **arrays**: array containing an output ndarray, followed by any additional ndarray arguments.
139139
140-
- The output data type policy only applies to the function returned by the main function. For the `assign` method, the output ndarray is allowed to have any supported output data type.
141-
142140
</section>
143141
144142
<!-- /.notes -->
@@ -147,7 +145,7 @@ The method accepts the following options:
147145
148146
## Examples
149147
150-
<!-- eslint-disable id-length, max-len, array-element-newline -->
148+
<!-- eslint-disable id-length, max-len -->
151149
152150
<!-- eslint no-undef: "error" -->
153151
@@ -169,8 +167,8 @@ var odt = dtypes( 'all' );
169167
// Define a dispatch table:
170168
var table = {
171169
'types': [
172-
'float64',
173-
'float32'
170+
'float64', // input/output
171+
'float32' // input/output
174172
],
175173
'fcns': [
176174
dsorthp,
@@ -191,12 +189,12 @@ var xbuf = discreteUniform( 25, -10, 10, {
191189
var x = new ndarray( 'generic', xbuf, [ 5, 5 ], [ 5, 1 ], 0, 'row-major' );
192190
console.log( ndarray2array( x ) );
193191
194-
var o = scalar2ndarray( 1.0, {
192+
var order = scalar2ndarray( 1.0, {
195193
'dtype': 'generic'
196194
});
197195
198196
// Perform operation:
199-
sorthp.assign( x, o );
197+
sorthp( x, order );
200198
201199
// Print the results:
202200
console.log( ndarray2array( x ) );

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function createBenchmark( len ) {
7575

7676
b.tic();
7777
for ( i = 0; i < b.iterations; i++ ) {
78-
out = nullary.assign( x, o );
78+
out = nullary( x, o );
7979
if ( typeof out !== 'object' ) {
8080
b.fail( 'should return an ndarray' );
8181
}
@@ -110,7 +110,7 @@ function main() {
110110
for ( i = min; i <= max; i++ ) {
111111
len = pow( 10, i );
112112
f = createBenchmark( len );
113-
bench( pkg+':assign:len='+len, f );
113+
bench( pkg+'::assign:len='+len, f );
114114
}
115115
}
116116

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
{{alias}}( table, idtypes, odtypes[, options] )
3-
Returns function for applying a strided function to an output ndarray.
3+
Returns function for applying a strided function to an ndarray.
44

55
Parameters
66
----------
@@ -54,13 +54,13 @@
5454
> var t = { 'default': {{alias:@stdlib/blas/ext/base/ndarray/gsorthp}} };
5555
> var f = {{alias}}( t, [ idt ], odt );
5656

57-
fcn.assign( x[, ...args][, options] )
57+
fcn( out[, ...args][, options] )
5858
Applies a strided function and assign results to a provided output ndarray.
5959

6060
Parameters
6161
----------
62-
x: ndarray
63-
Input array.
62+
out: ndarray
63+
Output array.
6464

6565
args: ...ndarray (optional)
6666
Additional ndarray arguments.
@@ -92,7 +92,7 @@ fcn.assign( x[, ...args][, options] )
9292
> var ord = 'row-major';
9393
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, buf, sh, sx, ox, ord );
9494
> var o = {{alias:@stdlib/ndarray/from-scalar}}( 1.0 );
95-
> var out = f.assign( x, o )
95+
> var out = f( x, o )
9696
<ndarray>
9797
> var bool = ( out === x )
9898
true

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ interface BaseOptions {
4848
*/
4949
interface FactoryOptions {
5050
/**
51-
* Boolean specifying whether the order of element traversal must match the memory layout of an input ndarray.
51+
* Boolean specifying whether the order of element traversal must match the memory layout of an output ndarray.
5252
*/
5353
strictTraversalOrder?: boolean;
5454
}
5555

5656
/**
5757
* Strided function.
5858
*
59-
* @param arrays - output ndarrays
59+
* @param arrays - input ndarrays
6060
* @param options - function options
6161
* @returns result
6262
*/
@@ -65,7 +65,7 @@ type Nullary<T> = ( arrays: [ typedndarray<T> ], options?: unknown ) => typednda
6565
/**
6666
* Strided function.
6767
*
68-
* @param arrays - output ndarrays
68+
* @param arrays - input ndarrays
6969
* @param options - function options
7070
* @returns result
7171
*/
@@ -104,7 +104,7 @@ interface NullaryFunction<T> {
104104
/**
105105
* Applies a strided function and assign results to a provided output ndarray.
106106
*
107-
* @param x - output ndarray
107+
* @param out - output ndarray
108108
* @param options - function options
109109
* @returns output ndarray
110110
*
@@ -126,11 +126,11 @@ interface NullaryFunction<T> {
126126
* var xbuf = [ -1.0, 2.0, -3.0 ];
127127
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
128128
*
129-
* var o = scalar2ndarray( 1.0, {
129+
* var order = scalar2ndarray( 1.0, {
130130
* 'dtype': 'generic'
131131
* });
132132
*
133-
* var out = sorthp.assign( x, o );
133+
* var out = sorthp( x, order );
134134
* // returns <ndarray>
135135
*
136136
* var arr = ndarray2array( out );
@@ -139,13 +139,13 @@ interface NullaryFunction<T> {
139139
* var bool = ( out === x );
140140
* // returns true
141141
*/
142-
assign<V extends OutputArray<T> = OutputArray<T>>( x: V, options?: BaseOptions ): V;
142+
<V extends OutputArray<T> = OutputArray<T>>( out: V, options?: BaseOptions ): V;
143143

144144
/**
145145
* Applies a strided function and assigns results to a provided output ndarray.
146146
*
147-
* @param x - input ndarray
148-
* @param o - additional ndarray argument
147+
* @param out - output ndarray
148+
* @param x - additional ndarray argument
149149
* @param args - output ndarray, additional array arguments, and function options
150150
* @returns output ndarray
151151
*
@@ -167,11 +167,11 @@ interface NullaryFunction<T> {
167167
* var xbuf = [ -1.0, 2.0, -3.0 ];
168168
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
169169
*
170-
* var o = scalar2ndarray( 1.0, {
170+
* var order = scalar2ndarray( 1.0, {
171171
* 'dtype': 'generic'
172172
* });
173173
*
174-
* var out = sorthp.assign( x, o );
174+
* var out = sorthp( x, order );
175175
* // returns <ndarray>
176176
*
177177
* var arr = ndarray2array( out );
@@ -180,7 +180,7 @@ interface NullaryFunction<T> {
180180
* var bool = ( out === x );
181181
* // returns true
182182
*/
183-
assign<V extends OutputArray<T> = OutputArray<T>>( x: T, ...args: Array<V | BaseOptions> ): V;
183+
<V extends OutputArray<T> = OutputArray<T>>( out: V, x: InputArray<T>, ...args: Array<V | BaseOptions> ): V;
184184
}
185185

186186
/**
@@ -210,11 +210,11 @@ interface NullaryFunction<T> {
210210
* var xbuf = [ -1.0, 2.0, -3.0 ];
211211
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
212212
*
213-
* var o = scalar2ndarray( 1.0, {
213+
* var order = scalar2ndarray( 1.0, {
214214
* 'dtype': 'generic'
215215
* });
216216
*
217-
* var out = sorthp.assign( x, o );
217+
* var out = sorthp( x, order );
218218
* // returns <ndarray>
219219
*
220220
* var arr = ndarray2array( out );

lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch-factory/docs/types/test.ts

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ import factory = require( './index' );
150150
factory<number>( table, [ dtypes ], dtypes, {}, {} ); // $ExpectError
151151
}
152152

153-
// The function returns a function having an `assign` method which returns an ndarray...
153+
// The function returns a function which returns an ndarray...
154154
{
155155
const dtypes: Array<DataType> = [ 'float64', 'float32' ];
156156
const table = {
@@ -164,40 +164,38 @@ import factory = require( './index' );
164164
});
165165

166166
const f = factory<number>( table, [ dtypes ], dtypes );
167-
f.assign( x, o ); // $ExpectType float64ndarray
167+
f( x ); // $ExpectType float64ndarray
168+
f( x, o ); // $ExpectType float64ndarray
168169
}
169170

170-
// The compiler throws an error if the `assign` method is provided a first argument which is not an ndarray...
171+
// The compiler throws an error if the returned function is provided a first argument which is not an ndarray...
171172
{
172173
const dtypes: Array<DataType> = [ 'float64', 'float32' ];
173174
const table = {
174175
'default': gsorthp
175176
};
176-
const x = zeros( [ 2, 2 ], {
177-
'dtype': 'float64'
178-
});
179177

180178
const f = factory<number>( table, [ dtypes ], dtypes );
181-
f.assign( '5', x ); // $ExpectError
182-
f.assign( 5, x ); // $ExpectError
183-
f.assign( true, x ); // $ExpectError
184-
f.assign( false, x ); // $ExpectError
185-
f.assign( null, x ); // $ExpectError
186-
f.assign( void 0, x ); // $ExpectError
187-
f.assign( {}, x ); // $ExpectError
188-
f.assign( ( x: number ): number => x, x ); // $ExpectError
189-
190-
f.assign( '5', x, {} ); // $ExpectError
191-
f.assign( 5, x, {} ); // $ExpectError
192-
f.assign( true, x, {} ); // $ExpectError
193-
f.assign( false, x, {} ); // $ExpectError
194-
f.assign( null, x, {} ); // $ExpectError
195-
f.assign( void 0, x, {} ); // $ExpectError
196-
f.assign( {}, x, {} ); // $ExpectError
197-
f.assign( ( x: number ): number => x, x, {} ); // $ExpectError
179+
f( '5' ); // $ExpectError
180+
f( 5 ); // $ExpectError
181+
f( true ); // $ExpectError
182+
f( false ); // $ExpectError
183+
f( null ); // $ExpectError
184+
f( void 0 ); // $ExpectError
185+
f( {} ); // $ExpectError
186+
f( ( x: number ): number => x ); // $ExpectError
187+
188+
f( '5', {} ); // $ExpectError
189+
f( 5, {} ); // $ExpectError
190+
f( true, {} ); // $ExpectError
191+
f( false, {} ); // $ExpectError
192+
f( null, {} ); // $ExpectError
193+
f( void 0, {} ); // $ExpectError
194+
f( {}, {} ); // $ExpectError
195+
f( ( x: number ): number => x, {} ); // $ExpectError
198196
}
199197

200-
// The compiler throws an error if the `assign` method is provided an invalid `dims` option...
198+
// The compiler throws an error if the returned function is provided an invalid `dims` option...
201199
{
202200
const dtypes: Array<DataType> = [ 'float64', 'float32' ];
203201
const table = {
@@ -211,22 +209,30 @@ import factory = require( './index' );
211209
});
212210

213211
const f = factory<number>( table, [ dtypes ], dtypes );
214-
f.assign( x, o, { 'dims': '5' } ); // $ExpectError
215-
f.assign( x, o, { 'dims': 5 } ); // $ExpectError
216-
f.assign( x, o, { 'dims': true } ); // $ExpectError
217-
f.assign( x, o, { 'dims': false } ); // $ExpectError
218-
f.assign( x, o, { 'dims': null } ); // $ExpectError
219-
f.assign( x, o, { 'dims': {} } ); // $ExpectError
220-
f.assign( x, o, { 'dims': ( x: number ): number => x } ); // $ExpectError
212+
f( x, { 'dims': '5' } ); // $ExpectError
213+
f( x, { 'dims': 5 } ); // $ExpectError
214+
f( x, { 'dims': true } ); // $ExpectError
215+
f( x, { 'dims': false } ); // $ExpectError
216+
f( x, { 'dims': null } ); // $ExpectError
217+
f( x, { 'dims': {} } ); // $ExpectError
218+
f( x, { 'dims': ( x: number ): number => x } ); // $ExpectError
219+
220+
f( x, o, { 'dims': '5' } ); // $ExpectError
221+
f( x, o, { 'dims': 5 } ); // $ExpectError
222+
f( x, o, { 'dims': true } ); // $ExpectError
223+
f( x, o, { 'dims': false } ); // $ExpectError
224+
f( x, o, { 'dims': null } ); // $ExpectError
225+
f( x, o, { 'dims': {} } ); // $ExpectError
226+
f( x, o, { 'dims': ( x: number ): number => x } ); // $ExpectError
221227
}
222228

223-
// The compiler throws an error if the `assign` method is provided an unsupported number of arguments...
229+
// The compiler throws an error if the returned function is provided an unsupported number of arguments...
224230
{
225231
const dtypes: Array<DataType> = [ 'float64', 'float32' ];
226232
const table = {
227233
'default': gsorthp
228234
};
229235

230236
const f = factory<number>( table, [ dtypes ], dtypes );
231-
f.assign(); // $ExpectError
237+
f(); // $ExpectError
232238
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ var odt = dtypes( 'all' );
3535
// Define a dispatch table:
3636
var table = {
3737
'types': [
38-
'float64',
39-
'float32'
38+
'float64', // input/output
39+
'float32' // input/output
4040
],
4141
'fcns': [
4242
dsorthp,
@@ -57,12 +57,12 @@ var xbuf = discreteUniform( 25, -10, 10, {
5757
var x = new ndarray( 'generic', xbuf, [ 5, 5 ], [ 5, 1 ], 0, 'row-major' );
5858
console.log( ndarray2array( x ) );
5959

60-
var o = scalar2ndarray( 1.0, {
60+
var order = scalar2ndarray( 1.0, {
6161
'dtype': 'generic'
6262
});
6363

6464
// Perform operation:
65-
sorthp.assign( x, o );
65+
sorthp( x, order );
6666

6767
// Print the results:
6868
console.log( ndarray2array( x ) );

0 commit comments

Comments
 (0)