Skip to content

Commit 38498ba

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into philipp/fix-propagation-2026-04-18
2 parents ae21fc8 + 49fc241 commit 38498ba

File tree

48 files changed

+1809
-63
lines changed

Some content is hidden

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

48 files changed

+1809
-63
lines changed

lib/node_modules/@stdlib/blas/base/ndarray/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The namespace exposes the following APIs:
4545

4646
<div class="namespace-toc">
4747

48+
- <span class="signature">[`caxpy( arrays )`][@stdlib/blas/base/ndarray/caxpy]</span><span class="delimiter">: </span><span class="description">multiply a one-dimensional single-precision complex floating-point ndarray `x` by a constant `alpha` and add the result to a one-dimensional single-precision complex floating-point ndarray `y`.</span>
4849
- <span class="signature">[`dasum( arrays )`][@stdlib/blas/base/ndarray/dasum]</span><span class="delimiter">: </span><span class="description">calculate the sum of absolute values for all elements in a one-dimensional double-precision floating-point ndarray.</span>
4950
- <span class="signature">[`daxpy( arrays )`][@stdlib/blas/base/ndarray/daxpy]</span><span class="delimiter">: </span><span class="description">multiply a one-dimensional double-precision floating-point ndarray `x` by a constant `alpha` and add the result to a one-dimensional double-precision floating-point ndarray `y`.</span>
5051
- <span class="signature">[`ddot( arrays )`][@stdlib/blas/base/ndarray/ddot]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two one-dimensional double-precision floating-point ndarrays.</span>
@@ -54,6 +55,7 @@ The namespace exposes the following APIs:
5455
- <span class="signature">[`sasum( arrays )`][@stdlib/blas/base/ndarray/sasum]</span><span class="delimiter">: </span><span class="description">calculate the sum of absolute values for all elements in a one-dimensional single-precision floating-point ndarray.</span>
5556
- <span class="signature">[`saxpy( arrays )`][@stdlib/blas/base/ndarray/saxpy]</span><span class="delimiter">: </span><span class="description">multiply a one-dimensional single-precision floating-point ndarray `x` by a constant `alpha` and add the result to a one-dimensional single-precision floating-point ndarray `y`.</span>
5657
- <span class="signature">[`sdot( arrays )`][@stdlib/blas/base/ndarray/sdot]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two one-dimensional single-precision floating-point ndarrays.</span>
58+
- <span class="signature">[`zaxpy( arrays )`][@stdlib/blas/base/ndarray/zaxpy]</span><span class="delimiter">: </span><span class="description">multiply a one-dimensional double-precision complex floating-point ndarray `x` by a constant `alpha` and add the result to a one-dimensional double-precision complex floating-point ndarray `y`.</span>
5759

5860
</div>
5961

@@ -96,6 +98,8 @@ console.log( objectKeys( ns ) );
9698

9799
<!-- <toc-links> -->
98100

