Skip to content

Commit 365be0d

Browse files
committed
Auto-generated commit
1 parent 77b608b commit 365be0d

26 files changed

+348
-225
lines changed

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-26)
7+
## Unreleased (2025-04-11)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`ce86a5d`](https://github.com/stdlib-js/stdlib/commit/ce86a5d7a15f0bc79349d46ecbc661f270c7025b) - add C ndarray interface and refactor implementation for `stats/base/dmeanpn` [(#6510)](https://github.com/stdlib-js/stdlib/pull/6510)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`ce86a5d`](https://github.com/stdlib-js/stdlib/commit/ce86a5d7a15f0bc79349d46ecbc661f270c7025b) - **feat:** add C ndarray interface and refactor implementation for `stats/base/dmeanpn` [(#6510)](https://github.com/stdlib-js/stdlib/pull/6510) _(by Gururaj Gurram, Athan Reines)_
1526
- [`eca796b`](https://github.com/stdlib-js/stdlib/commit/eca796be22370f8e6ffce1157bd077e14428c236) - **refactor:** update paths _(by Aayush Khanna)_
1627
- [`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_
1728
- [`dbb5935`](https://github.com/stdlib-js/stdlib/commit/dbb59359010b9ac0a404604914d5db63f8fadcbc) - **refactor:** update `stats/base/dmeanpn` native addon from C++ to C [(#4100)](https://github.com/stdlib-js/stdlib/pull/4100) _(by Aayush Khanna)_
@@ -29,10 +40,11 @@
2940

3041
### Contributors
3142

32-
A total of 3 people contributed to this release. Thank you to the following contributors:
43+
A total of 4 people contributed to this release. Thank you to the following contributors:
3344

3445
- Aayush Khanna
3546
- Athan Reines
47+
- Gururaj Gurram
3648
- Philipp Burckhardt
3749

3850
</section>

CONTRIBUTORS

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ 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>
@@ -75,7 +76,8 @@ Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
7576
Joris Labie <joris.labie1@gmail.com>
7677
Justin Dennison <justin1dennison@gmail.com>
7778
Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
78-
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
79+
Karan Anand <anandkarancompsci@gmail.com>
80+
Karan Yadav <77043443+karanBRAVO@users.noreply.github.com>
7981
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
8082
Kaushikgtm <162317291+Kaushikgtm@users.noreply.github.com>
8183
Kavyansh-Bagdi <153486713+Kavyansh-Bagdi@users.noreply.github.com>
@@ -85,6 +87,7 @@ Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
8587
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
8688
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
8789
MANI <77221000+Eternity0207@users.noreply.github.com>
90+
Mahfuza Humayra Mohona <mhmohona@gmail.com>
8891
Manik Sharma <maniksharma.rke@gmail.com>
8992
Manvith M <148960168+manvith2003@users.noreply.github.com>
9093
Marcus Fantham <mfantham@users.noreply.github.com>
@@ -95,9 +98,12 @@ Mohammad Bin Aftab <48010758+MohammadBinAftab@users.noreply.github.com>
9598
Mohammad Kaif <mdkaifprofession@gmail.com>
9699
Momtchil Momtchev <momtchil@momtchev.com>
97100
Muhammad Haris <harriskhan047@outlook.com>
101+
Muhammad Taaha Tariq <166188821+Taaha-Tariq@users.noreply.github.com>
102+
Muhmmad Saad <106260977+saad-imran-dev@users.noreply.github.com>
98103
Naresh Jagadeesan <naresh.naresh000@gmail.com>
99104
Naveen Kumar <stupiddint@gmail.com>
100105
Neeraj Pathak <neerajrpathak710@gmail.com>
106+
NirvedMishra <139633597+NirvedMishra@users.noreply.github.com>
101107
Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
102108
Nishchay Rajput <121144841+NishchayRajput@users.noreply.github.com>
103109
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
@@ -111,8 +117,10 @@ Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
111117
Pranav Goswami <pranavchiku11@gmail.com>
112118
Pranjal Jha <97080887+PraneGIT@users.noreply.github.com>
113119
Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com>
120+
PrathamBhamare <164445568+PrathamBhamare@users.noreply.github.com>
114121
Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
115122
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
123+
Pravesh Kunwar <praveshkunwar04@gmail.com>
116124
Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
117125
Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
118126
Pulkit Gupta <65711278+pulkitgupta2@users.noreply.github.com>
@@ -126,11 +134,15 @@ Rishav <115060907+rishav2404@users.noreply.github.com>
126134
Rishav Tarway <rishavtarway@gmail.com>
127135
Robert Gislason <gztown2216@yahoo.com>
128136
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
137+
Rupa <102663541+Rupa-Rd@users.noreply.github.com>
129138
Rutam Kathale <138517416+performant23@users.noreply.github.com>
130139
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
131140
Ryan Seal <splrk@users.noreply.github.com>
132141
Rylan Yang <137365285+rylany27@users.noreply.github.com>
142+
SAHIL KUMAR <168997976+sahilk45@users.noreply.github.com>
133143
SHIVAM YADAV <120725381+Shivam-1827@users.noreply.github.com>
144+
Sahil Goyal <87982509+sahil20021008@users.noreply.github.com>
145+
Sai Avinash <120403424+nasarobot@users.noreply.github.com>
134146
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
135147
Sanchay Ketan Sinha <122982233+satansin123@users.noreply.github.com>
136148
Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
@@ -168,6 +180,7 @@ Yuvi Mittal <128018763+yuvi-mittal@users.noreply.github.com>
168180
ditsu <170345142+ditsus@users.noreply.github.com>
169181
ekambains <bainsinbusiness@gmail.com>
170182
fadiothman22 <48636283+fadiothman22@users.noreply.github.com>
183+
lohithganni <116790357+lohithganni@users.noreply.github.com>
171184
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
172185
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>
173186
rahulrangers <127782777+rahulrangers@users.noreply.github.com>

README.md

Lines changed: 129 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,36 +84,33 @@ To view installation and usage instructions specific to each branch build, be su
8484
var dmeanpn = require( '@stdlib/stats-base-dmeanpn' );
8585
```
8686

87-
#### dmeanpn( N, x, stride )
87+
#### dmeanpn( N, x, strideX )
8888

89-
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array `x` using a two-pass error correction algorithm.
89+
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using a two-pass error correction algorithm.
9090

9191
```javascript
9292
var Float64Array = require( '@stdlib/array-float64' );
9393

9494
var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
95-
var N = x.length;
9695

97-
var v = dmeanpn( N, x, 1 );
96+
var v = dmeanpn( x.length, x, 1 );
9897
// returns ~0.3333
9998
```
10099

101100
The function has the following parameters:
102101

103102
- **N**: number of indexed elements.
104103
- **x**: input [`Float64Array`][@stdlib/array/float64].
105-
- **stride**: index increment for `x`.
104+
- **strideX**: stride length for `x`.
106105

107-
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`,
108107

109108
```javascript
110109
var Float64Array = require( '@stdlib/array-float64' );
111-
var floor = require( '@stdlib/math-base-special-floor' );
112110

113111
var x = new Float64Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] );
114-
var N = floor( x.length / 2 );
115112

