Skip to content

Commit 983ada6

Browse files
committed
Auto-generated commit
1 parent 7965a2a commit 983ada6

File tree

8 files changed

+137
-51
lines changed

8 files changed

+137
-51
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-06-25)
7+
## Unreleased (2024-06-26)
88

99
<section class="packages">
1010

@@ -1596,6 +1596,7 @@ This release closes the following issue:
15961596

15971597
##### Features
15981598

1599+
- [`3fdfa90`](https://github.com/stdlib-js/stdlib/commit/3fdfa902945e503766b1ae4592a2d094efb0ff7f) - add boolean dtype support to `array/full` [(#2461)](https://github.com/stdlib-js/stdlib/pull/2461)
15991600
- [`819d2e4`](https://github.com/stdlib-js/stdlib/commit/819d2e407146d4dcc17f8bab53b591b3d573f8a1) - add data type maps and replace use of overloads [(#1317)](https://github.com/stdlib-js/stdlib/pull/1317)
16001601

16011602
</section>
@@ -2261,6 +2262,7 @@ A total of 13 people contributed to this release. Thank you to the following con
22612262

22622263
<details>
22632264

2265+
- [`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)_
22642266
- [`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)_
22652267
- [`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)_
22662268
- [`760979b`](https://github.com/stdlib-js/stdlib/commit/760979b6efafb5c235daa718c17d7eb5cef82237) - **feat:** add boolean dtype support to `array/base/take` [(#2453)](https://github.com/stdlib-js/stdlib/pull/2453) _(by Jaysukh Makvana, Athan Reines)_

full/README.md

Lines changed: 4 additions & 17 deletions
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.
@@ -49,22 +49,7 @@ var arr = full( 2, 1.0 );
4949
// returns <Float64Array>[ 1.0, 1.0 ]
5050
```
5151

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

6954
```javascript
7055
var arr = full( 2, 1, 'int32' );
@@ -141,6 +126,8 @@ for ( i = 0; i < dt.length; i++ ) {
141126

142127
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
143128

129+
[@stdlib/array/dtypes]: https://github.com/stdlib-js/array/tree/main/dtypes
130+
144131
<!-- <related-links> -->
145132

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

full/benchmark/benchmark.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2022 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -85,6 +85,25 @@ bench( pkg+':dtype=float32', function benchmark( b ) {
8585
b.end();
8686
});
8787

88+
bench( pkg+':dtype=bool', function benchmark( b ) {
89+
var arr;
90+
var i;
91+
92+
b.tic();
93+
for ( i = 0; i < b.iterations; i++ ) {
94+
arr = full( 0, true, 'bool' );
95+
if ( arr.length !== 0 ) {
96+
b.fail( 'should have length 0' );
97+
}
98+
}
99+
b.toc();
100+
if ( !isTypedArrayLike( arr ) ) {
101+
b.fail( 'should return a typed array' );
102+
}
103+
b.pass( 'benchmark finished' );
104+
b.end();
105+
});
106+
88107
bench( pkg+':dtype=complex128', function benchmark( b ) {
89108
var arr;
90109
var v;
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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 pkg = require( './../package.json' ).name;
27+
var full = require( './../lib' );
28+
29+
30+
// FUNCTIONS //
31+
32+
/**
33+
* Creates a benchmark function.
34+
*
35+
* @private
36+
* @param {PositiveInteger} len - array length
37+
* @returns {Function} benchmark function
38+
*/
39+
function createBenchmark( len ) {
40+
return benchmark;
41+
42+
/**
43+
* Benchmark function.
44+
*
45+
* @private
46+
* @param {Benchmark} b - benchmark instance
47+
*/
48+
function benchmark( b ) {
49+
var arr;
50+
var i;
51+
52+
b.tic();
53+
for ( i = 0; i < b.iterations; i++ ) {
54+
arr = full( len, true, 'bool' );
55+
if ( arr.length !== len ) {
56+
b.fail( 'unexpected length' );
57+
}
58+
}
59+
b.toc();
60+
if ( !isTypedArrayLike( arr ) ) {
61+
b.fail( 'should return a typed array' );
62+
}
63+
b.pass( 'benchmark finished' );
64+
b.end();
65+
}
66+
}
67+
68+
69+
// MAIN //
70+
71+
/**
72+
* Main execution sequence.
73+
*
74+
* @private
75+
*/
76+
function main() {
77+
var len;
78+
var min;
79+
var max;
80+
var f;
81+
var i;
82+
83+
min = 1; // 10^min
84+
max = 6; // 10^max
85+
86+
for ( i = min; i <= max; i++ ) {
87+
len = pow( 10, i );
88+
f = createBenchmark( len );
89+
bench( pkg+':dtype=bool,len='+len, f );
90+
}
91+
}
92+
93+
main();

full/docs/repl.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,6 @@
22
{{alias}}( length, value[, dtype] )
33
Returns a filled array having a specified length.
44

5-
The function supports the following data types:
6-
7-
- float64: double-precision floating-point numbers (IEEE 754)
8-
- float32: single-precision floating-point numbers (IEEE 754)
9-
- complex128: double-precision complex floating-point numbers
10-
- complex64: single-precision complex floating-point numbers
11-
- int32: 32-bit two's complement signed integers
12-
- uint32: 32-bit unsigned integers
13-
- int16: 16-bit two's complement signed integers
14-
- uint16: 16-bit unsigned integers
15-
- int8: 8-bit two's complement signed integers
16-
- uint8: 8-bit unsigned integers
17-
- uint8c: 8-bit unsigned integers clamped to 0-255
18-
- generic: generic JavaScript values
19-
20-
The default array data type is `float64`.
21-
225
Parameters
236
----------
247
length: integer

full/docs/types/index.d.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ import { DataTypeMap } from '@stdlib/types/array';
2525
/**
2626
* Creates a filled array having a specified length.
2727
*
28-
* The function recognizes the following data types:
29-
*
30-
* - `float64`: double-precision floating-point numbers (IEEE 754)
31-
* - `float32`: single-precision floating-point numbers (IEEE 754)
32-
* - `complex128`: double-precision complex floating-point numbers
33-
* - `complex64`: single-precision complex floating-point numbers
34-
* - `int32`: 32-bit two's complement signed integers
35-
* - `uint32`: 32-bit unsigned integers
36-
* - `int16`: 16-bit two's complement signed integers
37-
* - `uint16`: 16-bit unsigned integers
38-
* - `int8`: 8-bit two's complement signed integers
39-
* - `uint8`: 8-bit unsigned integers
40-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
41-
* - `generic`: generic JavaScript values
42-
*
4328
* @param length - array length
4429
* @param value - fill value
4530
* @param dtype - data type (default: 'float64')

full/docs/types/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import full = require( './index' );
3131
full( 10, 1, 'float32' ); // $ExpectType Float32Array
3232
full( 10, z, 'complex128' ); // $ExpectType Complex128Array
3333
full( 10, z, 'complex64' ); // $ExpectType Complex64Array
34+
full( 10, true, 'bool' ); // $ExpectType BooleanArray
3435
full( 10, 1, 'int32' ); // $ExpectType Int32Array
3536
full( 10, 1, 'int16' ); // $ExpectType Int16Array
3637
full( 10, 1, 'int8' ); // $ExpectType Int8Array

full/test/test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ var Uint8Array = require( './../../uint8' );
3232
var Uint8ClampedArray = require( './../../uint8c' );
3333
var Complex64Array = require( './../../complex64' );
3434
var Complex128Array = require( './../../complex128' );
35+
var BooleanArray = require( './../../bool' );
3536
var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' );
3637
var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' );
38+
var reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' );
3739
var Complex128 = require( '@stdlib/complex/float64/ctor' );
3840
var Complex64 = require( '@stdlib/complex/float32/ctor' );
3941
var instanceOf = require( '@stdlib/assert/instance-of' );
@@ -185,6 +187,20 @@ tape( 'the function returns a filled array (dtype=float32)', function test( t )
185187
t.end();
186188
});
187189

190+
tape( 'the function returns a filled array (dtype=bool)', function test( t ) {
191+
var expected;
192+
var arr;
193+
194+
expected = new Uint8Array( [ 1, 1, 1, 1 ] );
195+
196+
arr = full( 4, true, 'bool' );
197+
t.strictEqual( instanceOf( arr, BooleanArray ), true, 'returns expected value' );
198+
t.strictEqual( arr.length, expected.length, 'returns expected value' );
199+
t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' );
200+
201+
t.end();
202+
});
203+
188204
tape( 'the function returns a filled array (dtype=complex128)', function test( t ) {
189205
var expected;
190206
var arr;

0 commit comments

Comments
 (0)