Skip to content

Commit 7bf24b8

Browse files
committed
Merge branch 'develop' into stdlib-todo-bot
2 parents 5677fb0 + 3e87387 commit 7bf24b8

171 files changed

Lines changed: 15069 additions & 189 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/contributing/zen_of_stdlib.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ limitations under the License.
2222

2323
# Zen of stdlib
2424

25+
```text
2526
Do one thing. Do it well.
2627
Embrace radical modularity.
2728
Favor composition over configuration.
@@ -56,6 +57,7 @@ Mistakes are infectious.
5657
Fix them early.
5758
5859
Simple is beautiful.
60+
```
5961

6062
* * *
6163

lib/node_modules/@stdlib/assert/is-readable-property/benchmark/benchmark.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
25+
var zeros = require( '@stdlib/array/zeros' );
2526
var pkg = require( './../package.json' ).name;
2627
var isReadableProperty = require( './../lib' );
2728

@@ -33,7 +34,7 @@ bench( pkg, function benchmark( b ) {
3334
var arr;
3435
var i;
3536

36-
arr = new Array( 100 );
37+
arr = zeros( 100, 'generic' );
3738

3839
b.tic();
3940
for ( i = 0; i < b.iterations; i++ ) {

lib/node_modules/@stdlib/blas/base/dgemv/test/test.dgemv.native.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ var cxpyp = require( './fixtures/column_major_xpyp.json' );
3939
var cx = require( './fixtures/column_major_x_zeros.json' );
4040
var cxb = require( './fixtures/column_major_x_zeros_beta_one.json' );
4141
var ca = require( './fixtures/column_major_alpha_zero.json' );
42-
4342
var rnt = require( './fixtures/row_major_nt.json' );
4443
var rt = require( './fixtures/row_major_t.json' );
4544
var rxnyn = require( './fixtures/row_major_xnyn.json' );
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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+
# csscal
22+
23+
> Multiply a one-dimensional single-precision complex floating-point ndarray by a single-precision floating-point scalar constant.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var csscal = require( '@stdlib/blas/base/ndarray/csscal' );
37+
```
38+
39+
#### csscal( arrays )
40+
41+
Multiplies a one-dimensional single-precision complex floating-point ndarray by a single-precision floating-point scalar constant.
42+
43+
```javascript
44+
var Complex64Vector = require( '@stdlib/ndarray/vector/complex64' );
45+
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
46+
47+
var x = new Complex64Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
48+
49+
var alpha = scalar2ndarray( 2.0, {
50+
'dtype': 'float32'
51+
});
52+
53+
var y = csscal( [ x, alpha ] );
54+
// returns <ndarray>[ <Complex64>[ 2.0, 4.0 ], <Complex64>[ 6.0, 8.0 ], <Complex64>[ 10.0, 12.0 ] ]
55+
56+
var bool = ( y === x );
57+
// returns true
58+
```
59+
60+
The function has the following parameters:
61+
62+
- **arrays**: array-like object containing the following ndarrays:
63+
64+
- a one-dimensional input ndarray.
65+
- a zero-dimensional ndarray containing a scalar constant.
66+
67+
</section>
68+
69+
<!-- /.usage -->
70+
71+
<section class="notes">
72+
73+
</section>
74+
75+
<!-- /.notes -->
76+
77+
<section class="examples">
78+
79+
## Examples
80+
81+
<!-- eslint no-undef: "error" -->
82+
83+
```javascript
84+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
85+
var Complex64Vector = require( '@stdlib/ndarray/vector/complex64' );
86+
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
87+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
88+
var csscal = require( '@stdlib/blas/base/ndarray/csscal' );
89+
90+
var opts = {
91+
'dtype': 'float32'
92+
};
93+
94+
var x = new Complex64Vector( discreteUniform( 10, 0, 100, opts ) );
95+
console.log( ndarray2array( x ) );
96+
97+
var alpha = scalar2ndarray( 2.0, {
98+
'dtype': 'float32'
99+
});
100+
101+
var out = csscal( [ x, alpha ] );
102+
console.log( ndarray2array( out ) );
103+
```
104+
105+
</section>
106+
107+
<!-- /.examples -->
108+
109+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
110+
111+
<section class="related">
112+
113+
</section>
114+
115+
<!-- /.related -->
116+
117+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
118+
119+
<section class="links">
120+
121+
</section>
122+
123+
<!-- /.links -->
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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 isnanf = require( '@stdlib/math/base/assert/is-nanf' );
26+
var realf = require( '@stdlib/complex/float32/real' );
27+
var pow = require( '@stdlib/math/base/special/pow' );
28+
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
29+
var Complex64Vector = require( '@stdlib/ndarray/vector/complex64' );
30+
var format = require( '@stdlib/string/format' );
31+
var pkg = require( './../package.json' ).name;
32+
var csscal = require( './../lib' );
33+
34+
35+
// VARIABLES //
36+
37+
var options = {
38+
'dtype': 'float32'
39+
};
40+
41+
42+
// FUNCTIONS //
43+
44+
/**
45+
* Creates a benchmark function.
46+
*
47+
* @private
48+
* @param {PositiveInteger} len - array length
49+
* @returns {Function} benchmark function
50+
*/
51+
function createBenchmark( len ) {
52+
var alpha;
53+
var xbuf;
54+
var x;
55+
56+
xbuf = uniform( len*2, -100.0, 100.0, {
57+
'dtype': 'float32'
58+
});
59+
x = new Complex64Vector( xbuf.buffer );
60+
61+
alpha = scalar2ndarray( 0.8, options );
62+
63+
return benchmark;
64+
65+
/**
66+
* Benchmark function.
67+
*
68+
* @private
69+
* @param {Benchmark} b - benchmark instance
70+
*/
71+
function benchmark( b ) {
72+
var z;
73+
var i;
74+
75+
b.tic();
76+
for ( i = 0; i < b.iterations; i++ ) {
77+
z = csscal( [ x, alpha ] );
78+
if ( typeof z !== 'object' ) {
79+
b.fail( 'should return an ndarray' );
80+
}
81+
}
82+
b.toc();
83+
if ( isnanf( realf( z.get( i%len ) ) ) ) {
84+
b.fail( 'should not return NaN' );
85+
}
86+
b.pass( 'benchmark finished' );
87+
b.end();
88+
}
89+
}
90+
91+
92+
// MAIN //
93+
94+
/**
95+
* Main execution sequence.
96+
*
97+
* @private
98+
*/
99+
function main() {
100+
var len;
101+
var min;
102+
var max;
103+
var f;
104+
var i;
105+
106+
min = 1; // 10^min
107+
max = 6; // 10^max
108+
109+
for ( i = min; i <= max; i++ ) {
110+
len = pow( 10, i );
111+
f = createBenchmark( len );
112+
bench( format( '%s:len=%d', pkg, len ), f );
113+
}
114+
}
115+
116+
main();
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
{{alias}}( arrays )
3+
Multiplies a one-dimensional single-precision complex floating-point ndarray
4+
by a single-precision floating-point scalar constant.
5+
6+
If provided an empty input ndarray, the function returns the input ndarray
7+
unchanged.
8+
9+
Parameters
10+
----------
11+
arrays: ArrayLikeObject<ndarray>
12+
Array-like object containing the following ndarrays:
13+
14+
- a one-dimensional input ndarray.
15+
- a zero-dimensional ndarray containing a scalar constant.
16+
17+
Returns
18+
-------
19+
out: ndarray
20+
Input ndarray.
21+
22+
Examples
23+
--------
24+
> var x = new {{alias:@stdlib/ndarray/vector/complex64}}( [ 4.0, 2.0, -3.0, 5.0 ] );
25+
> var alpha = {{alias:@stdlib/ndarray/from-scalar}}( 2.0, { 'dtype': 'float32' } );
26+
27+
> {{alias}}( [ x, alpha ] );
28+
> x
29+
<ndarray>[ <Complex64>[ 8.0, 4.0 ], <Complex64>[ -6.0, 10.0 ] ]
30+
31+
See Also
32+
--------
33+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
// TypeScript Version: 4.1
20+
21+
/// <reference types="@stdlib/types"/>
22+
23+
import { complex64ndarray, float32ndarray } from '@stdlib/types/ndarray';
24+
25+
/**
26+
* Multiplies a one-dimensional single-precision complex floating-point ndarray by a single-precision floating-point scalar constant.
27+
*
28+
* ## Notes
29+
*
30+
* - The function expects the following ndarrays:
31+
*
32+
* - a one-dimensional input ndarray.
33+
* - a zero-dimensional ndarray containing a scalar constant.
34+
*
35+
* @param arrays - array-like object containing ndarrays
36+
* @returns input ndarray
37+
*
38+
* @example
39+
* var Complex64Vector = require( '@stdlib/ndarray/vector/complex64' );
40+
* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
41+
*
42+
* var x = new Complex64Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
43+
*
44+
* var alpha = scalar2ndarray( 2.0, {
45+
* 'dtype': 'float32'
46+
* });
47+
*
48+
* var y = csscal( [ x, alpha ] );
49+
* // returns <ndarray>[ <Complex64>[ 2.0, 4.0 ], <Complex64>[ 6.0, 8.0 ], <Complex64>[ 10.0, 12.0 ] ]
50+
*
51+
* var bool = ( y === x );
52+
* // returns true
53+
*/
54+
declare function csscal( arrays: [ complex64ndarray, float32ndarray ] ): complex64ndarray;
55+
56+
57+
// EXPORTS //
58+
59+
export = csscal;

0 commit comments

Comments
 (0)