116-
var v = dmeanpn( N, x, 2 );
113+
var v = dmeanpn( 4, x, 2 );
117114
// returns 1.25
118115
```
119116

@@ -123,45 +120,39 @@ Note that indexing is relative to the first index. To introduce an offset, use [
123120

124121
```javascript
125122
var Float64Array = require( '@stdlib/array-float64' );
126-
var floor = require( '@stdlib/math-base-special-floor' );
127123

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

131-
var N = floor( x0.length / 2 );
132-
133-
var v = dmeanpn( N, x1, 2 );
127+
var v = dmeanpn( 4, x1, 2 );
134128
// returns 1.25
135129
```
136130

137-
#### dmeanpn.ndarray( N, x, stride, offset )
131+
#### dmeanpn.ndarray( N, x, strideX, offsetX )
138132

139133
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using a two-pass error correction algorithm and alternative indexing semantics.
140134

141135
```javascript
142136
var Float64Array = require( '@stdlib/array-float64' );
143137

144138
var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
145-
var N = x.length;
146139

147-
var v = dmeanpn.ndarray( N, x, 1, 0 );
140+
var v = dmeanpn.ndarray( x.length, x, 1, 0 );
148141
// returns ~0.33333
149142
```
150143

151144
The function has the following additional parameters:
152145

153-
- **offset**: starting index for `x`.
146+
- **offsetX**: starting index for `x`.
154147

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
156149

157150
```javascript
158151
var Float64Array = require( '@stdlib/array-float64' );
159-
var floor = require( '@stdlib/math-base-special-floor' );
160152

