Skip to content

Commit fde21a1

Browse files
authored
Merge branch 'develop' into nd/base-diag
2 parents 12d678c + 642af21 commit fde21a1

71 files changed

Lines changed: 5608 additions & 135 deletions

File tree

Some content is hidden

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

docs/talks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ limitations under the License.
3232
3333
<div class="image" align="center">
3434
<a title="Bringing Complex Computations To Browsers With Open Source" href="https://youtu.be/rox9LZz_ffI">
35-
<img width="480" src="" alt="Bringing Complex Computations To Browsers With Open Source">
35+
<img width="480" src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@59a6ae8e735cabb5db1603d36ca6d0693f8184b4/docs/assets/talks/hpsf_conference_2026_gunj_joshi.png" alt="Bringing Complex Computations To Browsers With Open Source">
3636
</a>
3737
<br>
3838
</div>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 tape = require( 'tape' );
24+
var lint = require( './../lib' );
25+
26+
27+
// TESTS //
28+
29+
tape( 'main export is a function', function test( t ) {
30+
t.ok( true, __filename );
31+
t.strictEqual( typeof lint, 'function', 'main export is a function' );
32+
t.end();
33+
});
34+
35+
tape( 'attached to the main export is a method to synchronously lint namespace aliases', function test( t ) {
36+
t.strictEqual( typeof lint.sync, 'function', 'has sync method' );
37+
t.end();
38+
});

lib/node_modules/@stdlib/_tools/lint/pkg-json-names/lib/async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var debug = logger( 'lint:pkg-json-names:async' );
4444
* @param {string} [options.dir] - root directory from which to search for package.json files to lint
4545
* @param {string} [options.pattern] - glob pattern
4646
* @param {(string|StringArray)} [options.ignore] - glob pattern(s) to exclude
47-
* @param {Function} clbk - callback to invoke upon completion
47+
* @param {Callback} clbk - callback to invoke upon completion
4848
* @throws {TypeError} must provide valid options
4949
* @throws {TypeError} callback argument must be a function
5050
*

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ The namespace exposes the following APIs:
6060
- <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>
6161
- <span class="signature">[`scopy( arrays )`][@stdlib/blas/base/ndarray/scopy]</span><span class="delimiter">: </span><span class="description">copy values from a one-dimensional single-precision floating-point ndarray `x` into a one-dimensional single-precision floating-point ndarray `y`.</span>
6262
- <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>
63+
- <span class="signature">[`sswap( arrays )`][@stdlib/blas/base/ndarray/sswap]</span><span class="delimiter">: </span><span class="description">interchange two one-dimensional single-precision floating-point ndarrays.</span>
6364
- <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>
6465
- <span class="signature">[`zcopy( arrays )`][@stdlib/blas/base/ndarray/zcopy]</span><span class="delimiter">: </span><span class="description">copy values from a one-dimensional double-precision complex floating-point ndarray `x` into a one-dimensional double-precision complex floating-point ndarray `y`.</span>
6566

@@ -134,6 +135,8 @@ console.log( objectKeys( ns ) );
134135

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