101+
[@stdlib/blas/base/ndarray/caxpy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/caxpy
102+
99103
[@stdlib/blas/base/ndarray/dasum]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/dasum
100104

101105
[@stdlib/blas/base/ndarray/daxpy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/daxpy
@@ -114,6 +118,8 @@ console.log( objectKeys( ns ) );
114118

115119
[@stdlib/blas/base/ndarray/sdot]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/sdot
116120

121+
[@stdlib/blas/base/ndarray/zaxpy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/zaxpy
122+
117123
<!-- </toc-links> -->
118124

119125
</section>

lib/node_modules/@stdlib/blas/base/ndarray/docs/types/index.d.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
/* eslint-disable max-lines */
2222

23+
import caxpy = require( '@stdlib/blas/base/ndarray/caxpy' );
2324
import dasum = require( '@stdlib/blas/base/ndarray/dasum' );
2425
import daxpy = require( '@stdlib/blas/base/ndarray/daxpy' );
2526
import ddot = require( '@stdlib/blas/base/ndarray/ddot' );
@@ -29,11 +30,40 @@ import gdot = require( '@stdlib/blas/base/ndarray/gdot' );
2930
import sasum = require( '@stdlib/blas/base/ndarray/sasum' );
3031
import saxpy = require( '@stdlib/blas/base/ndarray/saxpy' );
3132
import sdot = require( '@stdlib/blas/base/ndarray/sdot' );
33+
import zaxpy = require( '@stdlib/blas/base/ndarray/zaxpy' );
3234

3335
/**
3436
* Interface describing the `ndarray` namespace.
3537
*/
3638
interface Namespace {
39+
/**
40+
* Multiplies a one-dimensional single-precision complex floating-point ndarray `x` by a constant `alpha` and adds the result to a one-dimensional single-precision complex floating-point ndarray `y`.
41+
*
42+
* @param arrays - array-like object containing an input ndarray, an output ndarray, and a zero-dimensional ndarray containing a scalar constant
43+
* @returns output ndarray
44+
*
45+
* @example
46+
* var Complex64Array = require( '@stdlib/array/complex64' );
47+
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
48+
* var scalar2ndarray = require( '@stdlib/ndarray/base/from-scalar' );
49+
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
50+
*
51+
* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] );
52+
* var x = new ndarray( 'complex64', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
53+
*
54+
* var ybuf = new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
55+
* var y = new ndarray( 'complex64', ybuf, [ 5 ], [ 1 ], 0, 'row-major' );
56+
*
57+
* var alpha = scalar2ndarray( new Complex64( 1.0, 2.0 ), 'complex64', 'row-major' );
58+
*
59+
* var z = ns.caxpy( [ x, y, alpha ] );
60+
* // returns <ndarray>[ <Complex64>[ -2.0, 5.0 ], <Complex64>[ -4.0, 11.0 ], <Complex64>[ -6.0, 17.0 ], <Complex64>[ -8.0, 23.0 ], <Complex64>[ -10.0, 29.0 ] ]
61+
*
62+
* var bool = ( z === y );
63+
* // returns true
64+
*/
65+
caxpy: typeof caxpy;
66+
3767
/**
3868
* Computes the sum of absolute values for all elements in a one-dimensional double-precision floating-point ndarray.
3969
*
@@ -228,6 +258,34 @@ interface Namespace {
228258
* // returns -5.0
229259
*/
230260
sdot: typeof sdot;
261+
262+
/**
263+
* Multiplies a one-dimensional double-precision complex floating-point ndarray `x` by a constant `alpha` and adds the result to a one-dimensional double-precision complex floating-point ndarray `y`.
264+
*
265+
* @param arrays - array-like object containing an input ndarray, an output ndarray, and a zero-dimensional ndarray containing a scalar constant
266+
* @returns output ndarray
267+
*
268+
* @example
269+
* var Complex128Array = require( '@stdlib/array/complex128' );
270+
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
271+
* var scalar2ndarray = require( '@stdlib/ndarray/base/from-scalar' );
272+
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
273+
*
274+
* var xbuf = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] );
275+
* var x = new ndarray( 'complex128', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
276+
*
277+
* var ybuf = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
278+
* var y = new ndarray( 'complex128', ybuf, [ 5 ], [ 1 ], 0, 'row-major' );
279+
*
280+
* var alpha = scalar2ndarray( new Complex128( 1.0, 2.0 ), 'complex128', 'row-major' );
281+
*
282+
* var z = ns.zaxpy( [ x, y, alpha ] );
283+
* // returns <ndarray>[ <Complex128>[ -2.0, 5.0 ], <Complex128>[ -4.0, 11.0 ], <Complex128>[ -6.0, 17.0 ], <Complex128>[ -8.0, 23.0 ], <Complex128>[ -10.0, 29.0 ] ]
284+
*
285+
* var bool = ( z === y );
286+
* // returns true
287+
*/
288+
zaxpy: typeof zaxpy;
231289
}
232290

233291
/**

lib/node_modules/@stdlib/blas/base/ndarray/lib/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ setReadOnly( ns, 'dasum', require( '@stdlib/blas/base/ndarray/dasum' ) );
6363
*/
6464
setReadOnly( ns, 'daxpy', require( '@stdlib/blas/base/ndarray/daxpy' ) );
6565

66+
/**
67+
* @name dcopy
68+
* @memberof ns
69+
* @readonly
70+
* @type {Function}
71+
* @see {@link module:@stdlib/blas/base/ndarray/dcopy}
72+
*/
73+
setReadOnly( ns, 'dcopy', require( '@stdlib/blas/base/ndarray/dcopy' ) );
74+
6675
/**
6776
* @name ddot
6877
* @memberof ns
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
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+
# gunitspace
22+
23+
> Fill a strided array with linearly spaced numeric elements which increment by `1` starting from a specified value.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var gunitspace = require( '@stdlib/blas/ext/base/gunitspace' );
31+
```
32+
33+
#### gunitspace( N, start, x, strideX )
34+
35+
Fills a strided array with linearly spaced numeric elements which increment by `1` starting from a specified value.
36+
37+
```javascript
38+
var x = [ 0.0, 0.0, 0.0, 0.0 ];
39+
40+
gunitspace( x.length, 3.0, x, 1 );
41+
// x => [ 3.0, 4.0, 5.0, 6.0 ]
42+
```
43+
44+
The function has the following parameters:
45+
46+
- **N**: number of indexed elements.
47+
- **start**: starting value.
48+
- **x**: input array.
49+
- **strideX**: stride length.
50+
51+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to fill every other element:
52+
53+
```javascript
54+
var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
55+
56+
gunitspace( 3, 3.0, x, 2 );
57+
// x => [ 3.0, 0.0, 4.0, 0.0, 5.0, 0.0 ]
58+
```
59+
60+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
61+
62+
```javascript
63+
var Float64Array = require( '@stdlib/array/float64' );
64+
65+
// Initial array...
66+
var x0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
67+
68+
// Create an offset view...
69+
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
70+
71+
// Fill every other element...
72+
gunitspace( 3, 3.0, x1, 2 );
73+
// x0 => <Float64Array>[ 0.0, 3.0, 0.0, 4.0, 0.0, 5.0 ]
74+
```
75+
76+
#### gunitspace.ndarray( N, start, x, strideX, offsetX )
77+
78+
Fills a strided array with linearly spaced numeric elements which increment by `1` starting from a specified value using alternative indexing semantics.
79+
80+
```javascript
81+
var x = [ 0.0, 0.0, 0.0, 0.0 ];
82+
83+
gunitspace.ndarray( x.length, 3.0, x, 1, 0 );
84+
// x => [ 3.0, 4.0, 5.0, 6.0 ]
85+
```
86+
87+
The function has the following additional parameters:
88+
89+
- **offsetX**: starting index.
90+
91+
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 access only the last three elements:
92+
93+
```javascript
94+
var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
95+
96+
gunitspace.ndarray( 3, 3.0, x, 1, x.length-3 );
97+
// x => [ 0.0, 0.0, 0.0, 3.0, 4.0, 5.0 ]
98+
```
99+
100+
</section>
101+
102+
<!-- /.usage -->
103+
104+
<section class="notes">
105+
106+
## Notes
107+
108+
- If `N <= 0`, both functions return `x` unchanged.
109+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/complex64`][@stdlib/array/complex64]).
110+
111+
</section>
112+
113+
<!-- /.notes -->
114+
115+
<section class="examples">
116+
117+
## Examples
118+
119+
<!-- eslint no-undef: "error" -->
120+
121+
```javascript
122+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
123+
var gunitspace = require( '@stdlib/blas/ext/base/gunitspace' );
124+
125+
var x = discreteUniform( 10, -100, 100, {
126+
'dtype': 'generic'
127+
});
128+
console.log( x );
129+
130+
gunitspace( x.length, 0.0, x, 1 );
131+
console.log( x );
132+
```
133+
134+
</section>
135+
136+
<!-- /.examples -->
137+
138+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
139+
140+
<section class="related">
141+
142+
</section>
143+
144+
<!-- /.related -->
145+
146+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
147+
148+
<section class="links">
149+
150+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
151+
152+
[@stdlib/array/complex64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/complex64
153+
154+
</section>
155+
156+
<!-- /.links -->
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var pow = require( '@stdlib/math/base/special/pow' );
27+
var format = require( '@stdlib/string/format' );
28+
var pkg = require( './../package.json' ).name;
29+
var gunitspace = require( './../lib/main.js' );
30+
31+
32+
// VARIABLES //
33+
34+
var options = {
35+
'dtype': 'generic'
36+
};
37+
38+
39+
// FUNCTIONS //
40+
41+
/**
42+
* Create a benchmark function.
43+
*
44+
* @private
45+
* @param {PositiveInteger} len - array length
46+
* @returns {Function} benchmark function
47+
*/
48+
function createBenchmark( len ) {
49+
var x = uniform( len, -100, 100, options );
50+
return benchmark;
51+
52+
/**
53+
* Benchmark function.
54+
*
55+
* @private
56+
* @param {Benchmark} b - benchmark instance
57+
*/
58+
function benchmark( b ) {
59+
var y;
60+
var i;
61+
62+
b.tic();
63+
for ( i = 0; i < b.iterations; i++ ) {
64+
y = gunitspace( x.length, 0.0, x, 1 );
65+
if ( isnan( y[ i%x.length ] ) ) {
66+
b.fail( 'should not return NaN' );
67+
}
68+
}
69+
b.toc();
70+
if ( isnan( y[ i%x.length ] ) ) {
71+
b.fail( 'should not return NaN' );
72+
}
73+
b.pass( 'benchmark finished' );
74+
b.end();
75+
}
76+
}
77+
78+
79+
// MAIN //
80+
81+
/**
82+
* Main execution sequence.
83+
*
84+
* @private
85+
*/
86+
function main() {
87+
var len;
88+
var min;
89+
var max;
90+
var f;
91+
var i;
92+
93+
min = 1; // 10^min
94+
max = 6; // 10^max
95+
96+
for ( i = min; i <= max; i++ ) {
97+
len = pow( 10, i );
98+
f = createBenchmark( len );
99+
bench( format( '%s:len=%d', pkg, len ), f );
100+
}
101+
}
102+
103+
main();

0 commit comments

Comments
 (0)