Skip to content

Commit 15e7395

Browse files
committed
Auto-generated commit
1 parent ac21148 commit 15e7395

File tree

13 files changed

+620
-51
lines changed

13 files changed

+620
-51
lines changed

.github/workflows/npm_downloads.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ jobs:
8686
8787
# Upload the download data:
8888
- name: 'Upload data'
89-
# Pin action to full length commit SHA corresponding to v3.1.3
90-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
89+
# Pin action to full length commit SHA
90+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
9191
with:
9292
# Define a name for the uploaded artifact (ensuring a unique name for each job):
9393
name: npm_downloads

.github/workflows/publish.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,10 @@ jobs:
124124
mv ./package.json.tmp ./package.json
125125
fi
126126
done
127-
jq -r '.devDependencies | keys[]' ./package.json | while read -r dep; do
128-
if [[ "$dep" != "@stdlib"* ]]; then
129-
continue
130-
fi
131-
dep=$(echo "$dep" | xargs)
132-
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
133-
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
134-
mv ./package.json.tmp ./package.json
135-
fi
136-
done
127+
128+
# Set `devDependencies` to an empty object:
129+
jq --indent 2 '.devDependencies = {}' ./package.json > ./package.json.tmp
130+
mv ./package.json.tmp ./package.json
137131
138132
# Remove CLI section:
139133
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+?<\!\-\- \/.cli \-\->//"

.github/workflows/test_bundles.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ jobs:
168168

169169
# Install Deno:
170170
- name: 'Install Deno'
171-
# Pin action to full length commit SHA corresponding to v1.1.2
172-
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31
171+
# Pin action to full length commit SHA
172+
uses: denoland/setup-deno@041b854f97b325bd60e53e9dc2de9cb9f9ac0cba # v1.1.4
173173
with:
174174
deno-version: vx.x.x
175175

CONTRIBUTORS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# Contributors listed in alphabetical order.
44

