Skip to content

Commit 80a583b

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: passed - task: lint_javascript_src status: passed - 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: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - 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 115b665 commit 80a583b

File tree

22 files changed

+59
-90
lines changed

22 files changed

+59
-90
lines changed

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

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

2121
# dnancusumkbn
2222

23-
> Calculate the cumulative sum of double-precision floating-point strided array elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values.
23+
> Calculate the cumulative sum of double-precision floating-point strided array elements ignoring `NaN` values and using an improved Kahan–Babuška algorithm.
2424
2525
<section class="intro">
2626

@@ -38,7 +38,7 @@ var dnancusumkbn = require( '@stdlib/blas/ext/base/dnancusumkbn' );
3838

3939
#### dnancusumkbn( N, sum, x, strideX, y, strideY )
4040

41-
Computes the cumulative sum of double-precision floating-point strided array elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values.
41+
Computes the cumulative sum of double-precision floating-point strided array elements ignoring `NaN` values and using an improved Kahan–Babuška algorithm.
4242

4343
```javascript
4444
var Float64Array = require( '@stdlib/array/float64' );
@@ -115,7 +115,7 @@ The function has the following additional parameters:
115115
- **offsetX**: starting index for `x`.
116116
- **offsetY**: starting index for `y`.
117117

118-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the cumulative sum of every other value in the strided input array starting from the second value and to store in the last `N` elements of the strided output array starting from the last element:
118+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the cumulative sum of every other element in the strided input array starting from the second element and to store in the last `N` elements of the strided output array starting from the last element:
119119

120120
```javascript
121121
var Float64Array = require( '@stdlib/array/float64' );
@@ -148,10 +148,11 @@ dnancusumkbn.ndarray( 4, 0.0, x, 2, 1, y, -1, y.length-1 );
148148
<!-- eslint no-undef: "error" -->
149149

