Skip to content

feat: add boolean datatype support in array/dtypes #2307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 13, 2024
4 changes: 3 additions & 1 deletion lib/node_modules/@stdlib/array/dtypes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@license Apache-2.0

Copyright (c) 2018 The Stdlib Authors.
Copyright (c) 2024 The Stdlib Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,6 +55,7 @@ When not provided a data type "kind", the function returns an array containing t
- `float64`: double-precision floating-point numbers.
- `complex64`: single-precision complex floating-point numbers.
- `complex128`: double-precision complex floating-point numbers.
- `bool`: boolean values.
- `generic`: values of any type.
- `int16`: signed 16-bit integers.
- `int32`: signed 32-bit integers.
Expand All @@ -76,6 +77,7 @@ The function supports the following data type kinds:
- `floating_point`: floating-point data types.
- `real_floating_point`: real-valued floating-point data types.
- `complex_floating_point`: complex-valued floating-point data types.
- `boolean`: boolean data types.
- `integer`: integer data types.
- `signed_integer`: signed integer data types.
- `unsigned_integer`: unsigned integer data types.
Expand Down
5 changes: 3 additions & 2 deletions lib/node_modules/@stdlib/array/dtypes/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -79,7 +79,8 @@ bench( pkg+'::kind,generic', function benchmark( b ) {

values = [
'floating_point_and_generic',
'integer_and_generic'
'integer_and_generic',
'boolean_and_generic'
];

b.tic();
Expand Down
2 changes: 2 additions & 0 deletions lib/node_modules/@stdlib/array/dtypes/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- float64: double-precision floating-point numbers.
- complex64: single-precision complex floating-point numbers.
- complex128: double-precision complex floating-point numbers.
- bool: boolean values.
- generic: values of any type.
- int16: signed 16-bit integers.
- int32: signed 32-bit integers.
Expand All @@ -23,6 +24,7 @@
- floating_point: floating-point data types.
- real_floating_point: real-valued floating-point data types.
- complex_floating_point: complex-valued floating-point data types.
- boolean: boolean data types.
- integer: integer data types.
- signed_integer: signed integer data types.
- unsigned_integer: unsigned integer data types.
Expand Down
5 changes: 5 additions & 0 deletions lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"all": [
"bool",
"complex64",
"complex128",
"float32",
Expand All @@ -14,6 +15,7 @@
"uint8c"
],
"typed": [
"bool",
"complex64",
"complex128",
"float32",
Expand All @@ -40,6 +42,9 @@
"complex64",
"complex128"
],
"boolean": [
"bool"
],
"integer": [
"int16",
"int32",
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/array/dtypes/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -27,7 +27,7 @@
* var dtypes = require( '@stdlib/array/dtypes' );
*
* var list = dtypes();
* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64' ]
* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64', 'bool' ]
*/

// MODULES //
Expand Down
34 changes: 33 additions & 1 deletion lib/node_modules/@stdlib/array/dtypes/test/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,6 +37,7 @@ tape( 'the function returns a list of array data types', function test( t ) {
var actual;

expected = [
'bool',
'complex64',
'complex128',
'float32',
Expand All @@ -61,6 +62,7 @@ tape( 'the function supports returning a list of array data types (all)', functi
var actual;

expected = [
'bool',
'complex64',
'complex128',
'float32',
Expand All @@ -85,6 +87,7 @@ tape( 'the function supports returning a list of array data types (all, includin
var actual;

expected = [
'bool',
'complex64',
'complex128',
'float32',
Expand All @@ -109,6 +112,7 @@ tape( 'the function supports returning a list of array data types (typed)', func
var actual;

expected = [
'bool',
'complex64',
'complex128',
'float32',
Expand All @@ -132,6 +136,7 @@ tape( 'the function supports returning a list of array data types (typed, includ
var actual;

expected = [
'bool',
'complex64',
'complex128',
'float32',
Expand Down Expand Up @@ -242,6 +247,33 @@ tape( 'the function supports returning a list of complex-valued floating-point a
t.end();
});

tape( 'the function supports returning a list of boolean array data types', function test( t ) {
var expected;
var actual;

expected = [
'bool'
];
actual = dtypes( 'boolean' );

t.deepEqual( actual, expected, 'returns expected value' );
t.end();
});

tape( 'the function supports returning a list of boolean array data types (including "generic")', function test( t ) {
var expected;
var actual;

expected = [
'bool',
'generic'
];
actual = dtypes( 'boolean_and_generic' );

t.deepEqual( actual, expected, 'returns expected value' );
t.end();
});

tape( 'the function supports returning a list of integer array data types', function test( t ) {
var expected;
var actual;
Expand Down
Loading