@stdlib/ndarray-base-empty 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -184,8 +184,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
184
184
  [npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-empty.svg
185
185
  [npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-empty
186
186
 
187
- [test-image]: https://github.com/stdlib-js/ndarray-base-empty/actions/workflows/test.yml/badge.svg?branch=v0.2.1
188
- [test-url]: https://github.com/stdlib-js/ndarray-base-empty/actions/workflows/test.yml?query=branch:v0.2.1
187
+ [test-image]: https://github.com/stdlib-js/ndarray-base-empty/actions/workflows/test.yml/badge.svg?branch=v0.3.0
188
+ [test-url]: https://github.com/stdlib-js/ndarray-base-empty/actions/workflows/test.yml?query=branch:v0.3.0
189
189
 
190
190
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-empty/main.svg
191
191
  [coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-empty?branch=main
@@ -20,7 +20,7 @@
20
20
 
21
21
  /// <reference types="@stdlib/types"/>
22
22
 
23
- import { Shape, Order, typedndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray';
23
+ import { Shape, Order, typedndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, boolndarray, complex128ndarray, complex64ndarray, genericndarray, DataType } from '@stdlib/types/ndarray';
24
24
 
25
25
  /**
26
26
  * Creates an uninitialized array having a specified shape and data type.
@@ -242,6 +242,26 @@ declare function empty( dtype: 'uint8', shape: Shape, order: Order ): uint8ndarr
242
242
  */
243
243
  declare function empty( dtype: 'uint8c', shape: Shape, order: Order ): uint8cndarray;
244
244
 
245
+ /**
246
+ * Creates an uninitialized array having a specified shape and data type.
247
+ *
248
+ * @param dtype - underlying data type
249
+ * @param shape - array shape
250
+ * @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
251
+ * @returns output array
252
+ *
253
+ * @example
254
+ * var arr = empty( 'bool', [ 2, 2 ], 'row-major' );
255
+ * // returns <ndarray>
256
+ *
257
+ * var sh = arr.shape;
258
+ * // returns [ 2, 2 ]
259
+ *
260
+ * var dt = arr.dtype;
261
+ * // returns 'bool'
262
+ */
263
+ declare function empty( dtype: 'bool', shape: Shape, order: Order ): boolndarray;
264
+
245
265
  /**
246
266
  * Creates a zero-filled array having a specified shape and data type.
247
267
  *
@@ -260,7 +280,7 @@ declare function empty( dtype: 'uint8c', shape: Shape, order: Order ): uint8cnda
260
280
  * var dt = arr.dtype;
261
281
  * // returns 'generic'
262
282
  */
263
- declare function empty( dtype: 'generic', shape: Shape, order: Order ): typedndarray<number>;
283
+ declare function empty( dtype: 'generic', shape: Shape, order: Order ): genericndarray<number>;
264
284
 
265
285
  /**
266
286
  * Creates an uninitialized array having a specified shape and data type.
@@ -280,7 +300,7 @@ declare function empty( dtype: 'generic', shape: Shape, order: Order ): typednda
280
300
  * var dt = arr.dtype;
281
301
  * // returns 'float32'
282
302
  */
283
- declare function empty( dtype: DataType, shape: Shape, order: Order ): typedndarray<number>;
303
+ declare function empty<T = unknown>( dtype: DataType, shape: Shape, order: Order ): typedndarray<T>;
284
304
 
285
305
 
286
306
  // EXPORTS //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/ndarray-base-empty",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Create an uninitialized ndarray having a specified shape and data type.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -31,11 +31,11 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@stdlib/array-empty": "^0.2.1",
34
- "@stdlib/buffer-alloc-unsafe": "^0.2.1",
35
- "@stdlib/ndarray-base-ctor": "^0.2.1",
36
- "@stdlib/ndarray-base-numel": "^0.2.1",
37
- "@stdlib/ndarray-base-shape2strides": "^0.2.1",
38
- "@stdlib/ndarray-base-strides2offset": "^0.2.1"
34
+ "@stdlib/buffer-alloc-unsafe": "^0.2.2",
35
+ "@stdlib/ndarray-base-ctor": "^0.2.2",
36
+ "@stdlib/ndarray-base-numel": "^0.2.2",
37
+ "@stdlib/ndarray-base-shape2strides": "^0.2.2",
38
+ "@stdlib/ndarray-base-strides2offset": "^0.2.2"
39
39
  },
40
40
  "devDependencies": {},
41
41
  "engines": {