Skip to content

Commit e0eaf7d

Browse files
committed
Auto-generated commit
1 parent 443ebe6 commit e0eaf7d

File tree

102 files changed

+10647
-0
lines changed

Some content is hidden

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

102 files changed

+10647
-0
lines changed

CHANGELOG.md

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

1111
### Features
1212

13+
- [`22f1408`](https://github.com/stdlib-js/stdlib/commit/22f140863e59a9e1a2f89a6912a0c520a7fc7956) - add `csum` to namespace
14+
- [`10ccb4a`](https://github.com/stdlib-js/stdlib/commit/10ccb4a44321d0caf5602042c78b49232de2b1dc) - add `blas/ext/base/csum`
15+
- [`4f9ada3`](https://github.com/stdlib-js/stdlib/commit/4f9ada3914fe2a20811614089c1d2ce8bc6a15f0) - add `csumkbn` to namespace
16+
- [`c682e65`](https://github.com/stdlib-js/stdlib/commit/c682e653f19695066709857256c8c50cfbb24ac0) - add `blas/ext/base/csumkbn`
17+
- [`ef876c4`](https://github.com/stdlib-js/stdlib/commit/ef876c4aa3c97ce2fb042a0d48c852a448775fad) - add `zsum` to namespace
18+
- [`c76305e`](https://github.com/stdlib-js/stdlib/commit/c76305ee9931b510e2aec54ec1da3997845d40f4) - add `blas/ext/base/zsum`
1319
- [`e030bba`](https://github.com/stdlib-js/stdlib/commit/e030bba632158023584c3e28c080fdf289d15014) - add `gnannsumpw` to namespace
1420
- [`cbd656d`](https://github.com/stdlib-js/stdlib/commit/cbd656db90d14e150baa2a23deb44cb645ef2298) - add `blas/ext/base/gnannsumpw`
1521
- [`7324255`](https://github.com/stdlib-js/stdlib/commit/7324255304f2fdb5afddd9166579122fcdc2aa2a) - add `zsumkbn` to namespace
@@ -464,6 +470,13 @@ A total of 22 issues were closed in this release:
464470

465471
<details>
466472

473+
- [`22f1408`](https://github.com/stdlib-js/stdlib/commit/22f140863e59a9e1a2f89a6912a0c520a7fc7956) - **feat:** add `csum` to namespace _(by Athan Reines)_
474+
- [`10ccb4a`](https://github.com/stdlib-js/stdlib/commit/10ccb4a44321d0caf5602042c78b49232de2b1dc) - **feat:** add `blas/ext/base/csum` _(by Athan Reines)_
475+
- [`84af975`](https://github.com/stdlib-js/stdlib/commit/84af975367b6d0694ffbd0a27b7da0a0c144b4fb) - **chore:** clean-up _(by Athan Reines)_
476+
- [`4f9ada3`](https://github.com/stdlib-js/stdlib/commit/4f9ada3914fe2a20811614089c1d2ce8bc6a15f0) - **feat:** add `csumkbn` to namespace _(by Athan Reines)_
477+
- [`c682e65`](https://github.com/stdlib-js/stdlib/commit/c682e653f19695066709857256c8c50cfbb24ac0) - **feat:** add `blas/ext/base/csumkbn` _(by Athan Reines)_
478+
- [`ef876c4`](https://github.com/stdlib-js/stdlib/commit/ef876c4aa3c97ce2fb042a0d48c852a448775fad) - **feat:** add `zsum` to namespace _(by Athan Reines)_
479+
- [`c76305e`](https://github.com/stdlib-js/stdlib/commit/c76305ee9931b510e2aec54ec1da3997845d40f4) - **feat:** add `blas/ext/base/zsum` _(by Athan Reines)_
467480
- [`12b992e`](https://github.com/stdlib-js/stdlib/commit/12b992eca7ac911aa20fe41aa4fffc9dec128c9d) - **test:** address failing test cases _(by Athan Reines)_
468481
- [`b729264`](https://github.com/stdlib-js/stdlib/commit/b729264841b1af47c4831a8b38ebe51882017381) - **bench:** fix package path _(by Athan Reines)_
469482
- [`15922b7`](https://github.com/stdlib-js/stdlib/commit/15922b7bcaaaa3eb81bc6fec90898f0bd52e66fc) - **fix:** address indexing bug _(by Athan Reines)_

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Spandan Barve <contact@marsian.dev>
167167
Stephannie Jiménez Gacha <steff456@hotmail.com>
168168
Suhaib Ilahi <suhaib.elahi87@gmail.com>
169169
Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com>
170+
Swapnil Hajare <69076366+Swapnil-2502@users.noreply.github.com>
170171
Tanishq Ahuja <68651083+TheGEN1U5@users.noreply.github.com>
171172
Tirtadwipa Manunggal <tirtadwipa.manunggal@gmail.com>
172173
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>

ext/base/csum/README.md

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 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+
# csum
22+
23+
> Calculate the sum of single-precision complex floating-point strided array elements.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var csum = require( '@stdlib/blas/ext/base/csum' );
37+
```
38+
39+
#### csum( N, x, strideX )
40+
41+
Computes the sum of single-precision complex floating-point strided array elements.
42+
43+
```javascript
44+
var Complex64Array = require( '@stdlib/array/complex64' );
45+
46+
var x = new Complex64Array( [ 1.0, -2.0, 2.0, 3.0 ] );
47+
48+
var v = csum( x.length, x, 1 );
49+
// returns <Complex64>[ 3.0, 1.0 ]
50+
```
51+
52+
The function has the following parameters:
53+
54+
- **N**: number of indexed elements.
55+
- **x**: input [`Complex64Array`][@stdlib/array/complex64].
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 compute the sum of every other element:
59+
60+
```javascript
61+
var Complex64Array = require( '@stdlib/array/complex64' );
62+
63+
var x = new Complex64Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] );
64+
65+
var v = csum( 2, x, 2 );
66+
// returns <Complex64>[ -1.0, 5.0 ]
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 Complex64Array = require( '@stdlib/array/complex64' );
75+
76+
var x0 = new Complex64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
77+
var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
78+
79+
var v = csum( 2, x1, 2 );
80+
// returns <Complex64>[ 5.0, 2.0 ]
81+
```
82+
83+
#### csum.ndarray( N, x, strideX, offsetX )
84+
85+
Computes the sum of single-precision complex floating-point strided array elements using alternative indexing semantics.
86+
87+
```javascript
88+
var Complex64Array = require( '@stdlib/array/complex64' );
89+
90+
var x = new Complex64Array( [ 1.0, -2.0, 2.0, 3.0 ] );
91+
92+
var v = csum.ndarray( 2, x, 1, 0 );
93+
// returns <Complex64>[ 3.0, 1.0 ]
94+
```
95+
96+
The function has the following additional parameters:
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 calculate the sum of every other element starting from the second element:
101+
102+
```javascript
103+
var Complex64Array = require( '@stdlib/array/complex64' );
104+
105+
var x = new Complex64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
106+
107+
var v = csum.ndarray( 2, x, 2, 1 );
108+
// returns <Complex64>[ 5.0, 2.0 ]
109+
```
110+
111+
</section>
112+
113+
<!-- /.usage -->
114+
115+
<section class="notes">
116+
117+
## Notes
118+
119+
- If `N <= 0`, both functions return `0.0 + 0.0i`.
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 discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
133+
var Complex64Array = require( '@stdlib/array/complex64' );
134+
var csum = require( '@stdlib/blas/ext/base/csum' );
135+
136+
var xbuf = discreteUniform( 10, -100, 100, {
137+
'dtype': 'float32'
138+
});
139+
console.log( xbuf );
140+
141+
var x = new Complex64Array( xbuf );
142+
var v = csum( x.length, x, 1 );
143+
console.log( v );
144+
```
145+
146+
</section>
147+
148+
<!-- /.examples -->
149+
150+
<!-- C interface documentation. -->
151+
152+
* * *
153+
154+
<section class="c">
155+
156+
## C APIs
157+
158+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
159+
160+
<section class="intro">
161+
162+
</section>
163+
164+
<!-- /.intro -->
165+
166+
<!-- C usage documentation. -->
167+
168+
<section class="usage">
169+
170+
### Usage
171+
172+
```c
173+
#include "stdlib/blas/ext/base/csum.h"
174+
```
175+
176+
#### stdlib_strided_csum( N, \*X, strideX )
177+
178+
Computes the sum of single-precision complex floating-point strided array elements.
179+
180+
```c
181+
#include "stdlib/complex/float32/ctor.h"
182+
183+
const stdlib_complex64_t x[] = {
184+
stdlib_complex64( 1.0f, 2.0f ),
185+
stdlib_complex64( 3.0f, 4.0f )
186+
};
187+
188+
stdlib_complex64_t v = stdlib_strided_csum( 2, x, 1 );
189+
```
190+
191+
The function accepts the following arguments:
192+
193+
- **N**: `[in] CBLAS_INT` number of indexed elements.
194+
- **X**: `[in] stdlib_complex64_t*` input array.
195+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
196+
197+
```c
198+
stdlib_complex64_t stdlib_strided_csum( const CBLAS_INT N, const stdlib_complex64_t *X, const CBLAS_INT strideX );
199+
```
200+
201+
#### stdlib_strided_csum_ndarray( N, \*X, strideX, offsetX )
202+
203+
Computes the sum of single-precision complex floating-point strided array elements using alternative indexing semantics.
204+
205+
```c
206+
#include "stdlib/complex/float32/ctor.h"
207+
208+
const stdlib_complex64_t x[] = {
209+
stdlib_complex64( 1.0f, 2.0f ),
210+
stdlib_complex64( 3.0f, 4.0f )
211+
};
212+
213+
stdlib_complex64_t v = stdlib_strided_csum_ndarray( 2, x, 1, 0 );
214+
```
215+
216+
The function accepts the following arguments:
217+
218+
- **N**: `[in] CBLAS_INT` number of indexed elements.
219+
- **X**: `[in] stdlib_complex64_t*` input array.
220+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
221+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
222+
223+
```c
224+
stdlib_complex64_t stdlib_strided_csum_ndarray( const CBLAS_INT N, const stdlib_complex64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
225+
```
226+
227+
</section>
228+
229+
<!-- /.usage -->
230+
231+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
232+
233+
<section class="notes">
234+
235+
</section>
236+
237+
<!-- /.notes -->
238+
239+
<!-- C API usage examples. -->
240+
241+
<section class="examples">
242+
243+
### Examples
244+
245+
```c
246+
#include "stdlib/blas/ext/base/csum.h"
247+
#include "stdlib/complex/float32/ctor.h"
248+
#include "stdlib/complex/float32/real.h"
249+
#include "stdlib/complex/float32/imag.h"
250+
#include <stdio.h>
251+
252+
int main( void ) {
253+
// Create a strided array:
254+
const stdlib_complex64_t x[] = {
255+
stdlib_complex64( 1.0f, 2.0f ),
256+
stdlib_complex64( 3.0f, 4.0f ),
257+
stdlib_complex64( 5.0f, 6.0f ),
258+
stdlib_complex64( 7.0f, 8.0f )
259+
};
260+
261+
// Specify the number of elements:
262+
const int N = 4;
263+
264+
// Specify the stride length:
265+
const int strideX = 1;
266+
267+
// Compute the sum:
268+
stdlib_complex64_t v = stdlib_strided_csum( N, x, strideX );
269+
270+
// Print the result:
271+
printf( "sum: %f + %fi\n", stdlib_complex64_real( v ), stdlib_complex64_imag( v ) );
272+
}
273+
```
274+
275+
</section>
276+
277+
<!-- /.examples -->
278+
279+
</section>
280+
281+
<!-- /.c -->
282+
283+
<section class="references">
284+
285+
</section>
286+
287+
<!-- /.references -->
288+
289+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
290+
291+
<section class="related">
292+
293+
</section>
294+
295+
<!-- /.related -->
296+
297+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
298+
299+
<section class="links">
300+
301+
[@stdlib/array/complex64]: https://github.com/stdlib-js/array-complex64
302+
303+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
304+
305+
</section>
306+
307+
<!-- /.links -->

0 commit comments

Comments
 (0)