Skip to content

Commit 6aa2286

Browse files
committed
chore: apply code suggestions
--- 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: na - 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: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent a5931b9 commit 6aa2286

File tree

11 files changed

+58
-44
lines changed

11 files changed

+58
-44
lines changed

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var sdsnanmeanors = require( '@stdlib/stats/base/sdsnanmeanors' );
5353

5454
#### sdsnanmeanors( N, x, strideX )
5555

56-
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array `x`, ignoring `NaN` values and using ordinary recursive summation with extended accumulation.
56+
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array, ignoring `NaN` values and using ordinary recursive summation with extended accumulation.
5757

5858
```javascript
5959
var Float32Array = require( '@stdlib/array/float32' );
@@ -69,7 +69,7 @@ The function has the following parameters:
6969

7070
- **N**: number of indexed elements.
7171
- **x**: input [`Float32Array`][@stdlib/array/float32].
72-
- **strideX**: index increment for `x`.
72+
- **strideX**: stride length for `x`.
7373

7474
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [arithmetic mean][arithmetic-mean] of every other element in `x`,
7575

@@ -178,10 +178,10 @@ console.log( v );
178178
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array, ignoring `NaN` values and using ordinary recursive summation with extended accumulation.
179179

180180
```c
181-
const float x[] = { 1.0, -2.0, 0.0/0.0, 2.0 };
181+
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
182182

