Skip to content

Commit 5fe7c52

Browse files
authored
refactor: rename variable in blas/base/sasumpw
PR-URL: #7212 Reviewed-by: Athan Reines <[email protected]>
1 parent 4dd744c commit 5fe7c52

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

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

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

2121
// MODULES //
2222

23-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
23+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2424
var floor = require( '@stdlib/math/base/special/floor' );
2525
var absf = require( '@stdlib/math/base/special/absf' );
2626

@@ -78,13 +78,13 @@ function sasumpw( N, x, strideX, offsetX ) {
7878
}
7979
ix = offsetX;
8080
if ( strideX === 0 ) {
81-
return float64ToFloat32( N * absf( x[ ix ] ) );
81+
return f32( N * absf( x[ ix ] ) );
8282
}
8383
if ( N < 8 ) {
8484
// Use simple summation...
8585
s = 0.0;
8686
for ( i = 0; i < N; i++ ) {
87-
s = float64ToFloat32( s + absf( x[ ix ] ) );
87+
s = f32( s + absf( x[ ix ] ) );
8888
ix += strideX;
8989
}
9090
return s;
@@ -103,30 +103,30 @@ function sasumpw( N, x, strideX, offsetX ) {
103103

104104
M = N % 8;
105105
for ( i = 8; i < N-M; i += 8 ) {
106-
s0 = float64ToFloat32( s0 + absf( x[ ix ] ) );
107-
s1 = float64ToFloat32( s1 + absf( x[ ix+strideX ] ) );
108-
s2 = float64ToFloat32( s2 + absf( x[ ix+(2*strideX) ] ) );
109-
s3 = float64ToFloat32( s3 + absf( x[ ix+(3*strideX) ] ) );
110-
s4 = float64ToFloat32( s4 + absf( x[ ix+(4*strideX) ] ) );
111-
s5 = float64ToFloat32( s5 + absf( x[ ix+(5*strideX) ] ) );
112-
s6 = float64ToFloat32( s6 + absf( x[ ix+(6*strideX) ] ) );
113-
s7 = float64ToFloat32( s7 + absf( x[ ix+(7*strideX) ] ) );
106+
s0 = f32( s0 + absf( x[ ix ] ) );
107+
s1 = f32( s1 + absf( x[ ix+strideX ] ) );
108+
s2 = f32( s2 + absf( x[ ix+(2*strideX) ] ) );
109+
s3 = f32( s3 + absf( x[ ix+(3*strideX) ] ) );
110+
s4 = f32( s4 + absf( x[ ix+(4*strideX) ] ) );
111+
s5 = f32( s5 + absf( x[ ix+(5*strideX) ] ) );
112+
s6 = f32( s6 + absf( x[ ix+(6*strideX) ] ) );
113+
s7 = f32( s7 + absf( x[ ix+(7*strideX) ] ) );
114114
ix += 8 * strideX;
115115
}
116116
// Pairwise sum the accumulators:
117-
s = float64ToFloat32( float64ToFloat32( float64ToFloat32(s0+s1) + float64ToFloat32(s2+s3) ) + float64ToFloat32( float64ToFloat32(s4+s5) + float64ToFloat32(s6+s7) ) ); // eslint-disable-line max-len
117+
s = f32( f32( f32(s0+s1) + f32(s2+s3) ) + f32( f32(s4+s5) + f32(s6+s7) ) ); // eslint-disable-line max-len
118118

119119
// Clean-up loop...
120120
for ( i; i < N; i++ ) {
121-
s = float64ToFloat32( s + absf( x[ ix ] ) );
121+
s = f32( s + absf( x[ ix ] ) );
122122
ix += strideX;
123123
}
124124
return s;
125125
}
126126
// Recurse by dividing by two, but avoiding non-multiples of unroll factor...
127127
n = floor( N/2 );
128128
n -= n % 8;
129-
return float64ToFloat32( sasumpw( n, x, strideX, ix ) + sasumpw( N-n, x, strideX, ix+(n*strideX) ) ); // eslint-disable-line max-len
129+
return f32( sasumpw( n, x, strideX, ix ) + sasumpw( N-n, x, strideX, ix+(n*strideX) ) ); // eslint-disable-line max-len
130130
}
131131

