Skip to content

Commit efecd32

Browse files
Jaysukh-409kgryte
andauthored
feat: add boolean dtype support to ndarray/base/buffer-dtype
PR-URL: #2572 Ref: #2547 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 0f0dbca commit efecd32

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

lib/node_modules/@stdlib/ndarray/base/buffer-dtype/README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,17 @@ var bufferCtors = require( '@stdlib/ndarray/base/buffer-ctors' );
8585
var isFunction = require( '@stdlib/assert/is-function' );
8686
var dtype = require( '@stdlib/ndarray/base/buffer-dtype' );
8787

88-
var DTYPES;
89-
var ctor;
90-
var buf;
91-
var len;
92-
var dt;
93-
var i;
94-
9588
// Get a list of supported ndarray buffer data types:
96-
DTYPES = dtypes();
89+
var DTYPES = dtypes();
9790

9891
// Buffer length:
99-
len = 10;
92+
var len = 10;
10093

10194
// For each supported data type, create a buffer and confirm its data type...
95+
var ctor;
96+
var buf;
97+
var dt;
98+
var i;
10299
for ( i = 0; i < DTYPES.length; i++ ) {
103100
ctor = bufferCtors( DTYPES[ i ] );
104101
if ( DTYPES[ i ] === 'binary' && isFunction( ctor.alloc ) ) {

lib/node_modules/@stdlib/ndarray/base/buffer-dtype/examples/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,17 @@ var bufferCtors = require( '@stdlib/ndarray/base/buffer-ctors' );
2323
var isFunction = require( '@stdlib/assert/is-function' );
2424
var dtype = require( './../lib' );
2525

26-
var DTYPES;
27-
var ctor;
28-
var buf;
29-
var len;
30-
var dt;
31-
var i;
32-
3326
// Get a list of supported ndarray buffer data types:
34-
DTYPES = dtypes();
27+
var DTYPES = dtypes();
3528

3629
// Buffer length:
37-
len = 10;
30+
var len = 10;
3831

3932
// For each supported data type, create a buffer and confirm its data type...
33+
var ctor;
34+
var buf;
35+
var dt;
36+
var i;
4037
for ( i = 0; i < DTYPES.length; i++ ) {
4138
ctor = bufferCtors( DTYPES[ i ] );
4239
if ( DTYPES[ i ] === 'binary' && isFunction( ctor.alloc ) ) {

lib/node_modules/@stdlib/ndarray/base/buffer-dtype/lib/ctor2dtype.js

Lines changed: 3 additions & 2 deletions
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.
@@ -35,7 +35,8 @@ var dtypes = {
3535
'Uint8Array': 'uint8',
3636
'Uint8ClampedArray': 'uint8c',
3737
'Complex64Array': 'complex64',
38-
'Complex128Array': 'complex128'
38+
'Complex128Array': 'complex128',
39+
'BooleanArray': 'bool'
3940
};
4041

4142

lib/node_modules/@stdlib/ndarray/base/buffer-dtype/lib/ctors.js

Lines changed: 4 additions & 2 deletions
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.
@@ -31,6 +31,7 @@ var Uint8ClampedArray = require( '@stdlib/array/uint8c' );
3131
var Int8Array = require( '@stdlib/array/int8' );
3232
var Complex64Array = require( '@stdlib/array/complex64' );
3333
var Complex128Array = require( '@stdlib/array/complex128' );
34+
var BooleanArray = require( '@stdlib/array/bool' );
3435

3536

3637
// MAIN //
@@ -47,7 +48,8 @@ var CTORS = [
4748
Uint8Array,
4849
Uint8ClampedArray,
4950
Complex64Array,
50-
Complex128Array
51+
Complex128Array,
52+
BooleanArray
5153
];
5254

5355

lib/node_modules/@stdlib/ndarray/base/buffer-dtype/lib/dtypes.js

Lines changed: 3 additions & 2 deletions
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.
@@ -32,7 +32,8 @@ var DTYPES = [
3232
'uint8',
3333
'uint8c',
3434
'complex64',
35-
'complex128'
35+
'complex128',
36+
'bool'
3637
];
3738

3839

0 commit comments

Comments
 (0)