Skip to content

Commit 6d4ff69

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: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - 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: na - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 82c9eb4 commit 6d4ff69

File tree

8 files changed

+163
-67
lines changed

8 files changed

+163
-67
lines changed

lib/node_modules/@stdlib/ndarray/any/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ var any = require( '@stdlib/ndarray/any' );
198198
var x = zeros( [ 2, 4, 5 ], {
199199
'dtype': 'float64'
200200
});
201-
x = fillBy( x, bernoulli( 0.50 ) );
201+
x = fillBy( x, bernoulli( 0.10 ) );
202202
console.log( ndarray2array( x ) );
203203

204204
var y = any( x );

lib/node_modules/@stdlib/ndarray/any/benchmark/benchmark.1d.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
var bench = require( '@stdlib/bench' );
2424
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
2525
var pow = require( '@stdlib/math/base/special/pow' );
26-
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
27-
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
28-
var ndarray = require( '@stdlib/ndarray/ctor' );
26+
var zeros = require( '@stdlib/ndarray/zeros' );
2927
var pkg = require( './../package.json' ).name;
3028
var any = require( './../lib' );
3129

@@ -50,11 +48,10 @@ var orders = [ 'row-major', 'column-major' ];
5048
* @returns {Function} benchmark function
5149
*/
5250
function createBenchmark( len, shape, xtype, order, dims ) {
53-
var x;
54-
55-
x = discreteUniform( len, -1, -100 );
56-
x = new ndarray( xtype, x, shape, shape2strides( shape, order ), 0, order );
57-
51+
var x = zeros( shape, {
52+
'dtype': xtype,
53+
'order': order
54+
});
5855
return benchmark;
5956

6057
/**

lib/node_modules/@stdlib/ndarray/any/benchmark/benchmark.2d.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
2525
var pow = require( '@stdlib/math/base/special/pow' );
2626
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2727
var floor = require( '@stdlib/math/base/special/floor' );
28-
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
29-
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
30-
var ndarray = require( '@stdlib/ndarray/ctor' );
28+
var zeros = require( '@stdlib/ndarray/zeros' );
3129
var pkg = require( './../package.json' ).name;
3230
var any = require( './../lib' );
3331

@@ -52,11 +50,10 @@ var orders = [ 'row-major', 'column-major' ];
5250
* @returns {Function} benchmark function
5351
*/
5452
function createBenchmark( len, shape, xtype, order, dims ) {
55-
var x;
56-
57-
x = discreteUniform( len, -1, -100 );
58-
x = new ndarray( xtype, x, shape, shape2strides( shape, order ), 0, order );
59-
53+
var x = zeros( shape, {
54+
'dtype': xtype,
55+
'order': order
56+
});
6057
return benchmark;
6158

6259
/**

lib/node_modules/@stdlib/ndarray/any/docs/types/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import any = require( './index' );
2525

2626
// TESTS //
2727

28-
// The function returns an boolean ndarray...
28+
// The function returns a boolean ndarray...
2929
{
3030
const x = zeros( [ 2, 2 ] );
3131

lib/node_modules/@stdlib/ndarray/any/examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var any = require( './../lib' );
2727
var x = zeros( [ 2, 4, 5 ], {
2828
'dtype': 'float64'
2929
});
30-
x = fillBy( x, bernoulli( 0.50 ) );
30+
x = fillBy( x, bernoulli( 0.10 ) );
3131
console.log( ndarray2array( x ) );
3232

3333
var y = any( x );

lib/node_modules/@stdlib/ndarray/any/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"array",
5555
"ndarray",
5656
"any",
57-
"one",
57+
"some",
5858
"utility",
5959
"utils",
6060
"truthy",

lib/node_modules/@stdlib/ndarray/any/test/test.assign.js

Lines changed: 91 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,40 @@ tape( 'the function throws an error if provided a first argument which is not an
7070
}
7171
});
7272

73+
tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (options)', function test( t ) {
74+
var values;
75+
var y;
76+
var i;
77+
78+
y = empty( [], {
79+
'dtype': 'bool'
80+
});
81+
82+
values = [
83+
'5',
84+
5,
85+
NaN,
86+
true,
87+
false,
88+
null,
89+
void 0,
90+
{},
91+
[],
92+
function noop() {}
93+
];
94+
95+
for ( i = 0; i < values.length; i++ ) {
96+
t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
97+
}
98+
t.end();
99+
100+
function badValue( value ) {
101+
return function badValue() {
102+
assign( value, y, {} );
103+
};
104+
}
105+
});
106+
73107
tape( 'the function throws an error if provided a second argument which is not an ndarray-like object', function test( t ) {
74108
var values;
75109
var x;
@@ -104,6 +138,40 @@ tape( 'the function throws an error if provided a second argument which is not a
104138
}
105139
});
106140

141+
tape( 'the function throws an error if provided a second argument which is not an ndarray-like object (options)', function test( t ) {
142+
var values;
143+
var x;
144+
var i;
145+
146+
x = empty( [ 2, 2 ], {
147+
'dtype': 'float64'
148+
});
149+
150+
values = [
151+
'5',
152+
5,
153+
NaN,
154+
true,
155+
false,
156+
null,
157+
void 0,
158+
{},
159+
[],
160+
function noop() {}
161+
];
162+
163+
for ( i = 0; i < values.length; i++ ) {
164+
t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
165+
}
166+
t.end();
167+
168+
function badValue( value ) {
169+
return function badValue() {
170+
assign( x, value, {} );
171+
};
172+
}
173+
});
174+
107175
tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) {
108176
var values;
109177
var x;
@@ -125,7 +193,8 @@ tape( 'the function throws an error if provided an options argument which is not
125193
false,
126194
null,
127195
void 0,
128-
[]
196+
[],
197+
function noop() {}
129198
];
130199

131200
for ( i = 0; i < values.length; i++ ) {
@@ -178,7 +247,7 @@ tape( 'the function throws an error if provided an options with invalid `dims` p
178247
}
179248
});
180249

181-
tape( 'the function tests whether at least one element along one or more ndarray dimensions is truthy (row-major, contiguous)', function test( t ) {
250+
tape( 'the function tests whether at least one element along one or more ndarray dimensions is truthy (row-major)', function test( t ) {
182251
var expected;
183252
var actual;
184253
var x;
@@ -197,48 +266,48 @@ tape( 'the function tests whether at least one element along one or more ndarray
197266
t.end();
198267
});
199268

200-
tape( 'the function tests whether at least one element along one or more ndarray dimensions is truthy (row-major, contiguous, options)', function test( t ) {
269+
tape( 'the function tests whether at least one element along one or more ndarray dimensions is truthy (column-major)', function test( t ) {
201270
var expected;
202271
var actual;
203-
var opts;
204272
var x;
205273
var y;
206274

207-
x = new ndarray( 'float64', new Float64Array( [ 1.0, 0.0, 3.0, 0.0, -5.0, 0.0, -7.0, 0.0 ] ), [ 2, 4 ], [ 4, 1 ], 0, 'row-major' );
208-
209-
opts = {
210-
'dims': [ 0 ]
211-
};
212-
y = empty( [ 4 ], {
275+
x = new ndarray( 'float64', new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] ), [ 4 ], [ 1 ], 0, 'column-major' );
276+
y = empty( [], {
213277
'dtype': 'bool'
214278
});
215-
actual = assign( x, y, opts );
216-
expected = [ true, false, true, false ];
279+
280+
actual = assign( x, y );
281+
expected = true;
282+
217283
t.strictEqual( actual, y, 'returns expected value' );
218-
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
284+
t.strictEqual( actual.get(), expected, 'returns expected value' );
219285
t.end();
220286
});
221287

222-
tape( 'the function tests whether at least one element along one or more ndarray dimensions is truthy (column-major, contiguous)', function test( t ) {
288+
tape( 'the function supports specifying reduction dimensions (row-major)', function test( t ) {
223289
var expected;
224290
var actual;
291+
var opts;
225292
var x;
226293
var y;
227294

228-
x = new ndarray( 'float64', new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] ), [ 4 ], [ 1 ], 0, 'column-major' );
229-
y = empty( [], {
295+
x = new ndarray( 'float64', new Float64Array( [ 1.0, 0.0, 3.0, 0.0, -5.0, 0.0, -7.0, 0.0 ] ), [ 2, 4 ], [ 4, 1 ], 0, 'row-major' );
296+
297+
opts = {
298+
'dims': [ 0 ]
299+
};
300+
y = empty( [ 4 ], {
230301
'dtype': 'bool'
231302
});
232-
233-
actual = assign( x, y );
234-
expected = true;
235-
303+
actual = assign( x, y, opts );
304+
expected = [ true, false, true, false ];
236305
t.strictEqual( actual, y, 'returns expected value' );
237-
t.strictEqual( actual.get(), expected, 'returns expected value' );
306+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
238307
t.end();
239308
});
240309

241-
tape( 'the function tests whether at least one element along one or more ndarray dimensions is truthy (column-major, contiguous, options)', function test( t ) {
310+
tape( 'the function supports specifying reduction dimensions (column-major)', function test( t ) {
242311
var expected;
243312
var actual;
244313
var opts;

0 commit comments

Comments
 (0)