132132

lib/node_modules/@stdlib/blas/ext/base/sasumpw/test/test.ndarray.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var tape = require( 'tape' );
2424
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2525
var Float32Array = require( '@stdlib/array/float32' );
26-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
26+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2727
var sasumpw = require( './../lib/ndarray.js' );
2828

2929

@@ -63,7 +63,7 @@ tape( 'the function calculates the sum of all strided array elements', function
6363

6464
x = new Float32Array( [ 1.0, 1.0e38, 1.0, -1.0e38 ] );
6565
v = sasumpw( x.length, x, 1, 0 );
66-
t.strictEqual( v, float64ToFloat32( 2.0e38 ), 'returns expected value' );
66+
t.strictEqual( v, f32( 2.0e38 ), 'returns expected value' );
6767

6868
x = new Float32Array( 1e3 );
6969
for ( i = 0; i < 1e3; i++ ) {

lib/node_modules/@stdlib/blas/ext/base/sasumpw/test/test.ndarray.native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
2525
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2626
var Float32Array = require( '@stdlib/array/float32' );
27-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
27+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2828
var tryRequire = require( '@stdlib/utils/try-require' );
2929

3030

@@ -72,7 +72,7 @@ tape( 'the function calculates the sum of all strided array elements', opts, fun
7272

7373
x = new Float32Array( [ 1.0, 1.0e38, 1.0, -1.0e38 ] );
7474
v = sasumpw( x.length, x, 1, 0 );
75-
t.strictEqual( v, float64ToFloat32( 2.0e38 ), 'returns expected value' );
75+
t.strictEqual( v, f32( 2.0e38 ), 'returns expected value' );
7676

7777
x = new Float32Array( 1e3 );
7878
for ( i = 0; i < 1e3; i++ ) {

lib/node_modules/@stdlib/blas/ext/base/sasumpw/test/test.sasumpw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var tape = require( 'tape' );
2424
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2525
var Float32Array = require( '@stdlib/array/float32' );
26-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
26+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2727
var sasumpw = require( './../lib/sasumpw.js' );
2828

2929

@@ -63,7 +63,7 @@ tape( 'the function calculates the sum of absolute values', function test( t ) {
6363

6464
x = new Float32Array( [ 1.0, 1.0e38, 1.0, -1.0e38 ] );
6565
v = sasumpw( x.length, x, 1 );
66-
t.strictEqual( v, float64ToFloat32( 2.0e38 ), 'returns expected value' );
66+
t.strictEqual( v, f32( 2.0e38 ), 'returns expected value' );
6767

6868
x = new Float32Array( 1e3 );
6969
for ( i = 0; i < 1e3; i++ ) {

lib/node_modules/@stdlib/blas/ext/base/sasumpw/test/test.sasumpw.native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
2525
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2626
var Float32Array = require( '@stdlib/array/float32' );
27-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
27+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2828
var tryRequire = require( '@stdlib/utils/try-require' );
2929

3030

@@ -154,7 +154,7 @@ tape( 'the function calculates the sum of all strided array elements', opts, fun
154154

155155
x = new Float32Array( [ 1.0, 1.0e38, 1.0, -1.0e38 ] );
156156
v = sasumpw( x.length, x, 1 );
157-
t.strictEqual( v, float64ToFloat32( 2.0e38 ), 'returns expected value' );
157+
t.strictEqual( v, f32( 2.0e38 ), 'returns expected value' );
158158

159159
x = new Float32Array( 1e3 );
160160
for ( i = 0; i < 1e3; i++ ) {

0 commit comments

Comments
 (0)