161153
var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
162-
var N = floor( x.length / 2 );
163154

164-
var v = dmeanpn.ndarray( N, x, 2, 1 );
155+
var v = dmeanpn.ndarray( 4, x, 2, 1 );
165156
// returns 1.25
166157
```
167158

@@ -208,6 +199,123 @@ console.log( v );
208199

209200
<!-- /.examples -->
210201

202+
<!-- C interface documentation. -->
203+
204+
* * *
205+
206+
<section class="c">
207+
208+
## C APIs
209+
210+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
211+
212+
<section class="intro">
213+
214+
</section>
215+
216+
<!-- /.intro -->
217+
218+
<!-- C usage documentation. -->
219+
220+
<section class="usage">
221+
222+
### Usage
223+
224+
```c
225+
#include "stdlib/stats/base/dmeanpn.h"
226+
```
227+
228+
#### stdlib_strided_dmeanpn( N, \*X, strideX )
229+
230+
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using a two-pass error correction algorithm.
231+
232+
```c
233+
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
234+
235+
double v = stdlib_strided_dmeanpn( 4, x, 2 );
236+
// returns 4.0
237+
```
238+
239+
The function accepts the following arguments:
240+
241+
- **N**: `[in] CBLAS_INT` number of indexed elements.
242+
- **X**: `[in] double*` input array.
243+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
244+
245+
```c
246+
double stdlib_strided_dmeanpn( const CBLAS_INT N, const double *X, const CBLAS_INT strideX );
247+
```
248+
249+
#### stdlib_strided_dmeanpn_ndarray( N, \*X, strideX, offsetX )
250+
251+
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using a two-pass error correction algorithm and alternative indexing semantics.
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_dmeanpn_ndarray( 4, x, 2, 0 );
257+
// returns 4.0
258+
```
259+
260+
The function accepts the following arguments:
261+
262+
- **N**: `[in] CBLAS_INT` number of indexed elements.
263+
- **X**: `[in] double*` input array.
264+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
265+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
266+
267+
```c
268+
double stdlib_strided_dmeanpn_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
269+
```
270+
271+
</section>
272+
273+
<!-- /.usage -->
274+
275+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
276+
277+
<section class="notes">
278+
279+
</section>
280+
281+
<!-- /.notes -->
282+
283+
<!-- C API usage examples. -->
284+
285+
<section class="examples">
286+
287+
### Examples
288+
289+
```c
290+
#include "stdlib/stats/base/dmeanpn.h"
291+
#include <stdio.h>
292+
293+
int main( void ) {
294+
// Create a strided array:
295+
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
296+
297+
// Specify the number of elements:
298+
const int N = 4;
299+
300+
// Specify the stride length:
301+
const int strideX = 2;
302+
303+
// Compute the arithmetic mean:
304+
double v = stdlib_strided_dmeanpn( N, x, strideX );
305+
306+
// Print the result:
307+
printf( "mean: %lf\n", v );
308+
}
309+
```
310+
311+
</section>
312+
313+
<!-- /.examples -->
314+
315+
</section>
316+
317+
<!-- /.c -->
318+
211319
* * *
212320
213321
<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 dmeanpn = require( './../lib/dmeanpn.js' );
3029

3130

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

3440
/**
@@ -39,13 +45,7 @@ var dmeanpn = require( './../lib/dmeanpn.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)