Skip to content

Commit 6908a9f

Browse files
fix: updating files
1 parent 09fd346 commit 6908a9f

File tree

12 files changed

+325
-26
lines changed

12 files changed

+325
-26
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ The function has the following additional parameters:
104104

105105
- **offsetX**: starting index for `x`.
106106

107-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to calculate the [arithmetic mean][arithmetic-mean] for every other value in `x` starting from the second value
107+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to calculate the [arithmetic mean][arithmetic-mean] for every other element in `x` starting from the second element
108108

109109
```javascript
110110
var Float32Array = require( '@stdlib/array/float32' );
@@ -168,12 +168,12 @@ console.log( v );
168168

169169
#### stdlib_strided_dsmean( N, \*X, strideX )
170170

171-
Calculate the Arithmetic Mean value of a double-precision floating-point strided array, ignoring `NaN` values.
171+
Computes the arithmetic mean of a single-precision floating-point strided array `x` using extended accumulation and returning an extended precision result.
172172

173173
```c
174174
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 0.0/0.0, 0.0/0.0 };
175175

176-
double v = stdlib_strided_dsmean( 5, x, 2 );
176+
double v = stdlib_strided_dsmean( 4, x, 2 );
177177
// returns 1.25
178178
```
179179
@@ -189,12 +189,12 @@ double stdlib_strided_dsmean( const CBLAS_INT N, const double *X, const CBLAS_IN
189189

190190
#### stdlib_strided_dsmean_ndarray( N, \*X, strideX, offsetX )
191191

192-
Computes the Arithmetic Mean value of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
192+
Computes the arithmetic mean of a single-precision floating-point strided array `x` using extended accumulation and alternative indexing semantics and returning an extended precision result.
193193

194194
```c
195195
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 0.0/0.0, 0.0/0.0 };
196196

