You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,26 @@
4
4
5
5
<sectionclass="release"id="unreleased">
6
6
7
-
## Unreleased (2025-06-08)
7
+
## Unreleased (2025-06-29)
8
+
9
+
<sectionclass="features">
10
+
11
+
### Features
12
+
13
+
-[`7e5c88b`](https://github.com/stdlib-js/stdlib/commit/7e5c88b980808074354a672c930472eb56130b7d) - add C ndarray interface and refactor implementation for `stats/base/smeankbn`[(#7494)](https://github.com/stdlib-js/stdlib/pull/7494)
14
+
15
+
</section>
16
+
17
+
<!-- /.features -->
8
18
9
19
<sectionclass="commits">
10
20
11
21
### Commits
12
22
13
23
<details>
14
24
25
+
-[`7e5c88b`](https://github.com/stdlib-js/stdlib/commit/7e5c88b980808074354a672c930472eb56130b7d) - **feat:** add C ndarray interface and refactor implementation for `stats/base/smeankbn`[(#7494)](https://github.com/stdlib-js/stdlib/pull/7494)_(by Gururaj Gurram, stdlib-bot)_
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [arithmetic mean][arithmetic-mean] of every other element in `x`,
106
+
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`,
var x1 =newFloat32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
130
126
131
-
varN=floor( x0.length/2 );
132
-
133
-
var v =smeankbn( N, x1, 2 );
127
+
var v =smeankbn( 4, x1, 2 );
134
128
// returns 1.25
135
129
```
136
130
137
-
#### smeankbn.ndarray( N, x, stride, offset )
131
+
#### smeankbn.ndarray( N, x, strideX, offsetX )
138
132
139
133
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array using an improved Kahan–Babuška algorithm and alternative indexing semantics.
The function has the following additional parameters:
152
145
153
-
-**offset**: starting index for `x`.
146
+
-**offsetX**: starting index for `x`.
154
147
155
-
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
148
+
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
var discreteUniform =require( '@stdlib/random-array-discrete-uniform' );
192
181
var smeankbn =require( '@stdlib/stats-base-smeankbn' );
193
182
194
-
var x;
195
-
var i;
196
-
197
-
x =newFloat32Array( 10 );
198
-
for ( i =0; i <x.length; i++ ) {
199
-
x[ i ] =round( (randu()*100.0) -50.0 );
200
-
}
183
+
var x =discreteUniform( 10, -50, 50, {
184
+
'dtype':'float32'
185
+
});
201
186
console.log( x );
202
187
203
188
var v =smeankbn( x.length, x, 1 );
@@ -208,6 +193,123 @@ console.log( v );
208
193
209
194
<!-- /.examples -->
210
195
196
+
<!-- C interface documentation. -->
197
+
198
+
* * *
199
+
200
+
<sectionclass="c">
201
+
202
+
## C APIs
203
+
204
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
205
+
206
+
<sectionclass="intro">
207
+
208
+
</section>
209
+
210
+
<!-- /.intro -->
211
+
212
+
<!-- C usage documentation. -->
213
+
214
+
<sectionclass="usage">
215
+
216
+
### Usage
217
+
218
+
```c
219
+
#include"stdlib/stats/base/smeankbn.h"
220
+
```
221
+
222
+
#### stdlib_strided_smeankbn( N, \*X, strideX )
223
+
224
+
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array using an improved Kahan–Babuška algorithm.
#### stdlib_strided_smeankbn_ndarray( N, \*X, strideX, offsetX )
244
+
245
+
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array using an improved Kahan–Babuška algorithm and alternative indexing semantics.
float v = stdlib_strided_smeankbn( N, x, strideX );
299
+
300
+
// Print the result:
301
+
printf( "mean: %f\n", v );
302
+
}
303
+
```
304
+
305
+
</section>
306
+
307
+
<!-- /.examples -->
308
+
309
+
</section>
310
+
311
+
<!-- /.c -->
312
+
211
313
* * *
212
314
213
315
<section class="references">
@@ -229,7 +331,7 @@ console.log( v );
229
331
## See Also
230
332
231
333
- <span class="package-name">[`@stdlib/stats-strided/dmeankbn`][@stdlib/stats/strided/dmeankbn]</span><span class="delimiter">: </span><span class="description">calculate the arithmetic mean of a double-precision floating-point strided array using an improved Kahan–Babuška algorithm.</span>
232
-
- <spanclass="package-name">[`@stdlib/stats-base/meankbn`][@stdlib/stats/base/meankbn]</span><spanclass="delimiter">: </span><spanclass="description">calculate the arithmetic mean of a strided array using an improved Kahan–Babuška algorithm.</span>
334
+
- <span class="package-name">[`@stdlib/stats-strided/meankbn`][@stdlib/stats/strided/meankbn]</span><span class="delimiter">: </span><span class="description">calculate the arithmetic mean of a strided array using an improved Kahan–Babuška algorithm.</span>
233
335
- <span class="package-name">[`@stdlib/stats-strided/smean`][@stdlib/stats/strided/smean]</span><span class="delimiter">: </span><span class="description">calculate the arithmetic mean of a single-precision floating-point strided array.</span>
0 commit comments