5+
Aditya Sapra <[email protected]>
56
Ali Salesi <[email protected]>
67
Amit Jimiwal <[email protected]>
78
Athan Reines <[email protected]>
@@ -13,6 +14,7 @@ Daniel Killenberger <[email protected]>
1314
Dominik Moritz <[email protected]>
1415
Dorrin Sotoudeh <[email protected]>
1516
Frank Kovacs <[email protected]>
17+
GUNJ JOSHI <[email protected]>
1618
Harshita Kalani <[email protected]>
1719
James Gelok <[email protected]>
1820
Jaysukh Makvana <[email protected]>
@@ -21,6 +23,7 @@ Joey Reed <[email protected]>
2123
Jordan Gallivan <[email protected]>
2224
Joris Labie <[email protected]>
2325
Justin Dennison <[email protected]>
26+
Karthik Prakash <[email protected]>
2427
Marcus Fantham <[email protected]>
2528
Matt Cochrane <[email protected]>
2629
Milan Raj <[email protected]>
@@ -36,6 +39,7 @@ Roman Stetsyk <[email protected]>
3639
Ryan Seal <[email protected]>
3740
Seyyed Parsa Neshaei <[email protected]>
3841
Shraddheya Shendre <[email protected]>
42+
Spandan Barve <[email protected]>
3943
Stephannie Jiménez Gacha <[email protected]>
4044
Yernar Yergaziyev <[email protected]>
4145
orimiles5 <[email protected]>

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,60 @@ var count = context.count;
16551655
// returns 3
16561656
```
16571657

1658+
<a name="method-reduce"></a>
1659+
1660+
#### Complex64Array.prototype.reduce( reducerFn\[, initialValue] )
1661+
1662+
Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.
1663+
1664+
```javascript
1665+
var realf = require( '@stdlib/complex-realf' );
1666+
var imagf = require( '@stdlib/complex-imagf' );
1667+
var caddf = require( '@stdlib/math-base-ops-caddf' );
1668+
1669+
var arr = new Complex64Array( 3 );
1670+
1671+
arr.set( [ 1.0, 1.0 ], 0 );
1672+
arr.set( [ 2.0, 2.0 ], 1 );
1673+
arr.set( [ 3.0, 3.0 ], 2 );
1674+
1675+
var z = arr.reduce( caddf );
1676+
// returns <Complex64>
1677+
1678+
var re = realf( z );
1679+
// returns 6.0
1680+
1681+
var im = imagf( z );
1682+
// returns 6.0
1683+
```
1684+
1685+
The reducer function is provided four arguments:
1686+
1687+
- **acc**: accumulated result.
1688+
- **value**: current array element.
1689+
- **index**: current array element index.
1690+
- **arr**: the array on which this method was called.
1691+
1692+
By default, the function initializes the accumulated result to the first element in the array and passes the second array element as `value` during the first invocation of the provided callback. To begin accumulation from a different starting value and pass in the first array element as `value` during the first invocation of the provided callback, provide an `initialValue` argument.
1693+
1694+
```javascript
1695+
var realf = require( '@stdlib/complex-realf' );
1696+
1697+
function reducer( acc, v ) {
1698+
acc += realf( v );
1699+
return acc;
1700+
}
1701+
1702+
var arr = new Complex64Array( 3 );
1703+
1704+
arr.set( [ 1.0, 1.0 ], 0 );
1705+
arr.set( [ 2.0, 2.0 ], 1 );
1706+
arr.set( [ 3.0, 3.0 ], 2 );
1707+
1708+
var z = arr.reduce( reducer, 0.0 );
1709+
// returns 6.0
1710+
```
1711+
16581712
<a name="method-reverse"></a>
16591713

16601714
#### Complex64Array.prototype.reverse()
@@ -2312,8 +2366,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
23122366
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-complex64.svg
23132367
[npm-url]: https://npmjs.org/package/@stdlib/array-complex64
23142368

2315-
[test-image]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml/badge.svg?branch=v0.2.0
2316-
[test-url]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml?query=branch:v0.2.0
2369+
[test-image]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml/badge.svg?branch=main
2370+
[test-url]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml?query=branch:main
23172371

23182372
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-complex64/main.svg
23192373
[coverage-url]: https://codecov.io/github/stdlib-js/array-complex64?branch=main

benchmark/benchmark.reduce.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 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-harness' );
24+
var caddf = require( '@stdlib/math-base-ops-caddf' );
25+
var isComplexLike = require('@stdlib/assert-is-complex-like');
26+
var pkg = require( './../package.json' ).name;
27+
var Complex64Array = require( './../lib' );
28+
29+
30+
// MAIN //
31+
32+
bench( pkg+':reduce', function benchmark( b ) {
33+
var out;
34+
var arr;
35+
var i;
36+
37+
arr = new Complex64Array( [ 1, 2, 3, 4, 5, 6 ] );
38+
39+
b.tic();
40+
for ( i = 0; i < b.iterations; i++ ) {
41+
out = arr.reduce( caddf );
42+
if ( typeof out !== 'object' ) {
43+
b.fail( 'should return an object' );
44+
}
45+
}
46+
b.toc();
47+
if ( !isComplexLike( out ) ) {
48+
b.fail( 'should return a complex number' );
49+
}
50+
b.pass( 'benchmark finished' );
51+
b.end();
52+
});

benchmark/benchmark.reduce.length.js

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) 2023 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-harness' );
24+
var pow = require( '@stdlib/math-base-special-pow' );
25+
var caddf = require( '@stdlib/math-base-ops-caddf' );
26+
var isComplexLike = require('@stdlib/assert-is-complex-like');
27+
var Complex64 = require( '@stdlib/complex-float32' );
28+
var pkg = require( './../package.json' ).name;
29+
var Complex64Array = require( './../lib' );
30+
31+
32+
// FUNCTIONS //
33+
34+
/**
35+
* Creates a benchmark function.
36+
*
37+
* @private
38+
* @param {PositiveInteger} len - array length
39+
* @returns {Function} benchmark function
40+
*/
41+
function createBenchmark( len ) {
42+
var arr;
43+
var i;
44+
45+
arr = [];
46+
for ( i = 0; i < len; i++ ) {
47+
arr.push( new Complex64( i, i ) );
48+
}
49+
arr = new Complex64Array( arr );
50+
51+
return benchmark;
52+
53+
/**
54+
* Benchmark function.
55+
*
56+
* @private
57+
* @param {Benchmark} b - benchmark instance
58+
*/
59+
function benchmark( b ) {
60+
var out;
61+
var i;
62+
63+
b.tic();
64+
for ( i = 0; i < b.iterations; i++ ) {
65+
out = arr.reduce( caddf );
66+
if ( typeof out !== 'object' ) {
67+
b.fail( 'should return an object' );
68+
}
69+
}
70+
b.toc();
71+
if ( !isComplexLike( out ) ) {
72+
b.fail( 'should return a complex number' );
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( pkg+':reduce:len='+len, f );
101+
}
102+
}
103+
104+
main();

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)