Skip to content

Commit 1a827fc

Browse files
committed
Auto-generated commit
1 parent 210b4e3 commit 1a827fc

27 files changed

Lines changed: 382 additions & 234 deletions

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-03-29)
7+
## Unreleased (2025-04-25)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`5d94f92`](https://github.com/stdlib-js/stdlib/commit/5d94f9213500163957b30ea3ad36df4c141a5d41) - add C ndarray interface and refactor implementation for `stats/base/dsempn` [(#6785)](https://github.com/stdlib-js/stdlib/pull/6785)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`5d94f92`](https://github.com/stdlib-js/stdlib/commit/5d94f9213500163957b30ea3ad36df4c141a5d41) - **feat:** add C ndarray interface and refactor implementation for `stats/base/dsempn` [(#6785)](https://github.com/stdlib-js/stdlib/pull/6785) _(by Gururaj Gurram, Athan Reines, stdlib-bot)_
1526
- [`4b639f0`](https://github.com/stdlib-js/stdlib/commit/4b639f0bfee0b847a562dca5dd9e79a5c5b090fe) - **refactor:** update paths _(by Aayush Khanna)_
1627
- [`4df836a`](https://github.com/stdlib-js/stdlib/commit/4df836acfee5e6f359fc5d15a31ee9f6ef4237f0) - **refactor:** update paths _(by Aayush Khanna)_
1728
- [`1aa3235`](https://github.com/stdlib-js/stdlib/commit/1aa32350750b13ce35e6cbaf61e48e43dd004548) - **refactor:** update `stats/base/dsempn` native addon from C++ to C [(#4222)](https://github.com/stdlib-js/stdlib/pull/4222) _(by Vivek Maurya)_
@@ -30,10 +41,11 @@
3041

3142
### Contributors
3243

33-
A total of 4 people contributed to this release. Thank you to the following contributors:
44+
A total of 5 people contributed to this release. Thank you to the following contributors:
3445

3546
- Aayush Khanna
3647
- Athan Reines
48+
- Gururaj Gurram
3749
- Philipp Burckhardt
3850
- Vivek Maurya
3951

CONTRIBUTORS

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ Dev Goel <135586571+corsairier@users.noreply.github.com>
4343
Dhanyabad behera <110620935+dhanyabad11@users.noreply.github.com>
4444
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
4545
Dhruvil Mehta <68022411+dhruvilmehta@users.noreply.github.com>
46+
Dipjyoti Das <126075231+dipexplorer@users.noreply.github.com>
4647
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
4748
Dominic Lim <46486515+domlimm@users.noreply.github.com>
4849
Dominik Moritz <domoritz@gmail.com>
4950
Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com>
5051
EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
5152
Frank Kovacs <fran70kk@gmail.com>
5253
GK Bishnoi <gkishan1kyt@gmail.com>
54+
GURU PRASAD SHARMA <168292003+GURUPRASADSHARMA@users.noreply.github.com>
5355
Gaurav <gaurav70380@gmail.com>
5456
Gautam sharma <gautamkrishnasharma1@gmail.com>
5557
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
@@ -75,7 +77,8 @@ Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
7577
Joris Labie <joris.labie1@gmail.com>
7678
Justin Dennison <justin1dennison@gmail.com>
7779
Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
78-
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
80+
Karan Anand <anandkarancompsci@gmail.com>
81+
Karan Yadav <77043443+karanBRAVO@users.noreply.github.com>
7982
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
8083
Kaushikgtm <162317291+Kaushikgtm@users.noreply.github.com>
8184
Kavyansh-Bagdi <153486713+Kavyansh-Bagdi@users.noreply.github.com>
@@ -85,6 +88,7 @@ Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
8588
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
8689
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
8790
MANI <77221000+Eternity0207@users.noreply.github.com>
91+
Mahfuza Humayra Mohona <mhmohona@gmail.com>
8892
Manik Sharma <maniksharma.rke@gmail.com>
8993
Manvith M <148960168+manvith2003@users.noreply.github.com>
9094
Marcus Fantham <mfantham@users.noreply.github.com>
@@ -95,10 +99,14 @@ Mohammad Bin Aftab <48010758+MohammadBinAftab@users.noreply.github.com>
9599
Mohammad Kaif <mdkaifprofession@gmail.com>
96100
Momtchil Momtchev <momtchil@momtchev.com>
97101
Muhammad Haris <harriskhan047@outlook.com>
102+
Muhammad Taaha Tariq <166188821+Taaha-Tariq@users.noreply.github.com>
103+
Muhmmad Saad <106260977+saad-imran-dev@users.noreply.github.com>
98104
Naresh Jagadeesan <naresh.naresh000@gmail.com>
99105
Naveen Kumar <stupiddint@gmail.com>
100106
Neeraj Pathak <neerajrpathak710@gmail.com>
107+
NirvedMishra <139633597+NirvedMishra@users.noreply.github.com>
101108
Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
109+
Nishant singh <38534128+Nishantsingh11@users.noreply.github.com>
102110
Nishchay Rajput <121144841+NishchayRajput@users.noreply.github.com>
103111
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
104112
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
@@ -111,8 +119,10 @@ Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
111119
Pranav Goswami <pranavchiku11@gmail.com>
112120
Pranjal Jha <97080887+PraneGIT@users.noreply.github.com>
113121
Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com>
122+
PrathamBhamare <164445568+PrathamBhamare@users.noreply.github.com>
114123
Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
115124
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
125+
Pravesh Kunwar <praveshkunwar04@gmail.com>
116126
Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
117127
Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
118128
Pulkit Gupta <65711278+pulkitgupta2@users.noreply.github.com>
@@ -126,12 +136,15 @@ Rishav <115060907+rishav2404@users.noreply.github.com>
126136
Rishav Tarway <rishavtarway@gmail.com>
127137
Robert Gislason <gztown2216@yahoo.com>
128138
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
139+
Rupa <102663541+Rupa-Rd@users.noreply.github.com>
129140
Rutam Kathale <138517416+performant23@users.noreply.github.com>
130141
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
131142
Ryan Seal <splrk@users.noreply.github.com>
132143
Rylan Yang <137365285+rylany27@users.noreply.github.com>
133144
SAHIL KUMAR <168997976+sahilk45@users.noreply.github.com>
134145
SHIVAM YADAV <120725381+Shivam-1827@users.noreply.github.com>
146+
Sahil Goyal <87982509+sahil20021008@users.noreply.github.com>
147+
Sai Avinash <120403424+nasarobot@users.noreply.github.com>
135148
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
136149
Sanchay Ketan Sinha <122982233+satansin123@users.noreply.github.com>
137150
Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
@@ -166,9 +179,12 @@ Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
166179
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
167180
Yugal Kaushik <yugalkaushik14@gmail.com>
168181
Yuvi Mittal <128018763+yuvi-mittal@users.noreply.github.com>
182+
devshree-bhati <147095250+devshree-bhati@users.noreply.github.com>
169183
ditsu <170345142+ditsus@users.noreply.github.com>
170184
ekambains <bainsinbusiness@gmail.com>
171185
fadiothman22 <48636283+fadiothman22@users.noreply.github.com>
186+
iraandrushko <71790513+iraandrushko@users.noreply.github.com>
187+
lohithganni <116790357+lohithganni@users.noreply.github.com>
172188
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
173189
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>
174190
rahulrangers <127782777+rahulrangers@users.noreply.github.com>

README.md

Lines changed: 131 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,16 @@ To view installation and usage instructions specific to each branch build, be su
103103
var dsempn = require( '@stdlib/stats-base-dsempn' );
104104
```
105105

106-
#### dsempn( N, correction, x, stride )
106+
#### dsempn( N, correction, x, strideX )
107107

108-
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array `x` using a two-pass algorithm.
108+
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array using a two-pass algorithm.
109109

110110
```javascript
111111
var Float64Array = require( '@stdlib/array-float64' );
112112

113113
var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
114-
var N = x.length;
115114

116-
var v = dsempn( N, 1, x, 1 );
115+
var v = dsempn( x.length, 1, x, 1 );
117116
// returns ~1.20185
118117
```
119118

@@ -122,18 +121,16 @@ The function has the following parameters:
122121
- **N**: number of indexed elements.
123122
- **correction**: degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the corrected sample [standard deviation][standard-deviation], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
124123
- **x**: input [`Float64Array`][@stdlib/array/float64].
125-
- **stride**: index increment for `x`.
124+
- **strideX**: stride length for `x`.
126125

127-
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [standard error of the mean][standard-error] of every other element in `x`,
126+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [standard error of the mean][standard-error] of every other element in `x`,
128127

129128
```javascript
130129
var Float64Array = require( '@stdlib/array-float64' );
131-
var floor = require( '@stdlib/math-base-special-floor' );
132130

133131
var x = new Float64Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] );
134-
var N = floor( x.length / 2 );
135132

136-
var v = dsempn( N, 1, x, 2 );
133+
var v = dsempn( 4, 1, x, 2 );
137134
// returns 1.25
138135
```
139136

@@ -143,45 +140,39 @@ Note that indexing is relative to the first index. To introduce an offset, use [
143140

144141
```javascript
145142
var Float64Array = require( '@stdlib/array-float64' );
146-
var floor = require( '@stdlib/math-base-special-floor' );
147143

148144
var x0 = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
149145
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
150146

151-
var N = floor( x0.length / 2 );
152-
153-
var v = dsempn( N, 1, x1, 2 );
147+
var v = dsempn( 4, 1, x1, 2 );
154148
// returns 1.25
155149
```
156150

157-
#### dsempn.ndarray( N, correction, x, stride, offset )
151+
#### dsempn.ndarray( N, correction, x, strideX, offsetX )
158152

159153
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array using a two-pass algorithm and alternative indexing semantics.
160154

161155
```javascript
162156
var Float64Array = require( '@stdlib/array-float64' );
163157

164158
var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
165-
var N = x.length;
166159

167-
var v = dsempn.ndarray( N, 1, x, 1, 0 );
160+
var v = dsempn.ndarray( x.length, 1, x, 1, 0 );
168161
// returns ~1.20185
169162
```
170163

171164
The function has the following additional parameters:
172165

173-
- **offset**: starting index for `x`.
166+
- **offsetX**: starting index for `x`.
174167

175-
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 [standard error of the mean][standard-error] for every other value in `x` starting from the second value
168+
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 [standard error of the mean][standard-error] for every other element in `x` starting from the second element
176169

177170
```javascript
178171
var Float64Array = require( '@stdlib/array-float64' );
179-
var floor = require( '@stdlib/math-base-special-floor' );
180172

181173
var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
182-
var N = floor( x.length / 2 );
183174

184-
var v = dsempn.ndarray( N, 1, x, 2, 1 );
175+
var v = dsempn.ndarray( 4, 1, x, 2, 1 );
185176
// returns 1.25
186177
```
187178

@@ -229,6 +220,125 @@ console.log( v );
229220

230221
<!-- /.examples -->
231222

223+
<!-- C interface documentation. -->
224+
225+
* * *
226+
227+
<section class="c">
228+
229+
## C APIs
230+
231+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
232+
233+
<section class="intro">
234+
235+
</section>
236+
237+
<!-- /.intro -->
238+
239+
<!-- C usage documentation. -->
240+
241+
<section class="usage">
242+
243+
### Usage
244+
245+
```c
246+
#include "stdlib/stats/base/dsempn.h"
247+
```
248+
249+
#### stdlib_strided_dsempn( N, correction, \*X, strideX )
250+
251+
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array using a two-pass algorithm.
252+
253+
```c
254+
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
255+
256+
double v = stdlib_strided_dsempn( 4, 1.0, x, 2 );
257+
// returns ~1.29099
258+
```
259+
260+
The function accepts the following arguments:
261+
262+
- **N**: `[in] CBLAS_INT` number of indexed elements.
263+
- **correction**: `[in] double` degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the corrected sample [standard deviation][standard-deviation], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
264+
- **X**: `[in] double*` input array.
265+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
266+
267+
```c
268+
double stdlib_strided_dsempn( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX );
269+
```
270+
271+
#### stdlib_strided_dsempn_ndarray( N, correction, \*X, strideX, offsetX )
272+
273+
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array using a two-pass algorithm and alternative indexing semantics.
274+
275+
```c
276+
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
277+
278+
double v = stdlib_strided_dsempn_ndarray( 4, 1.0, x, 2, 0 );
279+
// returns ~1.29099
280+
```
281+
282+
The function accepts the following arguments:
283+
284+
- **N**: `[in] CBLAS_INT` number of indexed elements.
285+
- **correction**: `[in] double` degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the corrected sample [standard deviation][standard-deviation], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
286+
- **X**: `[in] double*` input array.
287+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
288+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
289+
290+
```c
291+
double stdlib_strided_dsempn_ndarray( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
292+
```
293+
294+
</section>
295+
296+
<!-- /.usage -->
297+
298+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
299+
300+
<section class="notes">
301+
302+
</section>
303+
304+
<!-- /.notes -->
305+
306+
<!-- C API usage examples. -->
307+
308+
<section class="examples">
309+
310+
### Examples
311+
312+
```c
313+
#include "stdlib/stats/base/dsempn.h"
314+
#include <stdio.h>
315+
316+
int main( void ) {
317+
// Create a strided array:
318+
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
319+
320+
// Specify the number of elements:
321+
const int N = 4;
322+
323+
// Specify the stride length:
324+
const int strideX = 2;
325+
326+
// Compute the arithmetic mean:
327+
double v = stdlib_strided_dsempn( N, 1.0, x, strideX );
328+
329+
// Print the result:
330+
printf( "dsempn: %lf\n", v );
331+
}
332+
```
333+
334+
</section>
335+
336+
<!-- /.examples -->
337+
338+
</section>
339+
340+
<!-- /.c -->
341+
232342
* * *
233343
234344
<section class="references">

benchmark/benchmark.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
2524
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2625
var pow = require( '@stdlib/math-base-special-pow' );
27-
var Float64Array = require( '@stdlib/array-float64' );
26+
var uniform = require( '@stdlib/random-array-uniform' );
2827
var pkg = require( './../package.json' ).name;
2928
var dsempn = require( './../lib/dsempn.js' );
3029

3130

31+
// VARIABLES //
32+
33+
var options = {
34+
'dtype': 'float64'
35+
};
36+
37+
3238
// FUNCTIONS //
3339

3440
/**
@@ -39,13 +45,7 @@ var dsempn = require( './../lib/dsempn.js' );
3945
* @returns {Function} benchmark function
4046
*/
4147
function createBenchmark( len ) {
42-
var x;
43-
var i;
44-
45-
x = new Float64Array( len );
46-
for ( i = 0; i < x.length; i++ ) {
47-
x[ i ] = ( randu()*20.0 ) - 10.0;
48-
}
48+
var x = uniform( len, -10.0, 10.0, options );
4949
return benchmark;
5050

5151
function benchmark( b ) {

0 commit comments

Comments
 (0)