Skip to content

Commit 72df656

Browse files
committed
chore: cleanup
1 parent 7d112ed commit 72df656

8 files changed

Lines changed: 51 additions & 31 deletions

File tree

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ int main( void ) {
308308
309309
<!-- /.c -->
310310
311-
312311
<section class="references">
313312
314313
## References
@@ -335,7 +334,6 @@ int main( void ) {
335334
336335
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
337336
338-
339337
[@higham:1993]: https://doi.org/10.1137/0914050
340338
341339
<!-- <related-links> -->

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ function createBenchmark( len ) {
8080
for ( i = 0; i < b.iterations; i++ ) {
8181
x[ 0 ] += 1.0;
8282
v = snancusumpw( x.length, 0.0, x, 1, y, 1 );
83-
if ( isnanf( v[ i % len ] ) ) {
83+
if ( isnanf( v[ i%len] ) ) {
8484
b.fail( 'should not return NaN' );
8585
}
8686
}
8787
b.toc();
88-
if ( isnanf( v[ i % len ] ) ) {
88+
if ( isnanf( v[ i%len] ) ) {
8989
b.fail( 'should not return NaN' );
9090
}
9191
b.pass( 'benchmark finished' );

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ var pkg = require( './../package.json' ).name;
3535

3636
// VARIABLES //
3737

38-
var options = {
39-
'dtype': 'float32'
40-
};
4138
var snancusumpw = tryRequire( resolve( __dirname, './../lib/snancusumpw.native.js' ) );
4239
var opts = {
4340
'skip': ( snancusumpw instanceof Error )
4441
};
42+
var options = {
43+
'dtype': 'float32'
44+
};
4545

4646

4747
// FUNCTIONS //
@@ -85,12 +85,12 @@ function createBenchmark( len ) {
8585
for ( i = 0; i < b.iterations; i++ ) {
8686
x[ 0 ] += 1.0;
8787
v = snancusumpw( x.length, 0.0, x, 1, y, 1 );
88-
if ( isnanf( v[ i % len ] ) ) {
88+
if ( isnanf( v[ i%len ] ) ) {
8989
b.fail( 'should not return NaN' );
9090
}
9191
}
9292
b.toc();
93-
if ( isnanf( v[ i % len ] ) ) {
93+
if ( isnanf( v[ i%len ] ) ) {
9494
b.fail( 'should not return NaN' );
9595
}
9696
b.pass( 'benchmark finished' );

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ function createBenchmark( len ) {
8080
for ( i = 0; i < b.iterations; i++ ) {
8181
x[ 0 ] += 1.0;
8282
v = snancusumpw( x.length, 0.0, x, 1, 0, y, 1, 0 );
83-
if ( isnanf( v[ i % len ] ) ) {
83+
if ( isnanf( v[ i%len ] ) ) {
8484
b.fail( 'should not return NaN' );
8585
}
8686
}
8787
b.toc();
88-
if ( isnanf( v[ i % len ] ) ) {
88+
if ( isnanf( v[ i%len ] ) ) {
8989
b.fail( 'should not return NaN' );
9090
}
9191
b.pass( 'benchmark finished' );

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ var pkg = require( './../package.json' ).name;
3535

3636
// VARIABLES //
3737

38-
var options = {
39-
'dtype': 'float32'
40-
};
4138
var snancusumpw = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) );
4239
var opts = {
4340
'skip': ( snancusumpw instanceof Error )
4441
};
42+
var options = {
43+
'dtype': 'float32'
44+
};
4545

4646

4747
// FUNCTIONS //
@@ -85,12 +85,12 @@ function createBenchmark( len ) {
8585
for ( i = 0; i < b.iterations; i++ ) {
8686
x[ 0 ] += 1.0;
8787
v = snancusumpw( x.length, 0.0, x, 1, 0, y, 1, 0 );
88-
if ( isnanf( v[ i % len ] ) ) {
88+
if ( isnanf( v[ i%len ] ) ) {
8989
b.fail( 'should not return NaN' );
9090
}
9191
}
9292
b.toc();
93-
if ( isnanf( v[ i % len ] ) ) {
93+
if ( isnanf( v[ i%len ] ) ) {
9494
b.fail( 'should not return NaN' );
9595
}
9696
b.pass( 'benchmark finished' );

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
* limitations under the License.
1717
*/
1818

19-
#include <sys/time.h>
2019
#include "stdlib/blas/ext/base/snancusumpw.h"
21-
#include <math.h>
22-
#include <stdio.h>
2320
#include <stdlib.h>
21+
#include <stdio.h>
22+
#include <math.h>
2423
#include <time.h>
24+
#include <sys/time.h>
2525

2626
#define NAME "snancusumpw"
2727
#define ITERATIONS 1000000
@@ -121,7 +121,7 @@ static double benchmark1( int iterations, int len ) {
121121
}
122122
}
123123
elapsed = tic() - t;
124-
if ( y[ len - 1 ] != y[ len - 1 ] ) {
124+
if ( y[ len-1] != y[ len-1] ) {
125125
printf( "should not return NaN\n" );
126126
}
127127
free( x );
@@ -163,7 +163,7 @@ static double benchmark2( int iterations, int len ) {
163163
}
164164
}
165165
elapsed = tic() - t;
166-
if ( y[ len - 1 ] != y[ len - 1 ] ) {
166+
if ( y[ len-1] != y[ len-1] ) {
167167
printf( "should not return NaN\n" );
168168
}
169169
free( x );
@@ -189,7 +189,7 @@ int main( void ) {
189189
count = 0;
190190
for ( i = MIN; i <= MAX; i++ ) {
191191
len = pow( 10, i );
192-
iter = ITERATIONS / pow( 10, i - 1 );
192+
iter = ITERATIONS / pow( 10, i-1);
193193
for ( j = 0; j < REPEATS; j++ ) {
194194
count += 1;
195195
printf( "# c::%s:len=%d\n", NAME, len );
@@ -200,7 +200,7 @@ int main( void ) {
200200
}
201201
for ( i = MIN; i <= MAX; i++ ) {
202202
len = pow( 10, i );
203-
iter = ITERATIONS / pow( 10, i - 1 );
203+
iter = ITERATIONS / pow( 10, i-1);
204204
for ( j = 0; j < REPEATS; j++ ) {
205205
count += 1;
206206
printf( "# c::%s:ndarray:len=%d\n", NAME, len );

lib/node_modules/@stdlib/blas/ext/base/snancusumpw/lib/ndarray.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,22 @@ function snancusumpw( N, sum, x, strideX, offsetX, y, strideY, offsetY ) {
7676
ix = offsetX;
7777
iy = offsetY;
7878
if ( N <= BLOCKSIZE ) {
79-
s = 0.0;
80-
for ( i = 0; i < N; i++ ) {
81-
if ( isnanf( x[ ix ] ) === false ) {
82-
s = f32( s + x[ ix ] );
79+
if ( isnanf( x[ ix ] ) ) {
80+
s = 0.0;
81+
} else {
82+
s = x[ ix ];
83+
}
84+
y[ iy ] = f32( sum + s );
85+
ix += strideX;
86+
iy += strideY;
87+
for ( i = 1; i < N; i++ ) {
88+
if ( isnanf( x[ ix ] ) ) {
89+
y[ iy ] = f32( sum + s );
90+
ix += strideX;
91+
iy += strideY;
92+
continue;
8393
}
94+
s = f32( s + x[ ix ] );
8495
y[ iy ] = f32( sum + s );
8596
ix += strideX;
8697
iy += strideY;

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,22 @@ void API_SUFFIX(stdlib_strided_snancusumpw_ndarray)( const CBLAS_INT N, const fl
8080

8181
// Blocksize for pairwise summation...
8282
if ( N <= 128 ) {
83-
s = 0.0f;
84-
for ( i = 0; i < N; i++ ) {
85-
if ( !stdlib_base_is_nanf( X[ ix ] ) ) {
86-
s += X[ ix ];
83+
if ( stdlib_base_is_nanf( X[ ix ] ) ) {
84+
s = 0.0f;
85+
} else {
86+
s = X[ ix ];
87+
}
88+
Y[ iy ] = sum + s;
89+
ix += strideX;
90+
iy += strideY;
91+
for ( i = 1; i < N; i++ ) {
92+
if ( stdlib_base_is_nanf( X[ ix ] ) ) {
93+
Y[ iy ] = sum + s;
94+
ix += strideX;
95+
iy += strideY;
96+
continue;
8797
}
98+
s += X[ ix ];
8899
Y[ iy ] = sum + s;
89100
ix += strideX;
90101
iy += strideY;

0 commit comments

Comments
 (0)