Skip to content

Commit a43136e

Browse files
chore: applying changes from code review
1 parent e21465f commit a43136e

File tree

7 files changed

+28
-38
lines changed

7 files changed

+28
-38
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ console.log( v );
180180

181181
#### stdlib_strided_dsmeanors( N, \*X, strideX )
182182

183-
Calculate the mean value of a single-precision floating-point strided array, ignoring `NaN` values.
183+
Computes the arithmetic mean of a single-precision floating-point strided array `x` using ordinary recursive summation with extended accumulation and returning an extended precision result.
184184

185185
```c
186186
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
187187

188-
float v = stdlib_strided_dsmeanors( 4, x, 2 );
188+
double v = stdlib_strided_dsmeanors( 4, x, 2 );
189189
// returns 1.25
190190
```
191191
@@ -196,17 +196,17 @@ The function accepts the following arguments:
196196
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
197197
198198
```c
199-
float stdlib_strided_dsmeanors( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
199+
double stdlib_strided_dsmeanors( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
200200
```
201201

202202
#### stdlib_strided_dsmeanors_ndarray( N, \*X, strideX, offsetX )
203203

204-
Computes the mean value of a single-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
204+
Computes the arithmetic mean of a single-precision floating-point strided array using ordinary recursive summation with extended accumulation and alternative indexing semantics and returning an extended precision result.
205205