150150
```javascript
151-
var dnancusumkbn = require( '@stdlib/blas/ext/base/dnancusumkbn' );
152151
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
153152
var bernoulli = require( '@stdlib/random/base/bernoulli' );
154153
var filledarrayBy = require( '@stdlib/array/filled-by' );
154+
var zeros = require( '@stdlib/array/zeros' );
155+
var dnancusumkbn = require( '@stdlib/blas/ext/base/dnancusumkbn' );
155156

156157
function rand() {
157158
if ( bernoulli( 0.7 ) > 0 ) {
@@ -160,14 +161,10 @@ function rand() {
160161
return NaN;
161162
}
162163

163-
function constant() {
164-
return 0.0;
165-
}
166-
167164
var x = filledarrayBy( 10, 'float64', rand );
168165
console.log( x );
169166

170-
var y = filledarrayBy( 10, 'float64', constant );
167+
var y = zeros( 10, 'float64' );
171168
console.log( y );
172169

173170
dnancusumkbn( x.length, 0.0, x, 1, y, -1 );
@@ -206,7 +203,7 @@ console.log( y );
206203

207204
#### stdlib_strided_dnancusumkbn( N, sum, \*X, strideX, \*Y, strideY )
208205

209-
Computes the cumulative sum of double-precision floating-point strided array elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values.
206+
Computes the cumulative sum of double-precision floating-point strided array elements ignoring `NaN` values and using an improved Kahan–Babuška algorithm.
210207

211208
```c
212209
const double x[] = { 1.0, 2.0, 3.0, 4.0 }
@@ -234,7 +231,7 @@ void stdlib_strided_dnancusumkbn( const CBLAS_INT N, const double sum, const dou
234231

235232
<!-- lint enable maximum-heading-length -->
236233

237-
Computes the cumulative sum of double-precision floating-point strided array elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values and alternative indexing semantics.
234+
Computes the cumulative sum of double-precision floating-point strided array elements ignoring `NaN` values and using an improved Kahan–Babuška algorithm and alternative indexing semantics.
238235

239236
```c
240237
const double x[] = { 1.0, 2.0, 3.0, 4.0 }
@@ -324,14 +321,6 @@ int main( void ) {
324321
325322
<section class="related">
326323
327-
* * *
328-
329-
## See Also
330-
331-
- <span class="package-name">[`@stdlib/blas/ext/base/dcusum`][@stdlib/blas/ext/base/dcusum]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of double-precision floating-point strided array elements.</span>
332-
- <span class="package-name">[`@stdlib/blas/ext/base/gcusumkbn`][@stdlib/blas/ext/base/gcusumkbn]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of strided array elements using an improved Kahan–Babuška algorithm.</span>
333-
- <span class="package-name">[`@stdlib/blas/ext/base/scusumkbn`][@stdlib/blas/ext/base/scusumkbn]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of single-precision floating-point strided array elements using an improved Kahan–Babuška algorithm.</span>
334-
335324
</section>
336325
337326
<!-- /.related -->
@@ -346,16 +335,6 @@ int main( void ) {
346335
347336
[@neumaier:1974a]: https://doi.org/10.1002/zamm.19740540106
348337
349-
<!-- <related-links> -->
350-
351-
[@stdlib/blas/ext/base/dcusum]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/dcusum
352-
353-
[@stdlib/blas/ext/base/gcusumkbn]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/gcusumkbn
354-
355-
[@stdlib/blas/ext/base/scusumkbn]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/scusumkbn
356-
357-
<!-- </related-links> -->
358-
359338
</section>
360339
361340
<!-- /.links -->

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var bench = require( '@stdlib/bench' );
2424
var uniform = require( '@stdlib/random/base/uniform' );
2525
var bernoulli = require( '@stdlib/random/base/bernoulli' );
2626
var filledarrayBy = require( '@stdlib/array/filled-by' );
27+
var zeros = require( '@stdlib/array/zeros' );
2728
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2829
var pow = require( '@stdlib/math/base/special/pow' );
2930
var pkg = require( './../package.json' ).name;
@@ -52,10 +53,6 @@ function rand() {
5253
return NaN;
5354
}
5455

55-
function constant() {
56-
return 0.0;
57-
}
58-
5956
/**
6057
* Creates a benchmark function.
6158
*
@@ -65,7 +62,7 @@ function constant() {
6562
*/
6663
function createBenchmark( len ) {
6764
var x = filledarrayBy( len, options.dtype, rand );
68-
var y = filledarrayBy( len, options.dtype, constant );
65+
var y = zeros( len, options.dtype );
6966
return benchmark;
7067

7168
function benchmark( b ) {

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var bench = require( '@stdlib/bench' );
2525
var uniform = require( '@stdlib/random/base/uniform' );
2626
var bernoulli = require( '@stdlib/random/base/bernoulli' );
2727
var filledarrayBy = require( '@stdlib/array/filled-by' );
28+
var zeros = require( '@stdlib/array/zeros' );
2829
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2930
var pow = require( '@stdlib/math/base/special/pow' );
3031
var tryRequire = require( '@stdlib/utils/try-require' );
@@ -57,10 +58,6 @@ function rand() {
5758
return NaN;
5859
}
5960

60-
function constant() {
61-
return 0.0;
62-
}
63-
6461
/**
6562
* Creates a benchmark function.
6663
*
@@ -70,7 +67,7 @@ function constant() {
7067
*/
7168
function createBenchmark( len ) {
7269
var x = filledarrayBy( len, options.dtype, rand );
73-
var y = filledarrayBy( len, options.dtype, constant );
70+
var y = zeros( len, options.dtype );
7471
return benchmark;
7572

7673
function benchmark( b ) {

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var bench = require( '@stdlib/bench' );
2424
var uniform = require( '@stdlib/random/base/uniform' );
2525
var bernoulli = require( '@stdlib/random/base/bernoulli' );
2626
var filledarrayBy = require( '@stdlib/array/filled-by' );
27+
var zeros = require( '@stdlib/array/zeros' );
2728
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2829
var pow = require( '@stdlib/math/base/special/pow' );
2930
var pkg = require( './../package.json' ).name;
@@ -52,10 +53,6 @@ function rand() {
5253
return NaN;
5354
}
5455

55-
function constant() {
56-
return 0.0;
57-
}
58-
5956
/**
6057
* Creates a benchmark function.
6158
*
@@ -65,7 +62,7 @@ function constant() {
6562
*/
6663
function createBenchmark( len ) {
6764
var x = filledarrayBy( len, options.dtype, rand );
68-
var y = filledarrayBy( len, options.dtype, constant );
65+
var y = zeros( len, options.dtype );
6966
return benchmark;
7067

7168
function benchmark( b ) {

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var bench = require( '@stdlib/bench' );
2525
var uniform = require( '@stdlib/random/base/uniform' );
2626
var bernoulli = require( '@stdlib/random/base/bernoulli' );
2727
var filledarrayBy = require( '@stdlib/array/filled-by' );
28+
var zeros = require( '@stdlib/array/zeros' );
2829
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2930
var pow = require( '@stdlib/math/base/special/pow' );
3031
var tryRequire = require( '@stdlib/utils/try-require' );
@@ -57,10 +58,6 @@ function rand() {
5758
return NaN;
5859
}
5960

60-
function constant() {
61-
return 0.0;
62-
}
63-
6461
/**
6562
* Creates a benchmark function.
6663
*
@@ -70,7 +67,7 @@ function constant() {
7067
*/
7168
function createBenchmark( len ) {
7269
var x = filledarrayBy( len, options.dtype, rand );
73-
var y = filledarrayBy( len, options.dtype, constant );
70+
var y = zeros( len, options.dtype );
7471
return benchmark;
7572

7673
function benchmark( b ) {

lib/node_modules/@stdlib/blas/ext/base/dnancusumkbn/benchmark/c/benchmark.length.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ static double benchmark2( int iterations, int len ) {
140140
int i;
141141

142142
for ( i = 0; i < len; i++ ) {
143-
x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
143+
if ( rand_double() < 0.2 ) {
144+
x[ i ] = 0.0 / 0.0; // NaN
145+
} else {
146+
x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
147+
}
144148
y[ i ] = 0.0;
145149
}
146150
t = tic();

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
{{alias}}( N, sum, x, strideX, y, strideY )
33
Computes the cumulative sum of double-precision floating-point strided array
4-
elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values.
4+
elements ignoring `NaN` values and using an improved Kahan–Babuška
5+
algorithm.
56

67
The `N` and stride parameters determine which elements in the strided arrays
78
are accessed at runtime.
@@ -63,7 +64,7 @@
6364

6465
{{alias}}.ndarray( N, sum, x, strideX, offsetX, y, strideY, offsetY )
6566
Computes the cumulative sum of double-precision floating-point strided array
66-
elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values
67+
elements ignoring `NaN` values and using an improved Kahan–Babuška algorithm
6768
and alternative indexing semantics.
6869

6970
While typed array views mandate a view offset based on the underlying

lib/node_modules/@stdlib/blas/ext/base/dnancusumkbn/docs/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
interface Routine {
2525
/**
26-
* Computes the cumulative sum of double-precision floating-point strided array elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values.
26+
* Computes the cumulative sum of double-precision floating-point strided array elements ignoring `NaN` values and using an improved Kahan–Babuška algorithm.
2727
*
2828
* @param N - number of indexed elements
2929
* @param sum - initial sum
@@ -45,7 +45,7 @@ interface Routine {
4545
( N: number, sum: number, x: Float64Array, strideX: number, y: Float64Array, strideY: number ): Float64Array;
4646

4747
/**
48-
* Computes the cumulative sum of double-precision floating-point strided array elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values and alternative indexing semantics.
48+
* Computes the cumulative sum of double-precision floating-point strided array elements ignoring `NaN` values and using an improved Kahan–Babuška algorithm and alternative indexing semantics.
4949
*
5050
* @param N - number of indexed elements
5151
* @param sum - initial sum
@@ -70,7 +70,7 @@ interface Routine {
7070
}
7171

7272
/**
73-
* Computes the cumulative sum of double-precision floating-point strided array elements using an improved Kahan–Babuška algorithm, ignoring `NaN` values.
73+
* Computes the cumulative sum of double-precision floating-point strided array elements ignoring `NaN` values and using an improved Kahan–Babuška algorithm.
7474
*
7575
* @param N - number of indexed elements
7676
* @param sum - initial sum

lib/node_modules/@stdlib/blas/ext/base/dnancusumkbn/docs/types/test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ import dnancusumkbn = require( './index' );
4949
const x = new Float64Array( 10 );
5050
const y = new Float64Array( 10 );
5151

52-
dnancusumkbn( x.length, '10', 0.0, x, 1, y, 1 ); // $ExpectError
53-
dnancusumkbn( x.length, true, 0.0, x, 1, y, 1 ); // $ExpectError
54-
dnancusumkbn( x.length, false, 0.0, x, 1, y, 1 ); // $ExpectError
55-
dnancusumkbn( x.length, null, 0.0, x, 1, y, 1 ); // $ExpectError
56-
dnancusumkbn( x.length, undefined, 0.0, x, 1, y, 1 ); // $ExpectError
57-
dnancusumkbn( x.length, [], 0.0, x, 1, y, 1 ); // $ExpectError
58-
dnancusumkbn( x.length, {}, 0.0, x, 1, y, 1 ); // $ExpectError
59-
dnancusumkbn( x.length, ( x: number ): number => x, 0.0, x, 1, y, 1 ); // $ExpectError
52+
dnancusumkbn( x.length, '10', x, 1, y, 1 ); // $ExpectError
53+
dnancusumkbn( x.length, true, x, 1, y, 1 ); // $ExpectError
54+
dnancusumkbn( x.length, false, x, 1, y, 1 ); // $ExpectError
55+
dnancusumkbn( x.length, null, x, 1, y, 1 ); // $ExpectError
56+
dnancusumkbn( x.length, undefined, x, 1, y, 1 ); // $ExpectError
57+
dnancusumkbn( x.length, [], x, 1, y, 1 ); // $ExpectError
58+
dnancusumkbn( x.length, {}, x, 1, y, 1 ); // $ExpectError
59+
dnancusumkbn( x.length, ( x: number ): number => x, x, 1, y, 1 ); // $ExpectError
6060
}
6161

6262
// The compiler throws an error if the function is provided a third argument which is not a Float64Array...
@@ -162,14 +162,14 @@ import dnancusumkbn = require( './index' );
162162
const x = new Float64Array( 10 );
163163
const y = new Float64Array( 10 );
164164

165-
dnancusumkbn.ndarray( x.length, '10', 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
166-
dnancusumkbn.ndarray( x.length, true, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
167-
dnancusumkbn.ndarray( x.length, false, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
168-
dnancusumkbn.ndarray( x.length, null, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
169-
dnancusumkbn.ndarray( x.length, undefined, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
170-
dnancusumkbn.ndarray( x.length, [], 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
171-
dnancusumkbn.ndarray( x.length, {}, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
172-
dnancusumkbn.ndarray( x.length, ( x: number ): number => x, 0.0, x, 1, 0, y, 1, 0 ); // $ExpectError
165+
dnancusumkbn.ndarray( x.length, '10', x, 1, 0, y, 1, 0 ); // $ExpectError
166+
dnancusumkbn.ndarray( x.length, true, x, 1, 0, y, 1, 0 ); // $ExpectError
167+
dnancusumkbn.ndarray( x.length, false, x, 1, 0, y, 1, 0 ); // $ExpectError
168+
dnancusumkbn.ndarray( x.length, null, x, 1, 0, y, 1, 0 ); // $ExpectError
169+
dnancusumkbn.ndarray( x.length, undefined, x, 1, 0, y, 1, 0 ); // $ExpectError
170+
dnancusumkbn.ndarray( x.length, [], x, 1, 0, y, 1, 0 ); // $ExpectError
171+
dnancusumkbn.ndarray( x.length, {}, x, 1, 0, y, 1, 0 ); // $ExpectError
172+
dnancusumkbn.ndarray( x.length, ( x: number ): number => x, x, 1, 0, y, 1, 0 ); // $ExpectError
173173
}
174174

175175
// The compiler throws an error if the `ndarray` method is provided a third argument which is not a Float64Array...

lib/node_modules/@stdlib/blas/ext/base/dnancusumkbn/examples/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
2222
var bernoulli = require( '@stdlib/random/base/bernoulli' );
2323
var filledarrayBy = require( '@stdlib/array/filled-by' );
24+
var zeros = require( '@stdlib/array/zeros' );
2425
var dnancusumkbn = require( './../lib' );
2526

2627
function rand() {
@@ -30,14 +31,10 @@ function rand() {
3031
return NaN;
3132
}
3233

33-
function constant() {
34-
return 0.0;
35-
}
36-
3734
var x = filledarrayBy( 10, 'float64', rand );
3835
console.log( x );
3936

40-
var y = filledarrayBy( 10, 'float64', constant );
37+
var y = zeros( x.length, 'float64' );
4138
console.log( y );
4239

4340
dnancusumkbn( x.length, 0.0, x, 1, y, -1 );

0 commit comments

Comments
 (0)