Skip to content

Commit d2754ff

Browse files
committed
Add support for complex number dtypes
1 parent 291ee43 commit d2754ff

File tree

7 files changed

+35
-21
lines changed

7 files changed

+35
-21
lines changed

lib/node_modules/@stdlib/ndarray/dtypes/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ Returns a list of ndarray data types.
4646

4747
```javascript
4848
var out = dtypes();
49-
// returns [ 'binary', 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c' ]
49+
// returns [ 'binary', 'complex64', 'complex128', 'float32', 'float64', 'generic', 'int16', 'int32', 'int8', 'uint16', 'uint32', 'uint8', 'uint8c' ]
5050
```
5151

5252
The output `array` contains the following data types:
5353

5454
- `binary`: binary.
55+
- `complex64`: single-precision complex floating-point numbers.
56+
- `complex128`: double-precision complex floating-point numbers.
5557
- `float32`: single-precision floating-point numbers.
5658
- `float64`: double-precision floating-point numbers.
5759
- `generic`: values of any type.

lib/node_modules/@stdlib/ndarray/dtypes/docs/repl.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
The output array contains the following data types:
66

77
- binary: binary.
8+
- complex64: single-precision complex floating-point numbers.
9+
- complex128: double-precision complex floating-point numbers.
810
- float32: single-precision floating-point numbers.
911
- float64: double-precision floating-point numbers.
1012
- generic: values of any type.

lib/node_modules/@stdlib/ndarray/dtypes/docs/types/index.d.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@
2525
*
2626
* - The output array contains the following data types:
2727
*
28-
* - binary: binary.
29-
* - float32: single-precision floating-point numbers.
30-
* - float64: double-precision floating-point numbers.
31-
* - generic: values of any type.
32-
* - int16: signed 16-bit integers.
33-
* - int32: signed 32-bit integers.
34-
* - int8: signed 8-bit integers.
35-
* - uint16: unsigned 16-bit integers.
36-
* - uint32: unsigned 32-bit integers.
37-
* - uint8: unsigned 8-bit integers.
38-
* - uint8c: unsigned clamped 8-bit integers.
28+
* - `binary`: binary.
29+
* - `complex64`: single-precision complex floating-point numbers.
30+
* - `complex128`: double-precision complex floating-point numbers.
31+
* - `float32`: single-precision floating-point numbers.
32+
* - `float64`: double-precision floating-point numbers.
33+
* - `generic`: values of any type.
34+
* - `int16`: signed 16-bit integers.
35+
* - `int32`: signed 32-bit integers.
36+
* - `int8`: signed 8-bit integers.
37+
* - `uint16`: unsigned 16-bit integers.
38+
* - `uint32`: unsigned 32-bit integers.
39+
* - `uint8`: unsigned 8-bit integers.
40+
* - `uint8c`: unsigned clamped 8-bit integers.
3941
*
4042
* @returns list of ndarray data types
4143
*

lib/node_modules/@stdlib/ndarray/dtypes/include/stdlib/ndarray/dtypes.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ enum STDLIB_NDARRAY_DTYPE {
5050

5151
// Floating-point data types:
5252
// STDLIB_NDARRAY_FLOAT16, // TODO: uncomment once supported
53+
// STDLIB_NDARRAY_BFLOAT16, // TODO: uncomment once supported
5354
STDLIB_NDARRAY_FLOAT32,
5455
STDLIB_NDARRAY_FLOAT64,
5556
// STDLIB_NDARRAY_FLOAT128 // TODO: uncomment once supported
5657

5758
// Complex floating-point number data types:
58-
// STDLIB_NDARRAY_COMPLEX64, // TODO: uncomment once supported
59-
// STDLIB_NDARRAY_COMPLEX128,
59+
STDLIB_NDARRAY_COMPLEX64,
60+
STDLIB_NDARRAY_COMPLEX128,
6061

6162
// Define a data type for "binary" data (i.e., data stored in a Node.js `Buffer` object):
6263
STDLIB_NDARRAY_BINARY,

lib/node_modules/@stdlib/ndarray/dtypes/lib/dtypes.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[
22
"binary",
3+
"complex64",
4+
"complex128",
35
"float32",
46
"float64",
57
"generic",

lib/node_modules/@stdlib/ndarray/dtypes/lib/enum.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,23 @@ function enumerated() {
5959

6060
// Floating-point data types:
6161
// 'float16': 14,
62+
// 'bfloat16': 15,
6263
'float32': 10,
6364
'float64': 11,
64-
// 'float128': 17, // uncomment once supported
65+
// 'float128': 18, // uncomment once supported
6566

6667
// Complex floating-point number data types:
67-
// 'complex64': 18, // uncomment once supported
68-
// 'complex128': 19,
68+
'complex64': 12,
69+
'complex128': 13,
6970

7071
// Data type for "binary" data (i.e., data stored in a Node.js `Buffer` object):
71-
'binary': 12,
72+
'binary': 14,
7273

7374
// Data type for "generic" JavaScript values (objects):
74-
'generic': 13,
75+
'generic': 15,
7576

7677
// Define a signaling value which is guaranteed not to be a valid type enumeration value:
77-
'notype': 15,
78+
'notype': 17,
7879

7980
// Indicate the start of user defined type numbers (leaving room for type growth above):
8081
'userdefined_type': 256

lib/node_modules/@stdlib/ndarray/dtypes/test/test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ tape( 'the function returns a list of ndarray data types', function test( t ) {
4040

4141
expected = [
4242
'binary',
43+
'complex64',
44+
'complex128',
4345
'float32',
4446
'float64',
4547
'generic',
@@ -79,7 +81,9 @@ tape( 'attached to the main function is an `enum` method to return an object map
7981
'int64',
8082
'uint64',
8183
'float32',
82-
'float64'
84+
'float64',
85+
'complex64',
86+
'complex128'
8387
];
8488
for ( i = 0; i < dt.length; i++ ) {
8589
t.strictEqual( hasOwnProp( obj, dt[ i ] ), true, 'has property `' + dt[ i ] + '`' );

0 commit comments

Comments
 (0)