183-
double v = stdlib_strided_sdsnanmeanors( x.length, x, 1 );
184-
// returns ~0.3333
183+
float v = stdlib_strided_sdsnanmeanors( x.length, x, 1 );
184+
// returns ~0.3333f
185185
```
186186
187187
The function accepts the following arguments:
@@ -191,18 +191,18 @@ The function accepts the following arguments:
191191
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
192192
193193
```c
194-
double stdlib_strided_sdsnanmeanors( const CBLAS_INT N, const double *X, const CBLAS_INT strideX );
194+
float stdlib_strided_sdsnanmeanors( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
195195
```
196196

197197
#### stdlib_strided_sdsnanmeanors_ndarray( N, \*X, strideX, offsetX )
198198

199199
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics.
200200

201201
```c
202-
const float x[] = { 1.0, -2.0, 0.0/0.0, 2.0 };
202+
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
203203

204-
double v = stdlib_strided_sdsnanmeanors_ndarray( x.length, x, 1, 0 );
205-
// returns ~0.3333
204+
float v = stdlib_strided_sdsnanmeanors_ndarray( x.length, x, 1, 0 );
205+
// returns ~0.3333f
206206
```
207207
208208
The function accepts the following arguments:
@@ -213,7 +213,7 @@ The function accepts the following arguments:
213213
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
214214
215215
```c
216-
double stdlib_strided_sdsnanmeanors_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
216+
float stdlib_strided_sdsnanmeanors_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
217217
```
218218

219219
</section>
@@ -240,7 +240,7 @@ double stdlib_strided_sdsnanmeanors_ndarray( const CBLAS_INT N, const double *X,
240240

241241
int main( void ) {
242242
// Create a strided array:
243-
const float x[] = { 1.0, 2.0, 0.0/0.0, 3.0, 0.0/0.0, 4.0, 5.0, 6.0, 0.0/0.0, 7.0, 8.0, 0.0/0.0 };
243+
const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 3.0f, 0.0f/0.0f, 4.0f, 5.0f, 6.0f, 0.0f/0.0f, 7.0f, 8.0f, 0.0f/0.0f };
244244

245245
// Specify the number of elements:
246246
const int N = 6;
@@ -249,10 +249,10 @@ int main( void ) {
249249
const int strideX = 2;
250250

251251
// Compute the arithmetic mean:
252-
double v = stdlib_strided_sdsnanmeanors( N, x, strideX );
252+
float v = stdlib_strided_sdsnanmeanors( N, x, strideX );
253253

254254
// Print the result:
255-
printf( "mean: %lf\n", v );
255+
printf( "mean: %f\n", v );
256256
}
257257
```
258258

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/examples/c/example.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
int main( void ) {
2323
// Create a strided array:
24-
const float x[] = { 1.0, 2.0, 0.0/0.0, 3.0, 0.0/0.0, 4.0, 5.0, 6.0, 0.0/0.0, 7.0, 8.0, 0.0/0.0 };
24+
const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 3.0f, 0.0f/0.0f, 4.0f, 5.0f, 6.0f, 0.0f/0.0f, 7.0f, 8.0f, 0.0f/0.0f };
2525

2626
// Specify the number of elements:
2727
const int N = 6;

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/include/stdlib/stats/base/sdsnanmeanors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ extern "C" {
3131
/**
3232
* Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values and using ordinary recursive summation with extended accumulation.
3333
*/
34-
double API_SUFFIX( stdlib_strided_sdsnanmeanors )( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
34+
float API_SUFFIX(stdlib_strided_sdsnanmeanors)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
3535

3636
/**
3737
* Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics.
3838
*/
39-
double API_SUFFIX( stdlib_strided_sdsnanmeanors_ndarray )( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
39+
float API_SUFFIX(stdlib_strided_sdsnanmeanors_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
4040

4141
#ifdef __cplusplus
4242
}

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/lib/ndarray.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var addon = require( './../src/addon.node' );
4040
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN ] );
4141
*
4242
* var v = sdsnanmeanors( 4, x, 2, 1 );
43-
* //returns 1.25
43+
* //returns 1.25
4444
*/
4545
function sdsnanmeanors( N, x, strideX, offsetX ) {
4646
return addon.ndarray( N, x, strideX, offsetX );

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/lib/sdsnanmeanors.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ var ndarray = require( './ndarray.js' );
4343
* // returns ~0.3333
4444
*/
4545
function sdsnanmeanors( N, x, strideX ) {
46-
var ox = stride2offset( N, strideX );
47-
return ndarray( N, x, strideX, ox );
46+
return ndarray( N, x, strideX, stride2offset( N, strideX ) );
4847
}
4948

5049

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/lib/sdsnanmeanors.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var addon = require( './../src/addon.node' );
3939
* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
4040
*
4141
* var v = sdsnanmeanors( x.length, x, 1 );
42-
* //returns ~0.3333
42+
* //returns ~0.3333
4343
*/
4444
function sdsnanmeanors( N, x, strideX ) {
4545
return addon( N, x, strideX );

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/manifest.json

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"options": {
3-
"task": "build"
3+
"task": "build",
4+
"wasm": false
45
},
56
"fields": [
67
{
@@ -27,61 +28,75 @@
2728
"confs": [
2829
{
2930
"task": "build",
31+
"wasm": false,
3032
"src": [
3133
"./src/main.c"
3234
],
3335
"include": [
3436
"./include"
3537
],
36-
"libraries": [
37-
"-lm"
38-
],
38+
"libraries": [],
3939
"libpath": [],
4040
"dependencies": [
41+
"@stdlib/blas/base/shared",
42+
"@stdlib/strided/base/stride2offset",
43+
"@stdlib/math/base/assert/is-nan",
4144
"@stdlib/napi/export",
4245
"@stdlib/napi/argv",
4346
"@stdlib/napi/argv-int64",
4447
"@stdlib/napi/argv-strided-float32array",
45-
"@stdlib/blas/base/shared",
46-
"@stdlib/math/base/assert/is-nan",
47-
"@stdlib/strided/base/stride2offset",
4848
"@stdlib/napi/create-double"
4949
]
5050
},
5151
{
5252
"task": "benchmark",
53+
"wasm": false,
5354
"src": [
5455
"./src/main.c"
5556
],
5657
"include": [
5758
"./include"
5859
],
59-
"libraries": [
60-
"-lm"
61-
],
60+
"libraries": [],
6261
"libpath": [],
6362
"dependencies": [
6463
"@stdlib/blas/base/shared",
65-
"@stdlib/math/base/assert/is-nan",
66-
"@stdlib/strided/base/stride2offset"
64+
"@stdlib/strided/base/stride2offset",
65+
"@stdlib/math/base/assert/is-nan"
6766
]
6867
},
6968
{
7069
"task": "examples",
70+
"wasm": false,
7171
"src": [
7272
"./src/main.c"
7373
],
7474
"include": [
7575
"./include"
7676
],
77-
"libraries": [
78-
"-lm"
77+
"libraries": [],
78+
"libpath": [],
79+
"dependencies": [
80+
"@stdlib/blas/base/shared",
81+
"@stdlib/strided/base/stride2offset",
82+
"@stdlib/math/base/assert/is-nan"
83+
]
84+
},
85+
{
86+
"task": "",
87+
"wasm": true,
88+
"src": [
89+
"./src/main.c"
90+
],
91+
"include": [
92+
"./include"
7993
],
94+
"libraries": [],
8095
"libpath": [],
8196
"dependencies": [
8297
"@stdlib/blas/base/shared",
83-
"@stdlib/math/base/assert/is-nan",
84-
"@stdlib/strided/base/stride2offset"
98+
"@stdlib/strided/base/stride2offset",
99+
"@stdlib/math/base/assert/is-nan"
85100
]
86101
}
87102
]

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/src/addon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
3737
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
3838
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
3939
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
40-
STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX( stdlib_strided_sdsnanmeanors )( N, X, strideX ), v );
40+
STDLIB_NAPI_CREATE_DOUBLE( env, (double)API_SUFFIX(stdlib_strided_sdsnanmeanors)( N, X, strideX ), v );
4141
return v;
4242
}
4343

@@ -54,7 +54,7 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) {
5454
STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 );
5555
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
5656
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
57-
STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX( stdlib_strided_sdsnanmeanors_ndarray )( N, X, strideX, offsetX ), v );
57+
STDLIB_NAPI_CREATE_DOUBLE( env, (double)API_SUFFIX(stdlib_strided_sdsnanmeanors_ndarray)( N, X, strideX, offsetX ), v );
5858
return v;
5959
}
6060

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @param strideX stride length
3030
* @return output value
3131
*/
32-
double API_SUFFIX( stdlib_strided_sdsnanmeanors )( const CBLAS_INT N, const float *X, const CBLAS_INT strideX ) {
32+
float API_SUFFIX(stdlib_strided_sdsnanmeanors)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX ) {
3333
const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
3434
return API_SUFFIX( stdlib_strided_sdsnanmeanors_ndarray )( N, X, strideX, ox );
3535
}
@@ -42,7 +42,7 @@ double API_SUFFIX( stdlib_strided_sdsnanmeanors )( const CBLAS_INT N, const floa
4242
* @param offsetX starting index for X
4343
* @return output value
4444
*/
45-
double API_SUFFIX( stdlib_strided_sdsnanmeanors_ndarray )( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
45+
float API_SUFFIX(stdlib_strided_sdsnanmeanors_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
4646
double sum;
4747
CBLAS_INT ix;
4848
CBLAS_INT i;

lib/node_modules/@stdlib/stats/base/sdsnanmeanors/test/test.sdsnanmeanors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ tape( 'the function calculates the arithmetic mean of a strided array, ignoring
6161
t.end();
6262
});
6363

64-
tape( 'if provided an `4` parameter less than or equal to `0`, the function returns `NaN`', function test( t ) {
64+
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `NaN`', function test( t ) {
6565
var x;
6666
var v;
6767

@@ -76,7 +76,7 @@ tape( 'if provided an `4` parameter less than or equal to `0`, the function retu
7676
t.end();
7777
});
7878

79-
tape( 'if provided an `4` parameter equal to `1`, the function returns the first element', function test( t ) {
79+
tape( 'if provided an `N` parameter equal to `1`, the function returns the first element', function test( t ) {
8080
var x;
8181
var v;
8282

0 commit comments

Comments
 (0)