Skip to content

Commit d9317e4

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: 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: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - 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: na - task: lint_license_headers status: passed ---
1 parent 0c66625 commit d9317e4

File tree

11 files changed

+54
-61
lines changed

11 files changed

+54
-61
lines changed

lib/node_modules/@stdlib/complex/float32/base/scale/README.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,16 @@ The function supports the following parameters:
124124
<!-- eslint no-undef: "error" -->
125125

126126
```javascript
127-
var Complex64 = require( '@stdlib/complex/float32/ctor' );
128-
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
127+
var Complex64Array = require( '@stdlib/array/complex64' );
128+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
129+
var logEachMap = require( '@stdlib/console/log-each-map' );
129130
var scale = require( '@stdlib/complex/float32/base/scale' );
130131

131-
var rand = discreteUniform( -50, 50 );
132+
// Generate an array of random values:
133+
var values = new Complex64Array( discreteUniform( 200, -50, 50 ) );
132134

133-
var c1;
134-
var c2;
135-
var i;
136-
for ( i = 0; i < 100; i++ ) {
137-
c1 = new Complex64( rand(), rand() );
138-
c2 = scale( 5.0, c1 );
139-
console.log( '(%s) * 5.0 = %s', c1.toString(), c2.toString() );
140-
}
135+
// Scale each by a scalar constant:
136+
logEachMap( '%0.1f * (%s) = %s', 5.0, values, scale );
141137
```
142138

143139
</section>
@@ -179,15 +175,15 @@ Scales a single-precision complex floating-point number by a real-valued single-
179175
#include "stdlib/complex/float32/real.h"
180176
#include "stdlib/complex/float32/imag.h"
181177

182-
stdlib_complex64_t c = stdlib_complex64( 5.0, 3.0 );
178+
stdlib_complex64_t c = stdlib_complex64( 5.0f, 3.0f );
183179

184-
stdlib_complex64_t out = stdlib_base_complex64_scale( 5.0, c );
180+
stdlib_complex64_t out = stdlib_base_complex64_scale( 5.0f, c );
185181

186182
float re = stdlib_complex64_real( out );
187-
// returns 25.0
183+
// returns 25.0f
188184

189185
float im = stdlib_complex64_imag( out );
190-
// returns 15.0
186+
// returns 15.0f
191187
```
192188

193189
The function accepts the following arguments:
@@ -225,10 +221,10 @@ stdlib_complex64_t stdlib_base_complex64_scale( const float alpha, const stdlib_
225221
226222
int main( void ) {
227223
const stdlib_complex64_t x[] = {
228-
stdlib_complex64( 3.14, 1.5 ),
229-
stdlib_complex64( -3.14, 1.5 ),
230-
stdlib_complex64( 0.0, -0.0 ),
231-
stdlib_complex64( 0.0/0.0, 0.0/0.0 )
224+
stdlib_complex64( 3.14f, 1.5f ),
225+
stdlib_complex64( -3.14f, 1.5f ),
226+
stdlib_complex64( 0.0f, -0.0f ),
227+
stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f )
232228
};
233229
234230
stdlib_complex64_t v;
@@ -239,11 +235,11 @@ int main( void ) {
239235
for ( i = 0; i < 4; i++ ) {
240236
v = x[ i ];
241237
stdlib_complex64_reim( v, &re, &im );
242-
printf( "c = %lf + %lfi\n", re, im );
238+
printf( "c = %f + %fi\n", re, im );
243239
244-
y = stdlib_base_complex64_scale( 5.0, v );
240+
y = stdlib_base_complex64_scale( 5.0f, v );
245241
stdlib_complex64_reim( y, &re, &im );
246-
printf( "scale(5.0, c) = %lf + %lfi\n", re, im );
242+
printf( "scale(5.0, c) = %f + %fi\n", re, im );
247243
}
248244
}
249245
```

