Skip to content

Commit e5feaec

Browse files
committed
Auto-generated commit
1 parent 080ec80 commit e5feaec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+8728
-0
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
### Features
1212

13+
- [`6c430c7`](https://github.com/stdlib-js/stdlib/commit/6c430c7cf0ad336df590a4bee5e05c78346e5dc2) - add `gnancount` to namespace
14+
- [`c84f0ca`](https://github.com/stdlib-js/stdlib/commit/c84f0caa56429dc035cfb22a105d62a3178b5c87) - add `blas/ext/base/gnancount`
15+
- [`e7d8e09`](https://github.com/stdlib-js/stdlib/commit/e7d8e0920f12d60fd5e6d53386f5864d881a509c) - add `snancount` to namespace
16+
- [`8edb14b`](https://github.com/stdlib-js/stdlib/commit/8edb14b2afd6ad44f3ac57e220517a17f7038af9) - add `blas/ext/base/snancount`
17+
- [`c3ecb67`](https://github.com/stdlib-js/stdlib/commit/c3ecb679224184a40ed56fb39b2d8f6ad957ae89) - add `dnancount` to namespace
18+
- [`4f065eb`](https://github.com/stdlib-js/stdlib/commit/4f065eb18dc8c7038f9f75d7d30991cc9056a770) - add `blas/ext/base/dnancount`
1319
- [`51cb65c`](https://github.com/stdlib-js/stdlib/commit/51cb65ca010a117520cada40c81ead09956e1724) - add `gwhere` to namespace
1420
- [`85b48f1`](https://github.com/stdlib-js/stdlib/commit/85b48f1932349ff73045a1e53e7477296233381c) - add `blas/ext/base/gwhere` [(#11345)](https://github.com/stdlib-js/stdlib/pull/11345)
1521
- [`2ab6254`](https://github.com/stdlib-js/stdlib/commit/2ab6254a552c8bb1024eb5fc5baa35cd4812f64b) - update `blas/ext/base/ndarray` TypeScript declarations [(#11496)](https://github.com/stdlib-js/stdlib/pull/11496)
@@ -870,6 +876,12 @@ A total of 57 issues were closed in this release:
870876

871877
<details>
872878

879+
- [`6c430c7`](https://github.com/stdlib-js/stdlib/commit/6c430c7cf0ad336df590a4bee5e05c78346e5dc2) - **feat:** add `gnancount` to namespace _(by Athan Reines)_
880+
- [`c84f0ca`](https://github.com/stdlib-js/stdlib/commit/c84f0caa56429dc035cfb22a105d62a3178b5c87) - **feat:** add `blas/ext/base/gnancount` _(by Athan Reines)_
881+
- [`e7d8e09`](https://github.com/stdlib-js/stdlib/commit/e7d8e0920f12d60fd5e6d53386f5864d881a509c) - **feat:** add `snancount` to namespace _(by Athan Reines)_
882+
- [`8edb14b`](https://github.com/stdlib-js/stdlib/commit/8edb14b2afd6ad44f3ac57e220517a17f7038af9) - **feat:** add `blas/ext/base/snancount` _(by Athan Reines)_
883+
- [`c3ecb67`](https://github.com/stdlib-js/stdlib/commit/c3ecb679224184a40ed56fb39b2d8f6ad957ae89) - **feat:** add `dnancount` to namespace _(by Athan Reines)_
884+
- [`4f065eb`](https://github.com/stdlib-js/stdlib/commit/4f065eb18dc8c7038f9f75d7d30991cc9056a770) - **feat:** add `blas/ext/base/dnancount` _(by Athan Reines)_
873885
- [`33e1dc1`](https://github.com/stdlib-js/stdlib/commit/33e1dc142e433a91b6cad99f89dca3255c56b81f) - **fix:** use correct variable in interpolation _(by Athan Reines)_
874886
- [`ebc279f`](https://github.com/stdlib-js/stdlib/commit/ebc279f1f644eafb21ad4db9d322196bd4318b7a) - **fix:** use correct variable in interpolation _(by Athan Reines)_
875887
- [`1802636`](https://github.com/stdlib-js/stdlib/commit/180263640132ce8b6d5a1b31f74bf84399d2236a) - **fix:** fix comparison _(by Athan Reines)_

ext/base/dnancount/README.md

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# dnancount
22+
23+
> Calculate the number of non-`NaN` elements in a double-precision floating-point strided array.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var dnancount = require( '@stdlib/blas/ext/base/dnancount' );
37+
```
38+
39+
#### dnancount( N, x, strideX )
40+
41+
Computes the number of non-`NaN` elements in a double-precision floating-point strided array.
42+
43+
```javascript
44+
var Float64Array = require( '@stdlib/array/float64' );
45+
46+
var x = new Float64Array( [ 1.0, -2.0, NaN, 2.0 ] );
47+
48+
var v = dnancount( x.length, x, 1 );
49+
// returns 3
50+
```
51+
52+
The function has the following parameters:
53+
54+
- **N**: number of indexed elements.
55+
- **x**: input [`Float64Array`][@stdlib/array/float64].
56+
- **strideX**: stride length for `x`.
57+
58+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to count every other element in `x`,
59+
60+
```javascript
61+
var Float64Array = require( '@stdlib/array/float64' );
62+
63+
var x = new Float64Array( [ 1.0, 2.0, NaN, -2.0, 4.0, 3.0, NaN, NaN ] );
64+
65+
var v = dnancount( 4, x, 2 );
66+
// returns 2
67+
```
68+
69+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
70+
71+
<!-- eslint-disable stdlib/capitalized-comments -->
72+
73+
```javascript
74+
var Float64Array = require( '@stdlib/array/float64' );
75+
76+
var x0 = new Float64Array( [ 2.0, 1.0, NaN, -2.0, 3.0, 4.0, NaN, NaN ] );
77+
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
78+
79+
var v = dnancount( 4, x1, 2 );
80+
// returns 3
81+
```
82+
83+
#### dnancount.ndarray( N, x, strideX, offsetX )
84+
85+
Computes the number of non-`NaN` elements in a double-precision floating-point strided array using alternative indexing semantics.
86+
87+
```javascript
88+
var Float64Array = require( '@stdlib/array/float64' );
89+
90+
var x = new Float64Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, NaN, NaN ] );
91+
92+
var v = dnancount.ndarray( 4, x, 2, 1 );
93+
// returns 3
94+
```
95+
96+
The function has the following additional parameter:
97+
98+
- **offsetX**: starting index for `x`.
99+
100+
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 count every other element in `x` starting from the second element,
101+
102+
```javascript
103+
var Float64Array = require( '@stdlib/array/float64' );
104+
105+
var x = new Float64Array( [ 2.0, 1.0, NaN, -2.0, 3.0, 4.0, NaN, NaN ] );
106+
107+
var v = dnancount.ndarray( 4, x, 2, 1 );
108+
// returns 3
109+
```
110+
111+
</section>
112+
113+
<!-- /.usage -->
114+
115+
<section class="notes">
116+
117+
## Notes
118+
119+
- If `N <= 0`, both functions return `0`.
120+
121+
</section>
122+
123+
<!-- /.notes -->
124+
125+
<section class="examples">
126+
127+
## Examples
128+
129+
<!-- eslint no-undef: "error" -->
130+
131+
```javascript
132+
var uniform = require( '@stdlib/random/base/uniform' );
133+
var filledarrayBy = require( '@stdlib/array/filled-by' );
134+
var bernoulli = require( '@stdlib/random/base/bernoulli' );
135+
var dnancount = require( '@stdlib/blas/ext/base/dnancount' );
136+
137+
function rand() {
138+
if ( bernoulli( 0.8 ) < 1 ) {
139+
return NaN;
140+
}
141+
return uniform( -50.0, 50.0 );
142+
}
143+
144+
var x = filledarrayBy( 10, 'float64', rand );
145+
console.log( x );
146+
147+
var v = dnancount( x.length, x, 1 );
148+
console.log( v );
149+
```
150+
151+
</section>
152+
153+
<!-- /.examples -->
154+
155+
* * *
156+
157+
<section class="c">
158+
159+
## C APIs
160+
161+
<section class="intro">
162+
163+
</section>
164+
165+
<!-- /.intro -->
166+
167+
<section class="usage">
168+
169+
### Usage
170+
171+
```c
172+
#include "stdlib/blas/ext/base/dnancount.h"
173+
```
174+
175+
#### stdlib_strided_dnancount( N, \*X, strideX )
176+
177+
Computes the number of non-`NaN` elements in a double-precision floating-point strided array.
178+
179+
```c
180+
const double x[] = { 1.0, 2.0, NaN, 4.0, 5.0, 6.0, NaN, 8.0 };
181+
182+
int v = stdlib_strided_dnancount( 4, x, 2 );
183+
// returns 2
184+
```
185+
186+
The function accepts the following arguments:
187+
188+
- **N**: `[in] CBLAS_INT` number of indexed elements.
189+
- **X**: `[in] double*` input array.
190+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
191+
192+
```c
193+
CBLAS_INT stdlib_strided_dnancount( const CBLAS_INT N, const double *X, const CBLAS_INT strideX );
194+
```
195+
196+
#### stdlib_strided_dnancount_ndarray( N, \*X, strideX, offsetX )
197+
198+
Computes the number of non-`NaN` elements in a double-precision floating-point strided array using alternative indexing semantics.
199+
200+
```c
201+
const double x[] = { 2.0, 1.0, NaN, -2.0, 3.0, 4.0, NaN, NaN };
202+
203+
int v = stdlib_strided_dnancount_ndarray( 4, x, 2, 1 );
204+
// returns 3
205+
```
206+
207+
The function accepts the following arguments:
208+
209+
- **N**: `[in] CBLAS_INT` number of indexed elements.
210+
- **X**: `[in] double*` input array.
211+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
212+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
213+
214+
```c
215+
CBLAS_INT stdlib_strided_dnancount_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
216+
```
217+
218+
</section>
219+
220+
<!-- /.usage -->
221+
222+
<section class="notes">
223+
224+
### Notes
225+
226+
- If `N <= 0`, both functions return `0`.
227+
228+
</section>
229+
230+
<!-- /.notes -->
231+
232+
<section class="examples">
233+
234+
### Examples
235+
236+
```c
237+
#include "stdlib/blas/ext/base/dnancount.h"
238+
#include <stdint.h>
239+
#include <stdio.h>
240+
241+
int main( void ) {
242+
// Create a strided array:
243+
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 };
244+
245+
// Specify the number of elements:
246+
const int N = 5;
247+
248+
// Specify the stride length:
249+
const int strideX = 2;
250+
251+
// Compute the number of non-NaN elements:
252+
int v = stdlib_strided_dnancount( N, x, strideX );
253+
254+
// Print the result:
255+
printf( "count: %d\n", v );
256+
}
257+
```
258+
259+
</section>
260+
261+
<!-- /.examples -->
262+
263+
</section>
264+
265+
<!-- /.c -->
266+
267+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
268+
269+
<section class="related">
270+
271+
</section>
272+
273+
<!-- /.related -->
274+
275+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
276+
277+
<section class="links">
278+
279+
[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64
280+
281+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
282+
283+
<!-- <related-links> -->
284+
285+
286+
<!-- </related-links> -->
287+
288+
</section>
289+
290+
<!-- /.links -->

0 commit comments

Comments
 (0)