138+
[@stdlib/blas/base/ndarray/sswap]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/sswap
139+
137140
[@stdlib/blas/base/ndarray/zaxpy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/zaxpy
138141

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

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import sasum = require( '@stdlib/blas/base/ndarray/sasum' );
3535
import saxpy = require( '@stdlib/blas/base/ndarray/saxpy' );
3636
import scopy = require( '@stdlib/blas/base/ndarray/scopy' );
3737
import sdot = require( '@stdlib/blas/base/ndarray/sdot' );
38+
import sswap = require( '@stdlib/blas/base/ndarray/sswap' );
3839
import zaxpy = require( '@stdlib/blas/base/ndarray/zaxpy' );
3940
import zcopy = require( '@stdlib/blas/base/ndarray/zcopy' );
4041

@@ -449,6 +450,34 @@ interface Namespace {
449450
*/
450451
sdot: typeof sdot;
451452

453+
/**
454+
* Interchanges two one-dimensional single-precision floating-point ndarrays.
455+
*
456+
* ## Notes
457+
*
458+
* - The function expects the following ndarrays:
459+
*
460+
* - first one-dimensional input ndarray.
461+
* - second one-dimensional input ndarray.
462+
*
463+
* @param arrays - array-like object containing ndarrays
464+
* @returns second input ndarray
465+
*
466+
* @example
467+
* var Float32Vector = require( '@stdlib/ndarray/vector/float32' );
468+
*
469+
* var x = new Float32Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
470+
* var y = new Float32Vector( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] );
471+
*
472+
* var z = ns.sswap( [ x, y ] );
473+
* // x => <ndarray>[ 6.0, 7.0, 8.0, 9.0, 10.0 ]
474+
* // y => <ndarray>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
475+
*
476+
* var bool = ( z === y );
477+
* // returns true
478+
*/
479+
sswap: typeof sswap;
480+
452481
/**
453482
* 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`.
454483
*
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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+
# gswap
22+
23+
> Interchange two one-dimensional ndarrays.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var gswap = require( '@stdlib/blas/base/ndarray/gswap' );
37+
```
38+
39+
#### gswap( arrays )
40+
41+
Interchanges two one-dimensional ndarrays.
42+
43+
```javascript
44+
var vector = require( '@stdlib/ndarray/vector/ctor' );
45+
46+
var x = vector( [ 1.0, 2.0, 3.0, 4.0, 5.0 ], 'generic' );
47+
var y = vector( [ 6.0, 7.0, 8.0, 9.0, 10.0 ], 'generic' );
48+
49+
var z = gswap( [ x, y ] );
50+
// x => <ndarray>[ 6.0, 7.0, 8.0, 9.0, 10.0 ]
51+
// y => <ndarray>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
52+
53+
var bool = ( z === y );
54+
// returns true
55+
```
56+
57+
The function has the following parameters:
58+
59+
- **arrays**: array-like object containing the following ndarrays:
60+
61+
- first one-dimensional input ndarray.
62+
- second one-dimensional input ndarray.
63+
64+
</section>
65+
66+
<!-- /.usage -->
67+
68+
<section class="notes">
69+
70+
</section>
71+
72+
<!-- /.notes -->
73+
74+
<section class="examples">
75+
76+
## Examples
77+
78+
<!-- eslint no-undef: "error" -->
79+
80+
```javascript
81+
var discreteUniform = require( '@stdlib/random/discrete-uniform' );
82+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
83+
var gswap = require( '@stdlib/blas/base/ndarray/gswap' );
84+
85+
var opts = {
86+
'dtype': 'generic'
87+
};
88+
89+
var x = discreteUniform( [ 10 ], 0, 100, opts );
90+
console.log( ndarray2array( x ) );
91+
92+
var y = discreteUniform( [ 10 ], 0, 100, opts );
93+
console.log( ndarray2array( y ) );
94+
95+
var out = gswap( [ x, y ] );
96+
console.log( ndarray2array( x ) );
97+
console.log( ndarray2array( out ) );
98+
```
99+
100+
</section>
101+
102+
<!-- /.examples -->
103+
104+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
105+
106+
<section class="related">
107+
108+
</section>
109+
110+
<!-- /.related -->
111+
112+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
113+
114+
<section class="links">
115+
116+
</section>
117+
118+
<!-- /.links -->
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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/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 gswap = require( './../lib' );
30+
31+
32+
// VARIABLES //
33+
34+
var options = {
35+
'dtype': 'generic'
36+
};
37+
38+
39+
// FUNCTIONS //
40+
41+
/**
42+
* Creates 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.0, 100.0, options );
50+
var y = uniform( [ len ], -100.0, 100.0, options );
51+
return benchmark;
52+
53+
/**
54+
* Benchmark function.
55+
*
56+
* @private
57+
* @param {Benchmark} b - benchmark instance
58+
*/
59+
function benchmark( b ) {
60+
var z;
61+
var i;
62+
63+
b.tic();
64+
for ( i = 0; i < b.iterations; i++ ) {
65+
z = gswap( [ x, y ] );
66+
if ( typeof z !== 'object' ) {
67+
b.fail( 'should return an ndarray' );
68+
}
69+
}
70+
b.toc();
71+
if ( isnan( z.get( i%len ) ) ) {
72+
b.fail( 'should not return NaN' );
73+
}
74+
b.pass( 'benchmark finished' );
75+
b.end();
76+
}
77+
}
78+
79+
80+
// MAIN //
81+
82+
/**
83+
* Main execution sequence.
84+
*
85+
* @private
86+
*/
87+
function main() {
88+
var len;
89+
var min;
90+
var max;
91+
var f;
92+
var i;
93+
94+
min = 1; // 10^min
95+
max = 6; // 10^max
96+
97+
for ( i = min; i <= max; i++ ) {
98+
len = pow( 10, i );
99+
f = createBenchmark( len );
100+
bench( format( '%s:len=%d', pkg, len ), f );
101+
}
102+
}
103+
104+
main();
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
{{alias}}( arrays )
3+
Interchanges two one-dimensional ndarrays.
4+
5+
If provided an empty input ndarray, the function returns the output ndarray
6+
unchanged.
7+
8+
Parameters
9+
----------
10+
arrays: ArrayLikeObject<ndarray>
11+
Array-like object containing the following ndarrays:
12+
13+
- first one-dimensional input ndarray.
14+
- second one-dimensional input ndarray.
15+
16+
Returns
17+
-------
18+
out: ndarray
19+
The second input ndarray.
20+
21+
Examples
22+
--------
23+
> var x = {{alias:@stdlib/ndarray/vector/ctor}}( [ 4.0, 2.0, -3.0 ], 'generic' );
24+
> var y = {{alias:@stdlib/ndarray/vector/ctor}}( [ 0.0, 0.0, 0.0 ], 'generic' );
25+
26+
> {{alias}}( [ x, y ] );
27+
> x
28+
<ndarray>[ 0.0, 0.0, 0.0 ]
29+
> y
30+
<ndarray>[ 4.0, 2.0, -3.0 ]
31+
32+
See Also
33+
--------
34+

0 commit comments

Comments
 (0)