Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions lib/node_modules/@stdlib/ndarray/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 @@ -52,6 +52,7 @@ var out = dtypes();
When not provided a data type "kind", the function returns an array containing the following data types:

- `binary`: binary.
- `bool`: boolean values.
- `complex64`: single-precision complex floating-point numbers.
- `complex128`: double-precision complex floating-point numbers.
- `float32`: single-precision floating-point numbers.
Expand All @@ -77,6 +78,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 Expand Up @@ -106,17 +108,10 @@ The function supports the following data type kinds:
<!-- eslint no-undef: "error" -->

```javascript
var indexOf = require( '@stdlib/utils/index-of' );
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
var dtypes = require( '@stdlib/ndarray/dtypes' );

var DTYPES = dtypes();

function isdtype( str ) {
if ( indexOf( DTYPES, str ) === -1 ) {
return false;
}
return true;
}
var isdtype = contains( dtypes() );

var bool = isdtype( 'float64' );
// returns true
Expand Down
1 change: 1 addition & 0 deletions lib/node_modules/@stdlib/ndarray/dtypes/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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
11 changes: 2 additions & 9 deletions lib/node_modules/@stdlib/ndarray/dtypes/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,10 @@

'use strict';

var indexOf = require( '@stdlib/utils/index-of' );
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
var dtypes = require( './../lib' );

var DTYPES = dtypes();

function isdtype( str ) {
if ( indexOf( DTYPES, str ) === -1 ) {
return false;
}
return true;
}
var isdtype = contains( dtypes() );

var bool = isdtype( 'float64' );
console.log( bool );
Expand Down
5 changes: 5 additions & 0 deletions lib/node_modules/@stdlib/ndarray/dtypes/lib/dtypes.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"all": [
"binary",
"bool",
"complex64",
"complex128",
"float32",
Expand All @@ -16,6 +17,7 @@
],
"typed": [
"binary",
"bool",
"complex64",
"complex128",
"float32",
Expand All @@ -42,6 +44,9 @@
"complex64",
"complex128"
],
"boolean": [
"bool"
],
"integer": [
"int16",
"int32",
Expand Down
20 changes: 19 additions & 1 deletion lib/node_modules/@stdlib/ndarray/dtypes/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ var DTYPES = [
'float64',

'complex64',
'complex128'
'complex128',

'bool'
];


Expand All @@ -61,6 +63,7 @@ tape( 'the function returns a list of ndarray data types', function test( t ) {

expected = [
'binary',
'bool',
'complex64',
'complex128',
'float32',
Expand All @@ -86,6 +89,7 @@ tape( 'the function supports returning a list of ndarray data types (all)', func

expected = [
'binary',
'bool',
'complex64',
'complex128',
'float32',
Expand All @@ -111,6 +115,7 @@ tape( 'the function supports returning a list of ndarray data types (typed)', fu

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

tape( 'the function supports returning a list of boolean ndarray 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 integer ndarray data types', function test( t ) {
var expected;
var actual;
Expand Down
68 changes: 64 additions & 4 deletions lib/node_modules/@stdlib/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1391,62 +1391,122 @@ declare module '@stdlib/types/ndarray' {
/**
* Data type.
*/
type DataType = NumericDataType | 'binary' | 'generic'; // "all"
type DataType = NumericDataType | BooleanDataType | 'binary' | 'generic'; // "all"

/**
* Data type for real-valued ndarrays.
*/
type RealDataType = RealFloatingPointDataType | IntegerDataType; // "real"

/**
* Data type for real-valued ndarrays.
*/
type RealAndGenericDataType = RealDataType | 'generic'; // "real_and_generic"

/**
* Data type for floating-point ndarrays.
*/
type RealFloatingPointDataType = 'float64' | 'float32'; // "real_floating_point"

/**
* Data type for floating-point ndarrays.
*/
type RealFloatingPointAndGenericDataType = RealFloatingPointDataType | 'generic'; // "real_floating_point_and_generic"

/**
* Data type for integer ndarrays.
*/
type IntegerDataType = SignedIntegerDataType | UnsignedIntegerDataType; // "integer"

/**
* Data type for integer ndarrays.
*/
type IntegerAndGenericDataType = IntegerDataType | 'generic'; // "integer_and_generic"

/**
* Data type for signed integer ndarrays.
*/
type SignedIntegerDataType = 'int32' | 'int16' | 'int8'; // "signed_integer"

/**
* Data type for signed integer ndarrays.
*/
type SignedIntegerAndGenericDataType = SignedIntegerDataType | 'generic'; // "signed_integer_and_generic"

/**
* Data type for unsigned integer ndarrays.
*/
type UnsignedIntegerDataType = 'uint32' | 'uint16' | 'uint8' | 'uint8c'; // "unsigned_integer"

/**
* Data type for unsigned integer ndarrays.
*/
type UnsignedIntegerAndGenericDataType = UnsignedIntegerDataType | 'generic'; // "unsigned_integer_and_generic"

/**
* Data type for complex number ndarrays.
*/
type ComplexFloatingPointDataType = 'complex64' | 'complex128'; // "complex_floating_point"

/**
* Data type for complex number ndarrays.
*/
type ComplexFloatingPointAndGenericDataType = ComplexFloatingPointDataType | 'generic'; // "complex_floating_point_and_generic"

/**
* Data type for floating-point real or complex ndarrays.
*/
type FloatingPointDataType = RealFloatingPointDataType | ComplexFloatingPointDataType; // "floating_point"

/**
* Data type for floating-point real or complex ndarrays.
*/
type FloatingPointAndGenericDataType = FloatingPointDataType | 'generic'; // "floating_point_and_generic"

/**
* Data type for real-valued or complex number ndarrays.
*/
type NumericDataType = RealDataType | ComplexFloatingPointDataType; // "numeric"

/**
* Data type for real-valued or complex number ndarrays.
*/
type NumericAndGenericDataType = NumericDataType | 'generic'; // "numeric_and_generic"

/**
* Data type for boolean typed arrays.
*/
type BooleanDataType = 'bool'; // "boolean"

/**
* Data type for boolean and generic ndarrays.
*/
type BooleanAndGenericDataType = BooleanDataType | 'generic'; // "boolean_and_generic"

/**
* Data type for strictly "typed" ndarrays.
*/
type TypedDataType = NumericDataType; // "typed"
type TypedDataType = NumericDataType | BooleanDataType; // "typed"

/**
* Data type for strictly typed and generic ndarrays.
*/
type TypedAndGenericDataType = TypedDataType | 'generic'; // "typed_and_generic"

/**
* Strict data type "kinds".
*/
type StrictDataTypeKind = 'typed' | 'numeric' | 'real' | 'floating_point' | 'real_floating_point' | 'complex_floating_point' | 'integer' | 'signed_integer' | 'unsigned_integer' | 'boolean';

/**
* Data type "kinds".
*/
type DataTypeKind = 'all' | 'typed' | 'numeric' | 'real' | 'floating_point' | 'real_floating_point' | 'complex_floating_point' | 'integer' | 'signed_integer' | 'unsigned_integer';
type DataTypeKind = StrictDataTypeKind | 'all' | 'typed_and_generic' | 'numeric_and_generic' | 'real_and_generic' | 'floating_point_and_generic' | 'real_floating_point_and_generic' | 'complex_floating_point_and_generic' | 'integer_and_generic' | 'signed_integer_and_generic' | 'unsigned_integer_and_generic' | 'boolean_and_generic';

/**
* Output data type policy.
*/
type OutputPolicy = 'default' | 'same' | 'promoted' | 'bool' | 'numeric' | 'real' | 'floating_point' | 'real_floating_point' | 'complex_floating_point' | 'integer' | 'signed_integer' | 'unsigned_integer';
type OutputPolicy = 'default' | 'same' | 'promoted' | 'boolean' | 'numeric' | 'real' | 'floating_point' | 'real_floating_point' | 'complex_floating_point' | 'integer' | 'signed_integer' | 'unsigned_integer';

/**
* Array order.
Expand Down