Skip to content

Commit c417923

Browse files
Jaysukh-409kgryte
andauthored
feat: add boolean dtype support in array/dtypes
PR-URL: #2307 Ref: #2304 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent 2a174cd commit c417923

File tree

6 files changed

+48
-6
lines changed

6 files changed

+48
-6
lines changed

Diff for: lib/node_modules/@stdlib/array/dtypes/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@license Apache-2.0
44
5-
Copyright (c) 2018 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.
@@ -55,6 +55,7 @@ When not provided a data type "kind", the function returns an array containing t
5555
- `float64`: double-precision floating-point numbers.
5656
- `complex64`: single-precision complex floating-point numbers.
5757
- `complex128`: double-precision complex floating-point numbers.
58+
- `bool`: boolean values.
5859
- `generic`: values of any type.
5960
- `int16`: signed 16-bit integers.
6061
- `int32`: signed 32-bit integers.
@@ -76,6 +77,7 @@ The function supports the following data type kinds:
7677
- `floating_point`: floating-point data types.
7778
- `real_floating_point`: real-valued floating-point data types.
7879
- `complex_floating_point`: complex-valued floating-point data types.
80+
- `boolean`: boolean data types.
7981
- `integer`: integer data types.
8082
- `signed_integer`: signed integer data types.
8183
- `unsigned_integer`: unsigned integer data types.

Diff for: lib/node_modules/@stdlib/array/dtypes/benchmark/benchmark.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 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.
@@ -79,7 +79,8 @@ bench( pkg+'::kind,generic', function benchmark( b ) {
7979

8080
values = [
8181
'floating_point_and_generic',
82-
'integer_and_generic'
82+
'integer_and_generic',
83+
'boolean_and_generic'
8384
];
8485

8586
b.tic();

Diff for: lib/node_modules/@stdlib/array/dtypes/docs/repl.txt

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- float64: double-precision floating-point numbers.
1010
- complex64: single-precision complex floating-point numbers.
1111
- complex128: double-precision complex floating-point numbers.
12+
- bool: boolean values.
1213
- generic: values of any type.
1314
- int16: signed 16-bit integers.
1415
- int32: signed 32-bit integers.
@@ -23,6 +24,7 @@
2324
- floating_point: floating-point data types.
2425
- real_floating_point: real-valued floating-point data types.
2526
- complex_floating_point: complex-valued floating-point data types.
27+
- boolean: boolean data types.
2628
- integer: integer data types.
2729
- signed_integer: signed integer data types.
2830
- unsigned_integer: unsigned integer data types.

Diff for: lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"all": [
3+
"bool",
34
"complex64",
45
"complex128",
56
"float32",
@@ -14,6 +15,7 @@
1415
"uint8c"
1516
],
1617
"typed": [
18+
"bool",
1719
"complex64",
1820
"complex128",
1921
"float32",
@@ -40,6 +42,9 @@
4042
"complex64",
4143
"complex128"
4244
],
45+
"boolean": [
46+
"bool"
47+
],
4348
"integer": [
4449
"int16",
4550
"int32",

Diff for: lib/node_modules/@stdlib/array/dtypes/lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 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.
@@ -27,7 +27,7 @@
2727
* var dtypes = require( '@stdlib/array/dtypes' );
2828
*
2929
* var list = dtypes();
30-
* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64' ]
30+
* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64', 'bool' ]
3131
*/
3232

3333
// MODULES //

Diff for: lib/node_modules/@stdlib/array/dtypes/test/test.js

+33-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 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.
@@ -37,6 +37,7 @@ tape( 'the function returns a list of array data types', function test( t ) {
3737
var actual;
3838

3939
expected = [
40+
'bool',
4041
'complex64',
4142
'complex128',
4243
'float32',
@@ -61,6 +62,7 @@ tape( 'the function supports returning a list of array data types (all)', functi
6162
var actual;
6263

6364
expected = [
65+
'bool',
6466
'complex64',
6567
'complex128',
6668
'float32',
@@ -85,6 +87,7 @@ tape( 'the function supports returning a list of array data types (all, includin
8587
var actual;
8688

8789
expected = [
90+
'bool',
8891
'complex64',
8992
'complex128',
9093
'float32',
@@ -109,6 +112,7 @@ tape( 'the function supports returning a list of array data types (typed)', func
109112
var actual;
110113

111114
expected = [
115+
'bool',
112116
'complex64',
113117
'complex128',
114118
'float32',
@@ -132,6 +136,7 @@ tape( 'the function supports returning a list of array data types (typed, includ
132136
var actual;
133137

134138
expected = [
139+
'bool',
135140
'complex64',
136141
'complex128',
137142
'float32',
@@ -242,6 +247,33 @@ tape( 'the function supports returning a list of complex-valued floating-point a
242247
t.end();
243248
});
244249

250+
tape( 'the function supports returning a list of boolean array data types', function test( t ) {
251+
var expected;
252+
var actual;
253+
254+
expected = [
255+
'bool'
256+
];
257+
actual = dtypes( 'boolean' );
258+
259+
t.deepEqual( actual, expected, 'returns expected value' );
260+
t.end();
261+
});
262+
263+
tape( 'the function supports returning a list of boolean array data types (including "generic")', function test( t ) {
264+
var expected;
265+
var actual;
266+
267+
expected = [
268+
'bool',
269+
'generic'
270+
];
271+
actual = dtypes( 'boolean_and_generic' );
272+
273+
t.deepEqual( actual, expected, 'returns expected value' );
274+
t.end();
275+
});
276+
245277
tape( 'the function supports returning a list of integer array data types', function test( t ) {
246278
var expected;
247279
var actual;

0 commit comments

Comments
 (0)