lib/node_modules/@stdlib/complex/float32/base/scale/benchmark/c/native/benchmark.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static double tic( void ) {
8383
*/
8484
static float rand_float( void ) {
8585
int r = rand();
86-
return (float)r / ( (float)RAND_MAX + 1.0 );
86+
return (float)r / ( (float)RAND_MAX + 1.0f );
8787
}
8888

8989
/**
@@ -103,11 +103,11 @@ static double benchmark( void ) {
103103

104104
t = tic();
105105
for ( i = 0; i < ITERATIONS; i++ ) {
106-
re = ( 1000.0*rand_float() ) - 500.0;
107-
im = ( 1000.0*rand_float() ) - 500.0;
106+
re = ( 1000.0f*rand_float() ) - 500.0f;
107+
im = ( 1000.0f*rand_float() ) - 500.0f;
108108
z1 = stdlib_complex64( re, im );
109109

110-
z2 = stdlib_base_complex64_scale( 5.0, z1 );
110+
z2 = stdlib_base_complex64_scale( 5.0f, z1 );
111111
stdlib_complex64_reim( z2, &re, &im );
112112
if ( re != re ) {
113113
printf( "should not return NaN\n" );

lib/node_modules/@stdlib/complex/float32/base/scale/docs/types/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface Scale {
3636
*
3737
* @example
3838
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
39-
* var real = require( '@stdlib/complex/float32/real' );
39+
* var realf = require( '@stdlib/complex/float32/real' );
4040
* var imagf = require( '@stdlib/complex/float32/imag' );
4141
*
4242
* var z = new Complex64( 5.0, 3.0 );
@@ -45,7 +45,7 @@ interface Scale {
4545
* var out = scale( 5.0, z );
4646
* // returns <Complex64>
4747
*
48-
* var re = real( out );
48+
* var re = realf( out );
4949
* // returns 25.0
5050
*
5151
* var im = imagf( out );
@@ -108,7 +108,7 @@ interface Scale {
108108
*
109109
* @example
110110
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
111-
* var real = require( '@stdlib/complex/float32/real' );
111+
* var realf = require( '@stdlib/complex/float32/real' );
112112
* var imagf = require( '@stdlib/complex/float32/imag' );
113113
*
114114
* var z = new Complex64( 5.0, 3.0 );
@@ -117,7 +117,7 @@ interface Scale {
117117
* var out = scale( 5.0, z );
118118
* // returns <Complex64>
119119
*
120-
* var re = real( out );
120+
* var re = realf( out );
121121
* // returns 25.0
122122
*
123123
* var im = imagf( out );

lib/node_modules/@stdlib/complex/float32/base/scale/examples/c/example.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323

2424
int main( void ) {
2525
const stdlib_complex64_t x[] = {
26-
stdlib_complex64( 3.14, 1.5 ),
27-
stdlib_complex64( -3.14, 1.5 ),
28-
stdlib_complex64( 0.0, -0.0 ),
29-
stdlib_complex64( 0.0/0.0, 0.0/0.0 )
26+
stdlib_complex64( 3.14f, 1.5f ),
27+
stdlib_complex64( -3.14f, 1.5f ),
28+
stdlib_complex64( 0.0f, -0.0f ),
29+
stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f )
3030
};
3131

3232
stdlib_complex64_t v;
@@ -37,10 +37,10 @@ int main( void ) {
3737
for ( i = 0; i < 4; i++ ) {
3838
v = x[ i ];
3939
stdlib_complex64_reim( v, &re, &im );
40-
printf( "z = %lf + %lfi\n", re, im );
40+
printf( "z = %f + %fi\n", re, im );
4141

42-
y = stdlib_base_complex64_scale( 5.0, v );
42+
y = stdlib_base_complex64_scale( 5.0f, v );
4343
stdlib_complex64_reim( y, &re, &im );
44-
printf( "scale(5.0, z) = %lf + %lfi\n", re, im );
44+
printf( "scale(5.0, z) = %f + %fi\n", re, im );
4545
}
4646
}

lib/node_modules/@stdlib/complex/float32/base/scale/examples/index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@
1818

1919
'use strict';
2020

21-
var Complex64 = require( '@stdlib/complex/float64/ctor' );
22-
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
21+
var Complex64Array = require( '@stdlib/array/complex64' );
22+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
23+
var logEachMap = require( '@stdlib/console/log-each-map' );
2324
var scale = require( './../lib' );
2425

25-
var rand = discreteUniform( -50, 50 );
26+
// Generate an array of random values:
27+
var values = new Complex64Array( discreteUniform( 200, -50, 50 ) );
2628

27-
var z1;
28-
var z2;
29-
var i;
30-
for ( i = 0; i < 100; i++ ) {
31-
z1 = new Complex64( rand(), rand() );
32-
z2 = scale( 5.0, z1 );
33-
console.log( '(%s) * 5.0 = %s', z1.toString(), z2.toString() );
34-
}
29+
// Scale each by a scalar constant:
30+
logEachMap( '%0.1f * (%s) = %s', 5.0, values, scale );

lib/node_modules/@stdlib/complex/float32/base/scale/lib/assign.js

Lines changed: 3 additions & 3 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

2525

2626
// MAIN //
@@ -43,8 +43,8 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
4343
* // returns <Float32Array>[ 25.0, 15.0 ]
4444
*/
4545
function assign( alpha, re, im, out, strideOut, offsetOut ) {
46-
out[ offsetOut ] = float64ToFloat32( re * alpha );
47-
out[ offsetOut+strideOut ] = float64ToFloat32( im * alpha );
46+
out[ offsetOut ] = f32( re * alpha );
47+
out[ offsetOut+strideOut ] = f32( im * alpha );
4848
return out;
4949
}
5050

lib/node_modules/@stdlib/complex/float32/base/scale/lib/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
// MODULES //
2222

23+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2324
var Complex64 = require( '@stdlib/complex/float32/ctor' );
2425
var realf = require( '@stdlib/complex/float32/real' );
2526
var imagf = require( '@stdlib/complex/float32/imag' );
@@ -52,7 +53,7 @@ var imagf = require( '@stdlib/complex/float32/imag' );
5253
* // returns 15.0
5354
*/
5455
function scale( alpha, z ) {
55-
return new Complex64( realf( z ) * alpha, imagf( z ) * alpha );
56+
return new Complex64( f32( realf(z)*alpha ), f32( imagf(z)*alpha ) );
5657
}
5758

5859

lib/node_modules/@stdlib/complex/float32/base/scale/lib/strided.js

Lines changed: 3 additions & 3 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

2525

2626
// MAIN //
@@ -46,8 +46,8 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
4646
* // returns <Float32Array>[ 25.0, 15.0 ]
4747
*/
4848
function strided( alpha, z, strideZ, offsetZ, out, strideOut, offsetOut ) {
49-
out[ offsetOut ] = float64ToFloat32( alpha * z[ offsetZ ] );
50-
out[ offsetOut+strideOut ] = float64ToFloat32( alpha * z[ offsetZ+strideZ ] );
49+
out[ offsetOut ] = f32( alpha * z[ offsetZ ] );
50+
out[ offsetOut+strideOut ] = f32( alpha * z[ offsetZ+strideZ ] );
5151
return out;
5252
}
5353

lib/node_modules/@stdlib/complex/float32/base/scale/src/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
* #include "stdlib/complex/float32/real.h"
3333
* #include "stdlib/complex/float32/imag.h"
3434
*
35-
* stdlib_complex64_t z = stdlib_complex64( 5.0, 3.0 );
35+
* stdlib_complex64_t z = stdlib_complex64( 5.0f, 3.0f );
3636
*
37-
* stdlib_complex64_t out = stdlib_base_complex64_scale( 5.0, z );
37+
* stdlib_complex64_t out = stdlib_base_complex64_scale( 5.0f, z );
3838
*
3939
* float re = stdlib_complex64_real( out );
40-
* // returns 25.0
40+
* // returns 25.0f
4141
*
4242
* float im = stdlib_complex64_imag( out );
43-
* // returns 15.0
43+
* // returns 15.0f
4444
*/
4545
stdlib_complex64_t stdlib_base_complex64_scale( const float alpha, const stdlib_complex64_t z ) {
4646
float re;

lib/node_modules/@stdlib/complex/float32/base/scale/test/test.main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ tape( 'the function scales a complex number', function test( t ) {
5050
t.end();
5151
});
5252

53-
tape( 'if a realf or imagfinary component is `NaN`, the respective component is `NaN`', function test( t ) {
53+
tape( 'if a real or imaginary component is `NaN`, the respective component is `NaN`', function test( t ) {
5454
var c1;
5555
var v;
5656

0 commit comments

Comments
 (0)