10000 Auto-generated commit · stdlib-js/array-complex128@7be1b40 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 7be1b40

Browse files
committed
Auto-generated commit
1 parent 986401d commit 7be1b40

13 files changed

+767
-53
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Joey Reed <joeyrreed@gmail.com>
2121
Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
2222
Joris Labie <joris.labie1@gmail.com>
2323
Justin Dennison <justin1dennison@gmail.com>
< 9E88 /td>24+
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
2425
Marcus Fantham <mfantham@users.noreply.github.com>
2526
Matt Cochrane <matthew.cochrane.eng@gmail.com>
2627
Milan Raj <rajsite@users.noreply.github.com>

README.md

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,100 @@ A few notes:
18321832
- If a target array cannot accommodate all values (i.e., the length of source array plus `i` exceeds the target array length), the method throws an error.
18331833
- If provided a [typed array][@stdlib/array/typed] which shares an [`ArrayBuffer`][@stdlib/array/buffer] with the target array, the method will intelligently copy the source range to the destination range.
18341834

1835+
<a name="method-slice"></a>
1836+
1837+
#### Complex128Array.prototype.slice( \[start\[, end]] )
1838+
1839+
Copies a portion of a typed array to a new typed array.
1840+
1841+
```javascript
1842+
var real = require( '@stdlib/complex-real' );
1843+
var imag = require( '@stdlib/complex-imag' );
1844+
1845+
var arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
1846+
1847+
var out = arr.slice();
1848+
// returns <Complex128Array>
1849+
1850+
var len = out.length;
1851+
// returns 4
1852+
1853+
var z = out.get( 0 );
1854+
// returns <Complex128>
1855+
1856+
var re = real( z );
1857+
// returns 1.0
1858+
1859+
var im = imag( z );
1860+
// returns 2.0
1861+
1862+
z = out.get( len-1 );
1863+
// returns <Complex128>
1864+
1865+
re = real( z );
1866+
// returns 7.0
1867+
1868+
im = imag( z );
1869+
// returns 8.0
1870+
```
1871+
1872+
By default, the method returns a typed array beginning with the first array element. To specify an alternative array index at which to begin, provide a `start` index (inclusive).
1873+
1874+
```javascript
1875+
var imag = require( '@stdlib/complex-imag' );
1876+
var real = require( '@stdlib/complex-real' );
1877+
1878+
var arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
1879+
1880+
var out = arr.slice( 1 );
1881+
// returns <Complex128Array>
1882+
1883+
var len = out.length;
1884+
// returns 3
1885+
1886+
var z = out.get( 0 );
1887+
// returns <Complex128>
1888+
1889+
var re = real( z );
1890+
// returns 3.0
1891+
1892+
var im = imag( z );
1893+
// returns 4.0
1894+
```
1895+
1896+
By default, the method returns a typed array which includes all array elements after `start`. To limit the number of array elements after `start`, provide an `end` index (exclusive).
1897+
1898+
```javascript
1899+
var real = require( '@stdlib/complex-real' );
1900+
var imag = require( '@stdlib/complex-imag' );
1901+
1902+
var arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
1903+
1904+
var out = arr.slice( 1, -1 );
1905+
// returns <Complex128Array>
1906+
1907+
var len = out.length;
1908+
// returns 2
1909+
1910+
var z = out.get( 0 );
1911+
// returns <Complex128>
1912+
1913+
var re = real( z );
1914+
// returns 3.0
1915+
1916+
var im = imag( z );
1917+
// returns 4.0
1918+
1919+
z = out.get( len-1 );
1920+
// returns <Complex128>
1921+
1922+
re = real( z );
1923+
// returns 5.0
1924+
1925+
im = imag( z );
1926+
// returns 6.0
1927+
```
1928+
18351929
<a name="method-some"></a>
18361930

18371931
#### Complex128Array.prototype.some( predicate\[, thisArg] )
@@ -2216,8 +2310,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
22162310
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-complex128.svg
22172311
[npm-url]: https://npmjs.org/package/@stdlib/array-complex128
22182312

2219-
[test-image]: https://github.com/stdlib-js/array-complex128/actions/workflows/test.yml/badge.svg?branch=v0.2.0
2220-
[test-url]: https://github.com/stdlib-js/array-complex128/actions/workflows/test.yml?query=branch:v0.2.0
2313+
[test-image]: https://github.com/stdlib-js/array-complex128/actions/workflows/test.yml/badge.svg?branch=main
2314+
[test-url]: https://github.com/stdlib-js/array-complex128/actions/workflows/test.yml?query=branch:main
22212315

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

benchmark/benchmark.slice.js

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

benchmark/benchmark.slice.length.js

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

0 commit comments

Comments
 (0)
0