Skip to content

Commit f6059df

Browse files
committed
Auto-generated commit
1 parent ddcdaf4 commit f6059df

34 files changed

Lines changed: 4637 additions & 0 deletions

CHANGELOG.md

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

1111
### Features
1212

13+
- [`f27e6eb`](https://github.com/stdlib-js/stdlib/commit/f27e6ebcb209931a4781c92ff3aeb9d4c0fe0552) - add `blas/ext/base/dwxdy` [(#13848)](https://github.com/stdlib-js/stdlib/pull/13848)
1314
- [`deb4cc6`](https://github.com/stdlib-js/stdlib/commit/deb4cc6d397356e6bc6523c2ba471a0779588c02) - add `blas/ext/base/ndarray/cindex-of-truthy` [(#13885)](https://github.com/stdlib-js/stdlib/pull/13885)
1415
- [`f9cf5fa`](https://github.com/stdlib-js/stdlib/commit/f9cf5fa73ea2476423eab22e31b6972eea1f6760) - add `blas/ext/base/ndarray/zindex-of-truthy` [(#13887)](https://github.com/stdlib-js/stdlib/pull/13887)
1516
- [`fa9cd2c`](https://github.com/stdlib-js/stdlib/commit/fa9cd2c7f7d3422b12942d1c65511d422075ee58) - add `blas/ext/base/ndarray/dindex-of-truthy` [(#13881)](https://github.com/stdlib-js/stdlib/pull/13881)
@@ -426,6 +427,7 @@ A total of 4 issues were closed in this release:
426427

427428
<details>
428429

430+
- [`f27e6eb`](https://github.com/stdlib-js/stdlib/commit/f27e6ebcb209931a4781c92ff3aeb9d4c0fe0552) - **feat:** add `blas/ext/base/dwxdy` [(#13848)](https://github.com/stdlib-js/stdlib/pull/13848) _(by Karan Anand)_
429431
- [`deb4cc6`](https://github.com/stdlib-js/stdlib/commit/deb4cc6d397356e6bc6523c2ba471a0779588c02) - **feat:** add `blas/ext/base/ndarray/cindex-of-truthy` [(#13885)](https://github.com/stdlib-js/stdlib/pull/13885) _(by Muhammad Haris)_
430432
- [`f9cf5fa`](https://github.com/stdlib-js/stdlib/commit/f9cf5fa73ea2476423eab22e31b6972eea1f6760) - **feat:** add `blas/ext/base/ndarray/zindex-of-truthy` [(#13887)](https://github.com/stdlib-js/stdlib/pull/13887) _(by Muhammad Haris)_
431433
- [`fa9cd2c`](https://github.com/stdlib-js/stdlib/commit/fa9cd2c7f7d3422b12942d1c65511d422075ee58) - **feat:** add `blas/ext/base/ndarray/dindex-of-truthy` [(#13881)](https://github.com/stdlib-js/stdlib/pull/13881) _(by Muhammad Haris)_

ext/base/dwxdy/README.md

Lines changed: 349 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,349 @@
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+
# dwxdy
22+
23+
> Divide elements of a double-precision floating-point strided array `x` by the corresponding elements of a double-precision floating-point strided array `y` and assign the results to elements in a double-precision floating-point strided array `w`.
24+
25+
<section class="intro">
26+
27+
This BLAS extension implements the operation
28+
29+
<!-- <equation class="equation" label="eq:wxdy" align="center" raw="\mathbf{w} = \mathbf{x} \oslash \mathbf{y}" alt="Equation for wxdy operation."> -->
30+
31+
```math
32+
\mathbf{w} = \mathbf{x} \oslash \mathbf{y}
33+
```
34+
35+
<!-- </equation> -->
36+
37+
where `` denotes the [Hadamard division][hadamard-division].
38+
39+
</section>
40+
41+
<!-- /.intro -->
42+
43+
<section class="usage">
44+
45+
## Usage
46+
47+
```javascript
48+
var dwxdy = require( '@stdlib/blas/ext/base/dwxdy' );
49+
```
50+
51+
#### dwxdy( N, x, strideX, y, strideY, w, strideW )
52+
53+
Divides elements of a double-precision floating-point strided array `x` by the corresponding elements of a double-precision floating-point strided array `y` and assigns the results to elements in a double-precision floating-point strided array `w`.
54+
55+
```javascript
56+
var Float64Array = require( '@stdlib/array/float64' );
57+
58+
var x = new Float64Array( [ 6.0, 12.0, 20.0, 30.0, 42.0 ] );
59+
var y = new Float64Array( [ 2.0, 3.0, 4.0, 5.0, 6.0 ] );
60+
var w = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
61+
62+
dwxdy( x.length, x, 1, y, 1, w, 1 );
63+
// w => <Float64Array>[ 3.0, 4.0, 5.0, 6.0, 7.0 ]
64+
```
65+
66+
The function has the following parameters:
67+
68+
- **N**: number of indexed elements.
69+
- **x**: first input [`Float64Array`][@stdlib/array/float64].
70+
- **strideX**: stride length for `x`.
71+
- **y**: second input [`Float64Array`][@stdlib/array/float64].
72+
- **strideY**: stride length for `y`.
73+
- **w**: output [`Float64Array`][@stdlib/array/float64].
74+
- **strideW**: stride length for `w`.
75+
76+
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to divide every other element of `x` by every other element of `y`:
77+
78+
```javascript
79+
var Float64Array = require( '@stdlib/array/float64' );
80+
81+
var x = new Float64Array( [ 6.0, 1.0, 20.0, 1.0, 42.0, 1.0 ] );
82+
var y = new Float64Array( [ 2.0, 1.0, 4.0, 1.0, 6.0, 1.0 ] );
83+
var w = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
84+
85+
dwxdy( 3, x, 2, y, 2, w, 2 );
86+
// w => <Float64Array>[ 3.0, 0.0, 5.0, 0.0, 7.0, 0.0 ]
87+
```
88+
89+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
90+
91+
```javascript
92+
var Float64Array = require( '@stdlib/array/float64' );
93+
94+
// Initial arrays...
95+
var x0 = new Float64Array( [ 1.0, 6.0, 12.0, 20.0, 1.0, 1.0 ] );
96+
var y0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 1.0, 1.0 ] );
97+
var w0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
98+
99+
// Create offset views...
100+
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
101+
var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
102+
var w1 = new Float64Array( w0.buffer, w0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
103+
104+
dwxdy( 3, x1, 1, y1, 1, w1, 1 );
105+
// w0 => <Float64Array>[ 0.0, 3.0, 4.0, 5.0, 0.0, 0.0 ]
106+
```
107+
108+
<!-- lint disable maximum-heading-length -->
109+
110+
#### dwxdy.ndarray( N, x, strideX, offsetX, y, strideY, offsetY, w, strideW, offsetW )
111+
112+
<!-- lint enable maximum-heading-length -->
113+
114+
Divides elements of a double-precision floating-point strided array `x` by the corresponding elements of a double-precision floating-point strided array `y` and assigns the results to elements in a double-precision floating-point strided array `w` using alternative indexing semantics.
115+
116+
```javascript
117+
var Float64Array = require( '@stdlib/array/float64' );
118+
119+
var x = new Float64Array( [ 6.0, 12.0, 20.0, 30.0, 42.0 ] );
120+
var y = new Float64Array( [ 2.0, 3.0, 4.0, 5.0, 6.0 ] );
121+
var w = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
122+
123+
dwxdy.ndarray( x.length, x, 1, 0, y, 1, 0, w, 1, 0 );
124+
// w => <Float64Array>[ 3.0, 4.0, 5.0, 6.0, 7.0 ]
125+
```
126+
127+
The function has the following additional parameters:
128+
129+
- **offsetX**: starting index for `x`.
130+
- **offsetY**: starting index for `y`.
131+
- **offsetW**: starting index for `w`.
132+
133+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to divide the last three elements of `x` by the last three elements of `y` and assign to the last three elements of `w`:
134+
135+
```javascript
136+
var Float64Array = require( '@stdlib/array/float64' );
137+
138+
var x = new Float64Array( [ 1.0, 2.0, 6.0, 20.0, 42.0 ] );
139+
var y = new Float64Array( [ 1.0, 2.0, 2.0, 4.0, 6.0 ] );
140+
var w = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
141+
142+
dwxdy.ndarray( 3, x, 1, x.length-3, y, 1, y.length-3, w, 1, w.length-3 );
143+
// w => <Float64Array>[ 0.0, 0.0, 3.0, 5.0, 7.0 ]
144+
```
145+
146+
</section>
147+
148+
<!-- /.usage -->
149+
150+
<section class="notes">
151+
152+
## Notes
153+
154+
- If `N <= 0`, both functions return `w` unchanged.
155+
156+
</section>
157+
158+
<!-- /.notes -->
159+
160+
<section class="examples">
161+
162+
## Examples
163+
164+
<!-- eslint no-undef: "error" -->
165+
166+
```javascript
167+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
168+
var logEach = require( '@stdlib/console/log-each' );
169+
var dwxdy = require( '@stdlib/blas/ext/base/dwxdy' );
170+
171+
var opts = {
172+
'dtype': 'float64'
173+
};
174+
var x = discreteUniform( 10, -100, 100, opts );
175+
var y = discreteUniform( 10, 1, 100, opts );
176+
var w = discreteUniform( 10, -100, 100, opts );
177+
178+
dwxdy( x.length, x, 1, y, 1, w, 1 );
179+
logEach( '%d / %d = %0.4f', x, y, w );
180+
```
181+
182+
</section>
183+
184+
<!-- /.examples -->
185+
186+
<!-- C interface documentation. -->
187+
188+
* * *
189+
190+
<section class="c">
191+
192+
## C APIs
193+
194+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
195+
196+
<section class="intro">
197+
198+
</section>
199+
200+
<!-- /.intro -->
201+
202+
<!-- C usage documentation. -->
203+
204+
<section class="usage">
205+
206+
### Usage
207+
208+
```c
209+
#include "stdlib/blas/ext/base/dwxdy.h"
210+
```
211+
212+
#### stdlib_strided_dwxdy( N, \*X, strideX, \*Y, strideY, \*W, strideW )
213+
214+
Divides elements of a double-precision floating-point strided array `X` by the corresponding elements of a double-precision floating-point strided array `Y` and assigns the results to elements in a double-precision floating-point strided array `W`.
215+
216+
```c
217+
const double x[] = { 6.0, 12.0, 20.0, 30.0 };
218+
const double y[] = { 2.0, 3.0, 4.0, 5.0 };
219+
double w[] = { 0.0, 0.0, 0.0, 0.0 };
220+
221+
stdlib_strided_dwxdy( 4, x, 1, y, 1, w, 1 );
222+
```
223+
224+
The function accepts the following arguments:
225+
226+
- **N**: `[in] CBLAS_INT` number of indexed elements.
227+
- **X**: `[in] double*` first input array.
228+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
229+
- **Y**: `[in] double*` second input array.
230+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
231+
- **W**: `[out] double*` output array.
232+
- **strideW**: `[in] CBLAS_INT` stride length for `W`.
233+
234+
```c
235+
void stdlib_strided_dwxdy( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY, double *W, const CBLAS_INT strideW );
236+
```
237+
238+
<!-- lint disable maximum-heading-length -->
239+
240+
#### stdlib_strided_dwxdy_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY, \*W, strideW, offsetW )
241+
242+
<!-- lint enable maximum-heading-length -->
243+
244+
Divides elements of a double-precision floating-point strided array `X` by the corresponding elements of a double-precision floating-point strided array `Y` and assigns the results to elements in a double-precision floating-point strided array `W` using alternative indexing semantics.
245+
246+
```c
247+
const double x[] = { 6.0, 12.0, 20.0, 30.0 };
248+
const double y[] = { 2.0, 3.0, 4.0, 5.0 };
249+
double w[] = { 0.0, 0.0, 0.0, 0.0 };
250+
251+
stdlib_strided_dwxdy_ndarray( 4, x, 1, 0, y, 1, 0, w, 1, 0 );
252+
```
253+
254+
The function accepts the following arguments:
255+
256+
- **N**: `[in] CBLAS_INT` number of indexed elements.
257+
- **X**: `[in] double*` first input array.
258+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
259+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
260+
- **Y**: `[in] double*` second input array.
261+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
262+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
263+
- **W**: `[out] double*` output array.
264+
- **strideW**: `[in] CBLAS_INT` stride length for `W`.
265+
- **offsetW**: `[in] CBLAS_INT` starting index for `W`.
266+
267+
```c
268+
void stdlib_strided_dwxdy_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, double *W, const CBLAS_INT strideW, const CBLAS_INT offsetW );
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/blas/ext/base/dwxdy.h"
291+
#include <stdio.h>
292+
293+
int main( void ) {
294+
// Create strided arrays:
295+
const double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
296+
const double y[] = { 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
297+
double w[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
298+
299+
// Specify the number of indexed elements:
300+
const int N = 8;
301+
302+
// Specify strides:
303+
const int strideX = 1;
304+
const int strideY = 1;
305+
const int strideW = 1;
306+
307+
// Divide elements of `x` by the corresponding elements of `y` and assign the results to elements in `w`:
308+
stdlib_strided_dwxdy( N, x, strideX, y, strideY, w, strideW );
309+
310+
// Print the result:
311+
for ( int i = 0; i < 8; i++ ) {
312+
printf( "w[ %i ] = %lf\n", i, w[ i ] );
313+
}
314+
}
315+
```
316+
317+
</section>
318+
319+
<!-- /.examples -->
320+
321+
</section>
322+
323+
<!-- /.c -->
324+
325+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
326+
327+
<section class="related">
328+
329+
</section>
330+
331+
<!-- /.related -->
332+
333+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
334+
335+
<section class="links">
336+
337+
[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64
338+
339+
[hadamard-division]: https://en.wikipedia.org/wiki/Hadamard_product_(matrices)#Analogous_operations
340+
341+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
342+
343+
<!-- <related-links> -->
344+
345+
<!-- </related-links> -->
346+
347+
</section>
348+
349+
<!-- /.links -->

0 commit comments

Comments
 (0)