197-
double v = stdlib_strided_dsmean_ndarray( 5, x, 2, 0 );
197+
double v = stdlib_strided_dsmean_ndarray( 4, x, 2, 0 );
198198
// returns 1.25
199199
```
200200

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Input array.
2222

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

2626
Returns
2727
-------
@@ -53,7 +53,7 @@
5353
returning an extended precision result.
5454

5555
While typed array views mandate a view offset based on the underlying
56-
buffer, the `offset` parameter supports indexing semantics based on a
56+
buffer, the offset parameter supports indexing semantics based on a
5757
starting index.
5858

5959
Parameters
@@ -65,7 +65,7 @@
6565
Input array.
6666

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

7070
offsetX: integer
7171
Starting index.

lib/node_modules/@stdlib/stats/base/dsmean/include/stdlib/stats/base/dsmean.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 extended accumulation and returning an extended precision result.
32+
* Computes the arithmetic mean of a single-precision floating-point strided array `x` using extended accumulation and returning an extended precision result.
3333
*/
3434
double API_SUFFIX(stdlib_strided_dsmean)( 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 of a single-precision floating-point strided array `x` using extended accumulation and alternative indexing semantics and returning an extended precision result.
3838
*/
3939
double API_SUFFIX(stdlib_strided_dsmean_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
4040

lib/node_modules/@stdlib/stats/base/dsmean/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*
4040
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
4141
*
42-
* var v = dsmean.ndarray( 5, x, 2, 1 );
42+
* var v = dsmean.ndarray( 4, x, 2, 1 );
4343
* // returns 1.25
4444
*/
4545

lib/node_modules/@stdlib/stats/base/dsmean/lib/ndarray.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ var dsmeanpn = require( '@stdlib/stats/base/dsmeanpn' ).ndarray;
3838
* var Float32Array = require( '@stdlib/array/float32' );
3939
*
4040
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
41+
*
42+
* var v = dsmean( N, x, 2, 1 );
43+
* // returns 1.25
4144
*/
4245
function dsmean( N, x, strideX, offsetX ) {
4346
return dsmeanpn( N, x, strideX, offsetX );

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ var addon = require( './../src/addon.node' );
3838
* var Float32Array = require( '@stdlib/array/float32' );
3939
*
4040
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
41+
*
42+
* var v = dsmean( 4, x, 2, 1 );
43+
* // returns 1.25
4144
*/
4245
function dsmean( N, x, strideX, offsetX ) {
4346
return addon.ndarray( N, x, strideX, offsetX );

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

Lines changed: 3 additions & 14 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/stats/base/dsmeanpn",
4644
"@stdlib/napi/export",
4745
"@stdlib/napi/argv",
@@ -63,10 +61,7 @@
6361
"libpath": [],
6462
"dependencies": [
6563
"@stdlib/blas/base/shared",
66-
"@stdlib/strided/base/stride2offset",
67-
"@stdlib/math/base/assert/is-nan",
68-
"@stdlib/math/base/assert/is-positive-zero",
69-
"@stdlib/stats/base/dsmeanpn"
64+
"@stdlib/strided/base/stride2offset"
7065
]
7166
},
7267
{
@@ -82,10 +77,7 @@
8277
"libpath": [],
8378
"dependencies": [
8479
"@stdlib/blas/base/shared",
85-
"@stdlib/strided/base/stride2offset",
86-
"@stdlib/math/base/assert/is-nan",
87-
"@stdlib/math/base/assert/is-positive-zero",
88-
"@stdlib/stats/base/dsmeanpn"
80+
"@stdlib/strided/base/stride2offset"
8981
]
9082
},
9183
{
@@ -101,10 +93,7 @@
10193
"libpath": [],
10294
"dependencies": [
10395
"@stdlib/blas/base/shared",
104-
"@stdlib/strided/base/stride2offset",
105-
"@stdlib/math/base/assert/is-nan",
106-
"@stdlib/math/base/assert/is-positive-zero",
107-
"@stdlib/stats/base/dsmeanpn"
96+
"@stdlib/strided/base/stride2offset"
10897
]
10998
}
11099
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ double API_SUFFIX(stdlib_strided_dsmean)( const CBLAS_INT N, const float *X, con
3535
}
3636

3737
/**
38-
* Computes the maximum value of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
38+
* Computes the arithmetic mean of a single-precision floating-point strided array using extended accumulation and alternative indexing semantics and returning an extended precision result.
3939
*
4040
* @param N number of indexed elements
4141
* @param X input array

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

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,78 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
8484

8585
t.end();
8686
});
87+
88+
tape( 'the function supports a `stride` parameter', function test( t ) {
89+
var x;
90+
var v;
91+
92+
x = new Float32Array([
93+
1.0, // 0
94+
2.0,
95+
2.0, // 1
96+
-7.0,
97+
-2.0, // 2
98+
3.0,
99+
4.0, // 3
100+
2.0
101+
]);
102+
103+
v = dsmean( 4, x, 2, 0 );
104+
105+
t.strictEqual( v, 1.25, 'returns expected value' );
106+
t.end();
107+
});
108+
109+
tape( 'the function supports a negative `stride` parameter', function test( t ) {
110+
var x;
111+
var v;
112+
113+
x = new Float32Array([
114+
1.0, // 3
115+
2.0,
116+
2.0, // 2
117+
-7.0,
118+
-2.0, // 1
119+
3.0,
120+
4.0, // 0
121+
2.0
122+
]);
123+
124+
v = dsmean( 4, x, -2, 6 );
125+
126+
t.strictEqual( v, 1.25, 'returns expected value' );
127+
t.end();
128+
});
129+
130+
tape( 'if provided a `stride` parameter equal to `0`, the function returns the first indexed element', function test( t ) {
131+
var x;
132+
var v;
133+
134+
x = new Float32Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] );
135+
136+
v = dsmean( x.length, x, 0, 0 );
137+
t.strictEqual( v, 1.0, 'returns expected value' );
138+
139+
t.end();
140+
});
141+
142+
tape( 'the function supports an `offset` parameter', function test( t ) {
143+
var x;
144+
var v;
145+
146+
x = new Float32Array([
147+
2.0,
148+
1.0, // 0
149+
2.0,
150+
-2.0, // 1
151+
-2.0,
152+
2.0, // 2
153+
3.0,
154+
4.0 // 3
155+
]);
156+
157+
v = dsmean( 4, x, 2, 1 );
158+
t.strictEqual( v, 1.25, 'returns expected value' );
159+
160+
t.end();
161+
});

lib/node_modules/@stdlib/stats/base/dsmean/test/test.dsmean.native.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,82 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
175175

176176
t.end();
177177
});
178+
179+
tape( 'the function supports a `stride` parameter', opts, function test( t ) {
180+
var x;
181+
var v;
182+
183+
x = new Float32Array([
184+
1.0, // 0
185+
2.0,
186+
2.0, // 1
187+
-7.0,
188+
-2.0, // 2
189+
3.0,
190+
4.0, // 3
191+
2.0
192+
]);
193+
194+
v = dsmean( 4, x, 2 );
195+
196+
t.strictEqual( v, 1.25, 'returns expected value' );
197+
t.end();
198+
});
199+
200+
tape( 'the function supports a negative `stride` parameter', opts, function test( t ) {
201+
var x;
202+
var v;
203+
204+
x = new Float32Array([
205+
1.0, // 3
206+
2.0,
207+
2.0, // 2
208+
-7.0,
209+
-2.0, // 1
210+
3.0,
211+
4.0, // 0
212+
2.0
213+
]);
214+
215+
v = dsmean( 4, x, -2 );
216+
217+
t.strictEqual( v, 1.25, 'returns expected value' );
218+
t.end();
219+
});
220+
221+
tape( 'if provided a `stride` parameter equal to `0`, the function returns the first element', opts, function test( t ) {
222+
var x;
223+
var v;
224+
225+
x = new Float32Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] );
226+
227+
v = dsmean( x.length, x, 0 );
228+
t.strictEqual( v, 1.0, 'returns expected value' );
229+
230+
t.end();
231+
});
232+
233+
tape( 'the function supports view offsets', opts, function test( t ) {
234+
var x0;
235+
var x1;
236+
var v;
237+
238+
x0 = new Float32Array([
239+
2.0,
240+
1.0, // 0
241+
2.0,
242+
-2.0, // 1
243+
-2.0,
244+
2.0, // 2
245+
3.0,
246+
4.0, // 3
247+
6.0
248+
]);
249+
250+
x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
251+
252+
v = dsmean( 4, x1, 2 );
253+
t.strictEqual( v, 1.25, 'returns expected value' );
254+
255+
t.end();
256+
});

0 commit comments

Comments
 (0)