From ac0f427f67c08f5a7780c88fba94e0e412b66842 Mon Sep 17 00:00:00 2001 From: Jaysukh-409 Date: Thu, 6 Jun 2024 14:15:08 +0530 Subject: [PATCH 1/4] feat: add boolean support in array/dtypes --- .../@stdlib/array/dtypes/README.md | 4 ++- .../array/dtypes/benchmark/benchmark.js | 5 +-- .../@stdlib/array/dtypes/docs/repl.txt | 2 ++ .../@stdlib/array/dtypes/lib/dtypes.json | 5 +++ .../@stdlib/array/dtypes/lib/index.js | 4 +-- .../@stdlib/array/dtypes/test/test.js | 34 ++++++++++++++++++- 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/array/dtypes/README.md b/lib/node_modules/@stdlib/array/dtypes/README.md index 1d933ed4cccb..b426e012dba6 100644 --- a/lib/node_modules/@stdlib/array/dtypes/README.md +++ b/lib/node_modules/@stdlib/array/dtypes/README.md @@ -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. @@ -63,6 +63,7 @@ When not provided a data type "kind", the function returns an array containing t - `uint32`: unsigned 32-bit integers. - `uint8`: unsigned 8-bit integers. - `uint8c`: unsigned clamped 8-bit integers. +- `boolean`: boolean values. To return the subset of data types belonging to a specified data type kind, provide a `kind` argument. @@ -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 type. - `integer`: integer data types. - `signed_integer`: signed integer data types. - `unsigned_integer`: unsigned integer data types. diff --git a/lib/node_modules/@stdlib/array/dtypes/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/dtypes/benchmark/benchmark.js index d4868aed5bb7..3c7886c541ee 100644 --- a/lib/node_modules/@stdlib/array/dtypes/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/dtypes/benchmark/benchmark.js @@ -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. @@ -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(); diff --git a/lib/node_modules/@stdlib/array/dtypes/docs/repl.txt b/lib/node_modules/@stdlib/array/dtypes/docs/repl.txt index 45f76dd23d6f..d75e54862a0f 100644 --- a/lib/node_modules/@stdlib/array/dtypes/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/dtypes/docs/repl.txt @@ -17,12 +17,14 @@ - uint32: unsigned 32-bit integers. - uint8: unsigned 8-bit integers. - uint8c: unsigned clamped 8-bit integers. + - boolean: boolean values. 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 type. - integer: integer data types. - signed_integer: signed integer data types. - unsigned_integer: unsigned integer data types. diff --git a/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json b/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json index 659a47ca28a3..f885515cbc8e 100644 --- a/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json +++ b/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json @@ -2,6 +2,7 @@ "all": [ "complex64", "complex128", + "boolean", "float32", "float64", "generic", @@ -16,6 +17,7 @@ "typed": [ "complex64", "complex128", + "boolean", "float32", "float64", "int16", @@ -40,6 +42,9 @@ "complex64", "complex128" ], + "boolean": [ + "boolean" + ], "integer": [ "int16", "int32", diff --git a/lib/node_modules/@stdlib/array/dtypes/lib/index.js b/lib/node_modules/@stdlib/array/dtypes/lib/index.js index bf389a0efc92..a197be8c54cc 100644 --- a/lib/node_modules/@stdlib/array/dtypes/lib/index.js +++ b/lib/node_modules/@stdlib/array/dtypes/lib/index.js @@ -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. @@ -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', 'boolean' ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/array/dtypes/test/test.js b/lib/node_modules/@stdlib/array/dtypes/test/test.js index 9779d7086f98..ba119f422048 100644 --- a/lib/node_modules/@stdlib/array/dtypes/test/test.js +++ b/lib/node_modules/@stdlib/array/dtypes/test/test.js @@ -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. @@ -39,6 +39,7 @@ tape( 'the function returns a list of array data types', function test( t ) { expected = [ 'complex64', 'complex128', + 'boolean', 'float32', 'float64', 'generic', @@ -63,6 +64,7 @@ tape( 'the function supports returning a list of array data types (all)', functi expected = [ 'complex64', 'complex128', + 'boolean', 'float32', 'float64', 'generic', @@ -87,6 +89,7 @@ tape( 'the function supports returning a list of array data types (all, includin expected = [ 'complex64', 'complex128', + 'boolean', 'float32', 'float64', 'generic', @@ -111,6 +114,7 @@ tape( 'the function supports returning a list of array data types (typed)', func expected = [ 'complex64', 'complex128', + 'boolean', 'float32', 'float64', 'int16', @@ -134,6 +138,7 @@ tape( 'the function supports returning a list of array data types (typed, includ expected = [ 'complex64', 'complex128', + 'boolean', 'float32', 'float64', 'int16', @@ -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 = [ + 'boolean' + ]; + 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 = [ + 'boolean', + '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; From d462d1950564de9ba88976408924dfc59f011742 Mon Sep 17 00:00:00 2001 From: Jaysukh-409 Date: Thu, 6 Jun 2024 14:28:27 +0530 Subject: [PATCH 2/4] feat: update Dtype to bool --- lib/node_modules/@stdlib/array/dtypes/README.md | 4 ++-- .../@stdlib/array/dtypes/docs/repl.txt | 4 ++-- .../@stdlib/array/dtypes/lib/dtypes.json | 6 +++--- lib/node_modules/@stdlib/array/dtypes/lib/index.js | 2 +- lib/node_modules/@stdlib/array/dtypes/test/test.js | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/array/dtypes/README.md b/lib/node_modules/@stdlib/array/dtypes/README.md index b426e012dba6..c810e6d003d1 100644 --- a/lib/node_modules/@stdlib/array/dtypes/README.md +++ b/lib/node_modules/@stdlib/array/dtypes/README.md @@ -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. @@ -63,7 +64,6 @@ When not provided a data type "kind", the function returns an array containing t - `uint32`: unsigned 32-bit integers. - `uint8`: unsigned 8-bit integers. - `uint8c`: unsigned clamped 8-bit integers. -- `boolean`: boolean values. To return the subset of data types belonging to a specified data type kind, provide a `kind` argument. @@ -77,7 +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 type. +- `boolean`: boolean data types. - `integer`: integer data types. - `signed_integer`: signed integer data types. - `unsigned_integer`: unsigned integer data types. diff --git a/lib/node_modules/@stdlib/array/dtypes/docs/repl.txt b/lib/node_modules/@stdlib/array/dtypes/docs/repl.txt index d75e54862a0f..3f70e26da247 100644 --- a/lib/node_modules/@stdlib/array/dtypes/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/dtypes/docs/repl.txt @@ -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. @@ -17,14 +18,13 @@ - uint32: unsigned 32-bit integers. - uint8: unsigned 8-bit integers. - uint8c: unsigned clamped 8-bit integers. - - boolean: boolean values. 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 type. + - boolean: boolean data types. - integer: integer data types. - signed_integer: signed integer data types. - unsigned_integer: unsigned integer data types. diff --git a/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json b/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json index f885515cbc8e..43bbdde10984 100644 --- a/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json +++ b/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json @@ -2,7 +2,7 @@ "all": [ "complex64", "complex128", - "boolean", + "bool", "float32", "float64", "generic", @@ -17,7 +17,7 @@ "typed": [ "complex64", "complex128", - "boolean", + "bool", "float32", "float64", "int16", @@ -43,7 +43,7 @@ "complex128" ], "boolean": [ - "boolean" + "bool" ], "integer": [ "int16", diff --git a/lib/node_modules/@stdlib/array/dtypes/lib/index.js b/lib/node_modules/@stdlib/array/dtypes/lib/index.js index a197be8c54cc..eb466770e99d 100644 --- a/lib/node_modules/@stdlib/array/dtypes/lib/index.js +++ b/lib/node_modules/@stdlib/array/dtypes/lib/index.js @@ -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', 'boolean' ] +* // e.g., returns [ 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c', 'complex128', 'complex64', 'bool' ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/array/dtypes/test/test.js b/lib/node_modules/@stdlib/array/dtypes/test/test.js index ba119f422048..798d843efefa 100644 --- a/lib/node_modules/@stdlib/array/dtypes/test/test.js +++ b/lib/node_modules/@stdlib/array/dtypes/test/test.js @@ -39,7 +39,7 @@ tape( 'the function returns a list of array data types', function test( t ) { expected = [ 'complex64', 'complex128', - 'boolean', + 'bool', 'float32', 'float64', 'generic', @@ -64,7 +64,7 @@ tape( 'the function supports returning a list of array data types (all)', functi expected = [ 'complex64', 'complex128', - 'boolean', + 'bool', 'float32', 'float64', 'generic', @@ -89,7 +89,7 @@ tape( 'the function supports returning a list of array data types (all, includin expected = [ 'complex64', 'complex128', - 'boolean', + 'bool', 'float32', 'float64', 'generic', @@ -114,7 +114,7 @@ tape( 'the function supports returning a list of array data types (typed)', func expected = [ 'complex64', 'complex128', - 'boolean', + 'bool', 'float32', 'float64', 'int16', @@ -138,7 +138,7 @@ tape( 'the function supports returning a list of array data types (typed, includ expected = [ 'complex64', 'complex128', - 'boolean', + 'bool', 'float32', 'float64', 'int16', @@ -252,7 +252,7 @@ tape( 'the function supports returning a list of boolean array data types', func var actual; expected = [ - 'boolean' + 'bool' ]; actual = dtypes( 'boolean' ); @@ -265,7 +265,7 @@ tape( 'the function supports returning a list of boolean array data types (inclu var actual; expected = [ - 'boolean', + 'bool', 'generic' ]; actual = dtypes( 'boolean_and_generic' ); From 7f3f3b814ec2fb16a2facf489230934de1203b09 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 6 Jun 2024 02:59:59 -0700 Subject: [PATCH 3/4] refactor: order types in alphabetical order --- lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json b/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json index 43bbdde10984..47194825c89e 100644 --- a/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json +++ b/lib/node_modules/@stdlib/array/dtypes/lib/dtypes.json @@ -1,8 +1,8 @@ { "all": [ + "bool", "complex64", "complex128", - "bool", "float32", "float64", "generic", @@ -15,9 +15,9 @@ "uint8c" ], "typed": [ + "bool", "complex64", "complex128", - "bool", "float32", "float64", "int16", From bcd644587d9f42dc3684ff094fda183ef1e35ecb Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 6 Jun 2024 03:02:02 -0700 Subject: [PATCH 4/4] test: order expected results in alphabetical order --- lib/node_modules/@stdlib/array/dtypes/test/test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/array/dtypes/test/test.js b/lib/node_modules/@stdlib/array/dtypes/test/test.js index 798d843efefa..5f947ce7505f 100644 --- a/lib/node_modules/@stdlib/array/dtypes/test/test.js +++ b/lib/node_modules/@stdlib/array/dtypes/test/test.js @@ -37,9 +37,9 @@ tape( 'the function returns a list of array data types', function test( t ) { var actual; expected = [ + 'bool', 'complex64', 'complex128', - 'bool', 'float32', 'float64', 'generic', @@ -62,9 +62,9 @@ tape( 'the function supports returning a list of array data types (all)', functi var actual; expected = [ + 'bool', 'complex64', 'complex128', - 'bool', 'float32', 'float64', 'generic', @@ -87,9 +87,9 @@ tape( 'the function supports returning a list of array data types (all, includin var actual; expected = [ + 'bool', 'complex64', 'complex128', - 'bool', 'float32', 'float64', 'generic', @@ -112,9 +112,9 @@ tape( 'the function supports returning a list of array data types (typed)', func var actual; expected = [ + 'bool', 'complex64', 'complex128', - 'bool', 'float32', 'float64', 'int16', @@ -136,9 +136,9 @@ tape( 'the function supports returning a list of array data types (typed, includ var actual; expected = [ + 'bool', 'complex64', 'complex128', - 'bool', 'float32', 'float64', 'int16',