206206
```c
207207
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
208208

209-
float v = stdlib_strided_dsmeanors_ndarray( 4, x, 2, 0 );
209+
double v = stdlib_strided_dsmeanors_ndarray( 4, x, 2, 0 );
210210
// returns 1.25
211211
```
212212
@@ -241,7 +241,6 @@ double stdlib_strided_dsmeanors_ndarray( const CBLAS_INT N, const float *X, cons
241241

242242
```c
243243
#include "stdlib/stats/base/dsmeanors.h"
244-
#include <stdint.h>
245244
#include <stdio.h>
246245

247246
int main( void ) {
@@ -255,7 +254,7 @@ int main( void ) {
255254
const int strideX = 2;
256255

257256
// Compute the arithmetic mean:
258-
float v = stdlib_strided_dsmeanors( N, x, strideX );
257+
double v = stdlib_strided_dsmeanors( N, x, strideX );
259258

260259
// Print the result:
261260
printf( "mean: %lf\n", v );

lib/node_modules/@stdlib/stats/base/dsmeanors/benchmark/c/benchmark.length.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ static float rand_float( void ) {
9797
static double benchmark1( int iterations, int len ) {
9898
double elapsed;
9999
float x[ len ];
100-
float v;
100+
double v;
101101
double t;
102102
int i;
103103

104104
for ( i = 0; i < len; i++ ) {
105105
x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
106106
}
107-
v = 0.0f;
107+
v = 0.0;
108108
t = tic();
109109
for ( i = 0; i < iterations; i++ ) {
110110
// cppcheck-suppress uninitvar
@@ -131,14 +131,14 @@ static double benchmark1( int iterations, int len ) {
131131
static double benchmark2( int iterations, int len ) {
132132
double elapsed;
133133
float x[ len ];
134-
float v;
134+
double v;
135135
double t;
136136
int i;
137137

138138
for ( i = 0; i < len; i++ ) {
139139
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
140140
}
141-
v = 0.0f;
141+
v = 0.0;
142142
t = tic();
143143
for ( i = 0; i < iterations; i++ ) {
144144
// cppcheck-suppress uninitvar

lib/node_modules/@stdlib/stats/base/dsmeanors/docs/repl.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
array using ordinary recursive summation with extended accumulation and
55
returning an extended precision result.
66

7-
The `N` and stride parameters determine which elements in `x` are accessed
8-
at runtime.
7+
The `N` and stride parameters determine which elements in the strided array
8+
are accessed at runtime.
99

1010
Indexing is relative to the first index. To introduce an offset, use a typed
1111
array view.
@@ -21,7 +21,7 @@
2121
Input array.
2222

2323
strideX: integer
24-
Stride Length.
24+
Stride length.
2525

2626
Returns
2727
-------
@@ -37,14 +37,14 @@
3737

3838
// Using `N` and stride parameters:
3939
> x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
40-
> {{alias}}( 4, x, 2 )
41-
NaN
40+
> {{alias}}( 3, x, 2 )
41+
~0.333
4242

4343
// Using view offsets:
4444
> var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
4545
> var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
46-
> {{alias}}( 4, x1, 2 )
47-
NaN
46+
> {{alias}}( 3, x1, 2 )
47+
~-0.333
4848

4949

5050
{{alias}}.ndarray( N, x, strideX, offsetX )
@@ -65,7 +65,7 @@
6565
Input array.
6666

6767
strideX: integer
68-
Stride Length.
68+
Stride length.
6969

7070
offsetX: integer
7171
Starting index.
@@ -84,8 +84,8 @@
8484

8585
// Using offset parameter:
8686
> var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
87-
> {{alias}}.ndarray( 4, x, 2, 1 )
88-
NaN
87+
> {{alias}}.ndarray( 3, x, 2, 1 )
88+
~-0.3333
8989

9090
See Also
9191
--------

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818

1919
#include "stdlib/stats/base/dsmeanors.h"
20-
#include <stdint.h>
2120
#include <stdio.h>
2221

2322
int main( void ) {
@@ -31,7 +30,7 @@ int main( void ) {
3130
const int strideX = 2;
3231

3332
// Compute the arithmetic mean:
34-
float v = stdlib_strided_dsmeanors( N, x, strideX );
33+
double v = stdlib_strided_dsmeanors( N, x, strideX );
3534

3635
// Print the result:
3736
printf( "mean: %lf\n", v );

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ extern "C" {
2929
#endif
3030

3131
/**
32-
* Computes the arithmetic mean of a single-precision floating-point strided array using ordinary recursive summation with extended accumulation and returning an extended precision result.
32+
* Computes the arithmetic mean of a single-precision floating-point strided array `x` using ordinary recursive summation with extended accumulation and returning an extended precision result.
3333
*/
3434
double API_SUFFIX(stdlib_strided_dsmeanors)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
3535

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

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
"dependencies": [
4141
"@stdlib/blas/base/shared",
4242
"@stdlib/strided/base/stride2offset",
43-
"@stdlib/math/base/assert/is-positive-zero",
44-
"@stdlib/math/base/assert/is-nan",
4543
"@stdlib/blas/ext/base/dssumors",
4644
"@stdlib/napi/export",
4745
"@stdlib/napi/argv",
@@ -64,8 +62,6 @@
6462
"dependencies": [
6563
"@stdlib/blas/base/shared",
6664
"@stdlib/strided/base/stride2offset",
67-
"@stdlib/math/base/assert/is-nan",
68-
"@stdlib/math/base/assert/is-positive-zero",
6965
"@stdlib/blas/ext/base/dssumors"
7066
]
7167
},
@@ -83,8 +79,6 @@
8379
"dependencies": [
8480
"@stdlib/blas/base/shared",
8581
"@stdlib/strided/base/stride2offset",
86-
"@stdlib/math/base/assert/is-nan",
87-
"@stdlib/math/base/assert/is-positive-zero",
8882
"@stdlib/blas/ext/base/dssumors"
8983
]
9084
},
@@ -102,8 +96,6 @@
10296
"dependencies": [
10397
"@stdlib/blas/base/shared",
10498
"@stdlib/strided/base/stride2offset",
105-
"@stdlib/math/base/assert/is-nan",
106-
"@stdlib/math/base/assert/is-positive-zero",
10799
"@stdlib/blas/ext/base/dssumors"
108100
]
109101
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@
2323
#include <stdint.h>
2424

2525
/**
26-
* Computes the arithmetic mean of a single-precision floating-point strided array using ordinary recursive summation with extended accumulation and returning an extended precision result.
26+
* Computes the arithmetic mean of a single-precision floating-point strided array `x` using ordinary recursive summation with extended accumulation and returning an extended precision result.
2727
*
28-
* @param N number of indexed elements
29-
* @param X input array
28+
* @param N number of indexed elements
29+
* @param X input array
3030
* @param strideX stride length
31-
* @return output value
31+
* @return output value
3232
*/
3333
double API_SUFFIX(stdlib_strided_dsmeanors)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX ) {
3434
const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
3535
return API_SUFFIX(stdlib_strided_dsmeanors_ndarray)( N, X, strideX, ox );
3636
}
3737

3838
/**
39-
* Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
39+
* Computes the arithmetic mean of a single-precision floating-point strided array using ordinary recursive summation with extended accumulation and alternative indexing semantics and returning an extended precision result.
4040
*
4141
* @param N number of indexed elements
4242
* @param X input array

0 commit comments

Comments
 (0)