Skip to content

Commit 8e403f3

Browse files
committed
fix: fixing mistakes
--- 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: na - 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: passed - 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: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: passed - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: passed - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 6eba083 commit 8e403f3

File tree

11 files changed

+22
-68
lines changed

11 files changed

+22
-68
lines changed

lib/node_modules/@stdlib/stats/base/svarianceyc/README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the
164164

165165
```javascript
166166
var Float32Array = require( '@stdlib/array/float32' );
167-
var floor = require( '@stdlib/math/base/special/floor' );
168167

169168
var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
170169

@@ -194,18 +193,12 @@ var v = svarianceyc.ndarray( 4, 1, x, 2, 1 );
194193
<!-- eslint no-undef: "error" -->
195194

196195
```javascript
197-
var randu = require( '@stdlib/random/base/randu' );
198-
var round = require( '@stdlib/math/base/special/round' );
199-
var Float32Array = require( '@stdlib/array/float32' );
196+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
200197
var svarianceyc = require( '@stdlib/stats/base/svarianceyc' );
201198

202-
var x;
203-
var i;
204-
205-
x = new Float32Array( 10 );
206-
for ( i = 0; i < x.length; i++ ) {
207-
x[ i ] = round( (randu()*100.0) - 50.0 );
208-
}
199+
var x = discreteUniform( 10, -50, 50, {
200+
'dtype': 'float32'
201+
});
209202
console.log( x );
210203

211204
var v = svarianceyc( x.length, 1, x, 1 );
@@ -260,8 +253,6 @@ The function accepts the following arguments:
260253
- **x**: `[in] float*` input array.
261254
- **strideX**: stride length for `x`.
262255
263-
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [variance][variance] of every other element in `x`,
264-
265256
```c
266257
float stdlib_strided_svarianceyc( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX );
267258
```

lib/node_modules/@stdlib/stats/base/svarianceyc/benchmark/benchmark.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var svarianceyc = require( './../lib/svarianceyc.js' );
3030

3131
// VARIABLES //
3232

