Skip to content

Commit fe5ee9b

Browse files
committed
chore: apply review suggestion
1 parent ff42a4e commit fe5ee9b

File tree

7 files changed

+60
-37
lines changed

7 files changed

+60
-37
lines changed

lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ The function has the following additional parameters:
106106
- **offsetX**: starting index for `x`.
107107
- **offsetOut**: starting index for `out`.
108108

109-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example, to calculate the sum of every other value in `x` starting from the second value
109+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example, to calculate the sum of every other element starting from the second element:
110110

111111
```javascript
112112
var Float64Array = require( '@stdlib/array/float64' );

lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/benchmark/benchmark.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ var dnannsumkbn2 = require( './../lib/dnannsumkbn2.js' );
3333

3434
// FUNCTIONS //
3535

36+
/**
37+
* Returns a random number.
38+
*
39+
* @private
40+
* @returns {number} random number
41+
*/
42+
function rand() {
43+
if ( bernoulli( 0.7 ) > 0 ) {
44+
return discreteUniform( -10.0, 10.0 );
45+
}
46+
return NaN;
47+
}
48+
3649
/**
3750
* Creates a benchmark function.
3851
*
@@ -44,14 +57,7 @@ function createBenchmark( len ) {
4457
var out;
4558
var x;
4659

47-
function clbk() {
48-
if ( bernoulli( 0.7 ) > 0 ) {
49-
return discreteUniform( -10, 10 );
50-
}
51-
return NaN;
52-
}
53-
54-
x = filledarrayBy( len, 'float64', clbk );
60+
x = filledarrayBy( len, 'float64', rand );
5561
out = new Float64Array( 2 );
5662
return benchmark;
5763

lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/benchmark/benchmark.native.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ var opts = {
4242

4343
// FUNCTIONS //
4444

45+
/**
46+
* Returns a random number.
47+
*
48+
* @private
49+
* @returns {number} random number
50+
*/
51+
function rand() {
52+
if ( bernoulli( 0.8 ) > 0 ) {
53+
return discreteUniform( -10.0, 10.0 );
54+
}
55+
return NaN;
56+
}
57+
4558
/**
4659
* Creates a benchmark function.
4760
*
@@ -53,14 +66,7 @@ function createBenchmark( len ) {
5366
var out;
5467
var x;
5568

56-
function clbk() {
57-
if ( bernoulli( 0.7 ) > 0 ) {
58-
return discreteUniform( -10, 10 );
59-
}
60-
return NaN;
61-
}
62-
63-
x = filledarrayBy( len, 'float64', clbk );
69+
x = filledarrayBy( len, 'float64', rand );
6470
out = new Float64Array( 2 );
6571
return benchmark;
6672

lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/benchmark/benchmark.ndarray.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ var dnannsumkbn2 = require( './../lib/ndarray.js' );
3333

3434
// FUNCTIONS //
3535

36+
/**
37+
* Returns a random number.
38+
*
39+
* @private
40+
* @returns {number} random number
41+
*/
42+
function rand() {
43+
if ( bernoulli( 0.8 ) > 0 ) {
44+
return discreteUniform( -10.0, 10.0 );
45+
}
46+
return NaN;
47+
}
48+
3649
/**
3750
* Creates a benchmark function.
3851
*
@@ -44,14 +57,7 @@ function createBenchmark( len ) {
4457
var out;
4558
var x;
4659

47-
function clbk() {
48-
if ( bernoulli( 0.7 ) > 0 ) {
49-
return discreteUniform( -10, 10 );
50-
}
51-
return NaN;
52-
}
53-
54-
x = filledarrayBy( len, 'float64', clbk );
60+
x = filledarrayBy( len, 'float64', rand );
5561
out = new Float64Array( 2 );
5662
return benchmark;
5763

lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/benchmark/benchmark.ndarray.native.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ var opts = {
4242

4343
// FUNCTIONS //
4444

45+
/**
46+
* Returns a random number.
47+
*
48+
* @private
49+
* @returns {number} random number
50+
*/
51+
function rand() {
52+
if ( bernoulli( 0.8 ) > 0 ) {
53+
return discreteUniform( -10.0, 10.0 );
54+
}
55+
return NaN;
56+
}
57+
4558
/**
4659
* Creates a benchmark function.
4760
*
@@ -53,14 +66,7 @@ function createBenchmark( len ) {
5366
var out;
5467
var x;
5568

56-
function clbk() {
57-
if ( bernoulli( 0.7 ) > 0 ) {
58-
return discreteUniform( -10, 10 );
59-
}
60-
return NaN;
61-
}
62-
63-
x = filledarrayBy( len, 'float64', clbk );
69+
x = filledarrayBy( len, 'float64', rand );
6470
out = new Float64Array( 2 );
6571
return benchmark;
6672

lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/docs/repl.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
> {{alias}}( x.length, x, 1, out, 1 )
4444
<Float64Array>[ 1.0, 3 ]
4545

46-
// Using `N` and `stride` parameters:
46+
// Using `N` and stride parameters:
4747
> x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN, NaN ] );
4848
> out = new {{alias:@stdlib/array/float64}}( 2 );
4949
> {{alias}}( 4, x, 2, out, 1 )
@@ -100,7 +100,7 @@
100100
// Standard Usage:
101101
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, NaN, 2.0 ] );
102102
> var out = new {{alias:@stdlib/array/float64}}( 2 );
103-
> {{alias}}.ndarray( x.length, x, 1, 0, out, 1, 0 )
103+
> {{alias}}.ndarray( 4, x, 1, 0, out, 1, 0 )
104104
<Float64Array>[ 1.0, 3 ]
105105

106106
// Using offset parameter:

lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ double API_SUFFIX(stdlib_strided_dnannsumkbn2_ndarray)( const CBLAS_INT N, const
8383
if ( stdlib_base_is_nan( X[ ix ] ) ) {
8484
return sum;
8585
}
86-
sum = X[ ix ] * N;
8786
*n += N;
88-
return sum;
87+
return X[ ix ] * N;
8988
}
9089
ccs = 0.0; // second order correction term for lost lower order bits
9190
cs = 0.0; // first order correction term for lost low order bits

0 commit comments

Comments
 (0)