Skip to content

Commit 95e6ef9

Browse files
committed
Auto-generated commit
1 parent 983ada6 commit 95e6ef9

File tree

8 files changed

+224
-232
lines changed

8 files changed

+224
-232
lines changed

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,28 @@ This release closes the following issue:
16091609

16101610
<!-- /.package -->
16111611

1612+
<section class="package" id="array-full-like-unreleased">
1613+
1614+
#### [@stdlib/array/full-like](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/full-like)
1615+
1616+
<details>
1617+
1618+
<section class="features">
1619+
1620+
##### Features
1621+
1622+
- [`bddc8fa`](https://github.com/stdlib-js/stdlib/commit/bddc8fac1c445fe07cae159c3697ad2734432657) - add boolean dtype support to `array/full-like` [(#2462)](https://github.com/stdlib-js/stdlib/pull/2462)
1623+
1624+
</section>
1625+
1626+
<!-- /.features -->
1627+
1628+
</details>
1629+
1630+
</section>
1631+
1632+
<!-- /.package -->
1633+
16121634
<section class="package" id="array-index-unreleased">
16131635

16141636
#### [@stdlib/array/index](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/index)
@@ -2262,6 +2284,7 @@ A total of 13 people contributed to this release. Thank you to the following con
22622284

22632285
<details>
22642286

2287+
- [`bddc8fa`](https://github.com/stdlib-js/stdlib/commit/bddc8fac1c445fe07cae159c3697ad2734432657) - **feat:** add boolean dtype support to `array/full-like` [(#2462)](https://github.com/stdlib-js/stdlib/pull/2462) _(by Jaysukh Makvana, Athan Reines)_
22652288
- [`3fdfa90`](https://github.com/stdlib-js/stdlib/commit/3fdfa902945e503766b1ae4592a2d094efb0ff7f) - **feat:** add boolean dtype support to `array/full` [(#2461)](https://github.com/stdlib-js/stdlib/pull/2461) _(by Jaysukh Makvana, Athan Reines)_
22662289
- [`b586995`](https://github.com/stdlib-js/stdlib/commit/b586995441d335964383ac2d3195ab9a55e091f4) - **feat:** add boolean dtype support to `array/base/mskreject` [(#2452)](https://github.com/stdlib-js/stdlib/pull/2452) _(by Jaysukh Makvana, Athan Reines)_
22672290
- [`c04e29b`](https://github.com/stdlib-js/stdlib/commit/c04e29bf919dcc5f1368fecd977db696041ff8db) - **feat:** add boolean dtype support to `array/base/mskfilter` [(#2450)](https://github.com/stdlib-js/stdlib/pull/2450) _(by Jaysukh Makvana, Athan Reines)_

full-like/README.md

+6-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@license Apache-2.0
44
5-
Copyright (c) 2022 The Stdlib Authors.
5+
Copyright (c) 2024 The Stdlib Authors.
66
77
Licensed under the Apache License, Version 2.0 (the "License");
88
you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ var fullLike = require( '@stdlib/array/full-like' );
4242

4343
#### fullLike( x, value\[, dtype] )
4444

45-
Creates a filled array having the same length and data type as a provided array `x`.
45+
Creates a filled array having the same length and [data type][@stdlib/array/dtypes] as a provided array `x`.
4646

4747
```javascript
4848
var x = [ 1, 2, 3, 4, 5 ];
@@ -51,22 +51,7 @@ var arr = fullLike( x, 1 );
5151
// returns [ 1, 1, 1, 1, 1 ]
5252
```
5353

54-
The function supports the following data types:
55-
56-
- `float64`: double-precision floating-point numbers (IEEE 754)
57-
- `float32`: single-precision floating-point numbers (IEEE 754)
58-
- `complex128`: double-precision complex floating-point numbers
59-
- `complex64`: single-precision complex floating-point numbers
60-
- `int32`: 32-bit two's complement signed integers
61-
- `uint32`: 32-bit unsigned integers
62-
- `int16`: 16-bit two's complement signed integers
63-
- `uint16`: 16-bit unsigned integers
64-
- `int8`: 8-bit two's complement signed integers
65-
- `uint8`: 8-bit unsigned integers
66-
- `uint8c`: 8-bit unsigned integers clamped to `0-255`
67-
- `generic`: generic JavaScript values
68-
69-
By default, the output array data type is inferred from the provided array `x`. To return an array having a different data type, provide a `dtype` argument.
54+
By default, the output array [data type][@stdlib/array/dtypes] is inferred from the provided array `x`. To return an array having a different [data type][@stdlib/array/dtypes], provide a `dtype` argument.
7055

7156
```javascript
7257
var x = [ 1, 1 ];
@@ -85,7 +70,7 @@ var arr = fullLike( x, 1, 'int32' );
8570

8671
## Notes
8772

88-
- If provided a number and the output array data type is a complex number data type, the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
73+
- If provided a number and the output array [data type][@stdlib/array/dtypes] is a complex number [data type][@stdlib/array/dtypes], the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
8974

9075
</section>
9176

@@ -151,6 +136,8 @@ for ( i = 0; i < dt.length; i++ ) {
151136

152137
<section class="links">
153138

139+
[@stdlib/array/dtypes]: https://github.com/stdlib-js/array/tree/main/dtypes
140+
154141
<!-- <related-links> -->
155142

156143
[@stdlib/array/full]: https://github.com/stdlib-js/array/tree/main/full

full-like/benchmark/benchmark.js

+22
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,28 @@ bench( pkg+':dtype=float32', function benchmark( b ) {
9898
b.end();
9999
});
100100

101+
bench( pkg+':dtype=bool', function benchmark( b ) {
102+
var arr;
103+
var x;
104+
var i;
105+
106+
x = zeros( 0, 'bool' );
107+
108+
b.tic();
109+
for ( i = 0; i < b.iterations; i++ ) {
110+
arr = fullLike( x, true );
111+
if ( arr.length !== 0 ) {
112+
b.fail( 'should have length 0' );
113+
}
114+
}
115+
b.toc();
116+
if ( !isTypedArrayLike( arr ) ) {
117+
b.fail( 'should return a typed array' );
118+
}
119+
b.pass( 'benchmark finished' );
120+
b.end();
121+
});
122+
101123
bench( pkg+':dtype=complex128', function benchmark( b ) {
102124
var arr;
103125
var z;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 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 pow = require( '@stdlib/math/base/special/pow' );
25+
var isTypedArrayLike = require( '@stdlib/assert/is-typed-array-like' );
26+
var zeros = require( './../../zeros' );
27+
var pkg = require( './../package.json' ).name;
28+
var fullLike = 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 x = zeros( len, 'bool' );
42+
return benchmark;
43+
44+
/**
45+
* Benchmark function.
46+
*
47+
* @private
48+
* @param {Benchmark} b - benchmark instance
49+
*/
50+
function benchmark( b ) {
51+
var arr;
52+
var i;
53+
54+
b.tic();
55+
for ( i = 0; i < b.iterations; i++ ) {
56+
arr = fullLike( x, true );
57+
if ( arr.length !== len ) {
58+
b.fail( 'unexpected length' );
59+
}
60+
}
61+
b.toc();
62+
if ( !isTypedArrayLike( arr ) ) {
63+
b.fail( 'should return a typed array' );
64+
}
65+
b.pass( 'benchmark finished' );
66+
b.end();
67+
}
68+
}
69+
70+
71+
// MAIN //
72+
73+
/**
74+
* Main execution sequence.
75+
*
76+
* @private
77+
*/
78+
function main() {
79+
var len;
80+
var min;
81+
var max;
82+
var f;
83+
var i;
84+
85+
min = 1; // 10^min
86+
max = 6; // 10^max
87+
88+
for ( i = min; i <= max; i++ ) {
89+
len = pow( 10, i );
90+
f = createBenchmark( len );
91+
bench( pkg+':dtype=bool,len='+len, f );
92+
}
93+
}
94+
95+
main();

full-like/docs/repl.txt

-15
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,6 @@
33
Returns a filled array having the same length and data type as a provided
44
input array.
55

6-
The function supports the following data types:
7-
8-
- float64: double-precision floating-point numbers (IEEE 754)
9-
- float32: single-precision floating-point numbers (IEEE 754)
10-
- complex128: double-precision complex floating-point numbers
11-
- complex64: single-precision complex floating-point numbers
12-
- int32: 32-bit two's complement signed integers
13-
- uint32: 32-bit unsigned integers
14-
- int16: 16-bit two's complement signed integers
15-
- uint16: 16-bit unsigned integers
16-
- int8: 8-bit two's complement signed integers
17-
- uint8: 8-bit unsigned integers
18-
- uint8c: 8-bit unsigned integers clamped to 0-255
19-
- generic: generic JavaScript values
20-
216
Parameters
227
----------
238
x: TypedArray|Array

0 commit comments

Comments
 (0)