33-
var option = {
33+
var options = {
3434
'dtype': 'float32'
3535
};
3636

@@ -47,7 +47,7 @@ var option = {
4747
function createBenchmark( len ) {
4848
var x;
4949

50-
x = uniform( len, -10, 10, option );
50+
x = uniform( len, -10, 10, options );
5151
return benchmark;
5252

5353
function benchmark( b ) {

lib/node_modules/@stdlib/stats/base/svarianceyc/benchmark/benchmark.native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var svarianceyc = tryRequire( resolve( __dirname, './../lib/svarianceyc.native.j
3535
var opts = {
3636
'skip': ( svarianceyc instanceof Error )
3737
};
38-
var option = {
38+
var options = {
3939
'dtype': 'float32'
4040
};
4141

@@ -52,7 +52,7 @@ var option = {
5252
function createBenchmark( len ) {
5353
var x;
5454

55-
x = uniform( len, -10, 10, option );
55+
x = uniform( len, -10, 10, options );
5656
return benchmark;
5757

5858
function benchmark( b ) {

lib/node_modules/@stdlib/stats/base/svarianceyc/benchmark/benchmark.ndarray.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var svarianceyc = require( './../lib/ndarray.js' );
3030

3131
// VARIABLES //
3232

33-
var option = {
33+
var options = {
3434
'dtype': 'float32'
3535
};
3636

@@ -47,7 +47,7 @@ var option = {
4747
function createBenchmark( len ) {
4848
var x;
4949

50-
x = uniform( len, -10, 10, option );
50+
x = uniform( len, -10, 10, options );
5151
return benchmark;
5252

5353
function benchmark( b ) {

lib/node_modules/@stdlib/stats/base/svarianceyc/benchmark/benchmark.ndarray.native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var svarianceyc = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' )
3535
var opts = {
3636
'skip': ( svarianceyc instanceof Error )
3737
};
38-
var option = {
38+
var options = {
3939
'dtype': 'float32'
4040
};
4141

@@ -52,7 +52,7 @@ var option = {
5252
function createBenchmark( len ) {
5353
var x;
5454

55-
x = uniform( len, -10, 10, option );
55+
x = uniform( len, -10, 10, options );
5656
return benchmark;
5757

5858
function benchmark( b ) {

lib/node_modules/@stdlib/stats/base/svarianceyc/examples/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ var svarianceyc = require( './../lib' );
2323

2424
var x;
2525

26-
x = discreteUniform( 10, -50, 50 );
26+
x = discreteUniform( 10, -50, 50, {
27+
'dtype': 'float32'
28+
});
2729
console.log( x );
2830

2931
var v = svarianceyc( x.length, 1, x, 1 );

lib/node_modules/@stdlib/stats/base/svarianceyc/lib/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
*
3535
* @example
3636
* var Float32Array = require( '@stdlib/array/float32' );
37-
* var floor = require( '@stdlib/math/base/special/floor' );
3837
* var svarianceyc = require( '@stdlib/stats/base/svarianceyc' );
3938
*
4039
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );

lib/node_modules/@stdlib/stats/base/svarianceyc/lib/ndarray.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
4545
*
4646
* @example
4747
* var Float32Array = require( '@stdlib/array/float32' );
48-
* var floor = require( '@stdlib/math/base/special/floor' );
4948
*
5049
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
51-
* var N = floor( x.length / 2 );
5250
*
53-
* var v = svarianceyc( N, 1, x, 2, 1 );
51+
* var v = svarianceyc( 4, 1, x, 2, 1 );
5452
* // returns 6.25
5553
*/
5654
function svarianceyc( N, correction, x, strideX, offsetX ) {

lib/node_modules/@stdlib/stats/base/svarianceyc/lib/svarianceyc.js

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
// MODULES //
2222

23-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
23+
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
24+
var ndarray = require( './ndarray.js' );
2425

2526

2627
// MAIN //
@@ -51,37 +52,7 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
5152
* // returns ~4.3333
5253
*/
5354
function svarianceyc( N, correction, x, strideX ) {
54-
var sum;
55-
var ix;
56-
var S;
57-
var v;
58-
var d;
59-
var n;
60-
var i;
61-
62-
n = N - correction;
63-
if ( N <= 0 || n <= 0.0 ) {
64-
return NaN;
65-
}
66-
if ( N === 1 || strideX === 0 ) {
67-
return 0.0;
68-
}
69-
if ( strideX < 0 ) {
70-
ix = (1-N) * strideX;
71-
} else {
72-
ix = 0;
73-
}
74-
sum = x[ ix ];
75-
ix += strideX;
76-
S = 0.0;
77-
for ( i = 2; i <= N; i++ ) {
78-
v = x[ ix ];
79-
sum = float64ToFloat32( sum+v );
80-
d = float64ToFloat32( float64ToFloat32( i*v ) - sum );
81-
S = float64ToFloat32( S + float64ToFloat32( float64ToFloat32( float64ToFloat32( 1.0/(i*(i-1)) ) * d ) * d ) ); // eslint-disable-line max-len
82-
ix += strideX;
83-
}
84-
return float64ToFloat32( S/n );
55+
return ndarray( N, correction, x, strideX, stride2offset( N, strideX ) );
8556
}
8657

8758

lib/node_modules/@stdlib/stats/base/svarianceyc/manifest.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
"include": [
3636
"./include"
3737
],
38-
"libraries": [
39-
"-lm"
40-
],
38+
"libraries": [],
4139
"libpath": [],
4240
"dependencies": [
4341
"@stdlib/napi/export",
@@ -59,9 +57,7 @@
5957
"include": [
6058
"./include"
6159
],
62-
"libraries": [
63-
"-lm"
64-
],
60+
"libraries": [],
6561
"libpath": [],
6662
"dependencies": [
6763
"@stdlib/blas/base/shared",
@@ -95,9 +91,7 @@
9591
"include": [
9692
"./include"
9793
],
98-
"libraries": [
99-
"-lm"
100-
],
94+
"libraries": [],
10195
"libpath": [],
10296
"dependencies": [
10397
"@stdlib/blas/base/shared",

0 commit comments

Comments
 (0)