@stdlib/array-empty-like 0.2.0 → 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 +7 -20
- package/docs/types/index.d.ts +12 -714
- package/package.json +10 -40
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
@license Apache-2.0
|
|
4
4
|
|
|
5
|
-
Copyright (c)
|
|
5
|
+
Copyright (c) 2024 The Stdlib Authors.
|
|
6
6
|
|
|
7
7
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
8
|
you may not use this file except in compliance with the License.
|
|
@@ -65,7 +65,7 @@ var emptyLike = require( '@stdlib/array-empty-like' );
|
|
|
65
65
|
|
|
66
66
|
#### emptyLike( x\[, dtype] )
|
|
67
67
|
|
|
68
|
-
Creates an uninitialized array having the same length and data type as a provided array `x`.
|
|
68
|
+
Creates an uninitialized array having the same length and [data type][@stdlib/array/dtypes] as a provided array `x`.
|
|
69
69
|
|
|
70
70
|
```javascript
|
|
71
71
|
var x = [ 1, 2, 3, 4, 5 ];
|
|
@@ -74,22 +74,7 @@ var arr = emptyLike( x );
|
|
|
74
74
|
// returns [ 0, 0, 0, 0, 0 ];
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
- `float64`: double-precision floating-point numbers (IEEE 754)
|
|
80
|
-
- `float32`: single-precision floating-point numbers (IEEE 754)
|
|
81
|
-
- `complex128`: double-precision complex floating-point numbers
|
|
82
|
-
- `complex64`: single-precision complex floating-point numbers
|
|
83
|
-
- `int32`: 32-bit two's complement signed integers
|
|
84
|
-
- `uint32`: 32-bit unsigned integers
|
|
85
|
-
- `int16`: 16-bit two's complement signed integers
|
|
86
|
-
- `uint16`: 16-bit unsigned integers
|
|
87
|
-
- `int8`: 8-bit two's complement signed integers
|
|
88
|
-
- `uint8`: 8-bit unsigned integers
|
|
89
|
-
- `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
90
|
-
- `generic`: generic JavaScript values
|
|
91
|
-
|
|
92
|
-
By default, the output array data type is inferred from the provided array `x`. To return an array having a different data type, provide a `dtype` argument.
|
|
77
|
+
By default, the output array [data type][@stdlib/array/dtypes] is inferred from the provided array `x`. To return an array having a different [data type][@stdlib/array/dtypes], provide a `dtype` argument.
|
|
93
78
|
|
|
94
79
|
```javascript
|
|
95
80
|
var x = [ 1, 1 ];
|
|
@@ -213,8 +198,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
213
198
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-empty-like.svg
|
|
214
199
|
[npm-url]: https://npmjs.org/package/@stdlib/array-empty-like
|
|
215
200
|
|
|
216
|
-
[test-image]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
217
|
-
[test-url]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml?query=branch:v0.
|
|
201
|
+
[test-image]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml/badge.svg?branch=v0.3.0
|
|
202
|
+
[test-url]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml?query=branch:v0.3.0
|
|
218
203
|
|
|
219
204
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-empty-like/main.svg
|
|
220
205
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-empty-like?branch=main
|
|
@@ -246,6 +231,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
246
231
|
|
|
247
232
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-empty-like/main/LICENSE
|
|
248
233
|
|
|
234
|
+
[@stdlib/array/dtypes]: https://www.npmjs.com/package/@stdlib/array-dtypes
|
|
235
|
+
|
|
249
236
|
<!-- <related-links> -->
|
|
250
237
|
|
|
251
238
|
[@stdlib/array/empty]: https://www.npmjs.com/package/@stdlib/array-empty
|
package/docs/types/index.d.ts
CHANGED
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
/// <reference types="@stdlib/types"/>
|
|
22
22
|
|
|
23
|
-
import { AnyArray,
|
|
23
|
+
import { AnyArray, DataTypeMap, TypedArray, BooleanTypedArray, ComplexTypedArray } from '@stdlib/types/array';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
26
|
+
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
27
27
|
*
|
|
28
28
|
* ## Notes
|
|
29
29
|
*
|
|
@@ -31,19 +31,18 @@ import { AnyArray, Complex128Array, Complex64Array, DataType } from '@stdlib/typ
|
|
|
31
31
|
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
32
32
|
*
|
|
33
33
|
* @param x - input array from which to derive the output array length
|
|
34
|
-
* @param dtype - data type
|
|
35
34
|
* @returns empty array
|
|
36
35
|
*
|
|
37
36
|
* @example
|
|
38
37
|
* var zeros = require( '@stdlib/array-zeros' );
|
|
39
38
|
*
|
|
40
|
-
* var x = zeros( 2, '
|
|
41
|
-
* // returns
|
|
39
|
+
* var x = zeros( 2, 'generic' );
|
|
40
|
+
* // returns [ 0.0, 0.0 ]
|
|
42
41
|
*
|
|
43
|
-
* var arr = emptyLike( x
|
|
44
|
-
* // returns
|
|
42
|
+
* var arr = emptyLike( x );
|
|
43
|
+
* // returns [ 0.0, 0.0 ]
|
|
45
44
|
*/
|
|
46
|
-
declare function emptyLike( x:
|
|
45
|
+
declare function emptyLike( x: Array<any> ): Array<number>;
|
|
47
46
|
|
|
48
47
|
/**
|
|
49
48
|
* Creates an uninitialized array having the same length as a provided input array.
|
|
@@ -54,203 +53,18 @@ declare function emptyLike( x: AnyArray, dtype: 'float64' ): Float64Array;
|
|
|
54
53
|
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
55
54
|
*
|
|
56
55
|
* @param x - input array from which to derive the output array length
|
|
57
|
-
* @param dtype - data type
|
|
58
56
|
* @returns empty array
|
|
59
57
|
*
|
|
60
58
|
* @example
|
|
61
59
|
* var zeros = require( '@stdlib/array-zeros' );
|
|
62
60
|
*
|
|
63
61
|
* var x = zeros( 2, 'float64' );
|
|
64
|
-
* // returns <
|
|
62
|
+
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
65
63
|
*
|
|
66
64
|
* var arr = emptyLike( x, 'float32' );
|
|
67
65
|
* // returns <Float32Array>
|
|
68
66
|
*/
|
|
69
|
-
declare function emptyLike( x:
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
73
|
-
*
|
|
74
|
-
* ## Notes
|
|
75
|
-
*
|
|
76
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
77
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
78
|
-
*
|
|
79
|
-
* @param x - input array from which to derive the output array length
|
|
80
|
-
* @param dtype - data type
|
|
81
|
-
* @returns empty array
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
85
|
-
*
|
|
86
|
-
* var x = zeros( 2, 'float32' );
|
|
87
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
88
|
-
*
|
|
89
|
-
* var arr = emptyLike( x, 'complex128' );
|
|
90
|
-
* // returns <Complex128Array>
|
|
91
|
-
*/
|
|
92
|
-
declare function emptyLike( x: AnyArray, dtype: 'complex128' ): Complex128Array;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
96
|
-
*
|
|
97
|
-
* ## Notes
|
|
98
|
-
*
|
|
99
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
100
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
101
|
-
*
|
|
102
|
-
* @param x - input array from which to derive the output array length
|
|
103
|
-
* @param dtype - data type
|
|
104
|
-
* @returns empty array
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
108
|
-
*
|
|
109
|
-
* var x = zeros( 2, 'float32' );
|
|
110
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
111
|
-
*
|
|
112
|
-
* var arr = emptyLike( x, 'complex64' );
|
|
113
|
-
* // returns <Complex64Array>
|
|
114
|
-
*/
|
|
115
|
-
declare function emptyLike( x: AnyArray, dtype: 'complex64' ): Complex64Array;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
119
|
-
*
|
|
120
|
-
* ## Notes
|
|
121
|
-
*
|
|
122
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
123
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
124
|
-
*
|
|
125
|
-
* @param x - input array from which to derive the output array length
|
|
126
|
-
* @param dtype - data type
|
|
127
|
-
* @returns empty array
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
131
|
-
*
|
|
132
|
-
* var x = zeros( 2, 'float32' );
|
|
133
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
134
|
-
*
|
|
135
|
-
* var arr = emptyLike( x, 'int32' );
|
|
136
|
-
* // returns <Int32Array>
|
|
137
|
-
*/
|
|
138
|
-
declare function emptyLike( x: AnyArray, dtype: 'int32' ): Int32Array;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
142
|
-
*
|
|
143
|
-
* ## Notes
|
|
144
|
-
*
|
|
145
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
146
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
147
|
-
*
|
|
148
|
-
* @param x - input array from which to derive the output array length
|
|
149
|
-
* @param dtype - data type
|
|
150
|
-
* @returns empty array
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
154
|
-
*
|
|
155
|
-
* var x = zeros( 2, 'float32' );
|
|
156
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
157
|
-
*
|
|
158
|
-
* var arr = emptyLike( x, 'int16' );
|
|
159
|
-
* // returns <Int16Array>
|
|
160
|
-
*/
|
|
161
|
-
declare function emptyLike( x: AnyArray, dtype: 'int16' ): Int16Array;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
165
|
-
*
|
|
166
|
-
* ## Notes
|
|
167
|
-
*
|
|
168
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
169
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
170
|
-
*
|
|
171
|
-
* @param x - input array from which to derive the output array length
|
|
172
|
-
* @param dtype - data type
|
|
173
|
-
* @returns empty array
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
177
|
-
*
|
|
178
|
-
* var x = zeros( 2, 'float32' );
|
|
179
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
180
|
-
*
|
|
181
|
-
* var arr = emptyLike( x, 'int8' );
|
|
182
|
-
* // returns <Int8Array>
|
|
183
|
-
*/
|
|
184
|
-
declare function emptyLike( x: AnyArray, dtype: 'int8' ): Int8Array;
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
188
|
-
*
|
|
189
|
-
* ## Notes
|
|
190
|
-
*
|
|
191
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
192
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
193
|
-
*
|
|
194
|
-
* @param x - input array from which to derive the output array length
|
|
195
|
-
* @param dtype - data type
|
|
196
|
-
* @returns empty array
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
200
|
-
*
|
|
201
|
-
* var x = zeros( 2, 'float32' );
|
|
202
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
203
|
-
*
|
|
204
|
-
* var arr = emptyLike( x, 'uint32' );
|
|
205
|
-
* // returns <Uint32Array>
|
|
206
|
-
*/
|
|
207
|
-
declare function emptyLike( x: AnyArray, dtype: 'uint32' ): Uint32Array;
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
211
|
-
*
|
|
212
|
-
* ## Notes
|
|
213
|
-
*
|
|
214
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
215
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
216
|
-
*
|
|
217
|
-
* @param x - input array from which to derive the output array length
|
|
218
|
-
* @param dtype - data type
|
|
219
|
-
* @returns empty array
|
|
220
|
-
*
|
|
221
|
-
* @example
|
|
222
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
223
|
-
*
|
|
224
|
-
* var x = zeros( 2, 'float32' );
|
|
225
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
226
|
-
*
|
|
227
|
-
* var arr = emptyLike( x, 'uint16' );
|
|
228
|
-
* // returns <Uint16Array>
|
|
229
|
-
*/
|
|
230
|
-
declare function emptyLike( x: AnyArray, dtype: 'uint16' ): Uint16Array;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Creates an uninitialized array having the same length as a provided input array.
|
|
234
|
-
*
|
|
235
|
-
* ## Notes
|
|
236
|
-
*
|
|
237
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
238
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
239
|
-
*
|
|
240
|
-
* @param x - input array from which to derive the output array length
|
|
241
|
-
* @param dtype - data type
|
|
242
|
-
* @returns empty array
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
246
|
-
*
|
|
247
|
-
* var x = zeros( 2, 'float32' );
|
|
248
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
249
|
-
*
|
|
250
|
-
* var arr = emptyLike( x, 'uint8' );
|
|
251
|
-
* // returns <Uint8Array>
|
|
252
|
-
*/
|
|
253
|
-
declare function emptyLike( x: AnyArray, dtype: 'uint8' ): Uint8Array;
|
|
67
|
+
declare function emptyLike<T extends TypedArray | ComplexTypedArray | BooleanTypedArray>( x: T ): T;
|
|
254
68
|
|
|
255
69
|
/**
|
|
256
70
|
* Creates an uninitialized array having the same length as a provided input array.
|
|
@@ -258,516 +72,9 @@ declare function emptyLike( x: AnyArray, dtype: 'uint8' ): Uint8Array;
|
|
|
258
72
|
* ## Notes
|
|
259
73
|
*
|
|
260
74
|
* - In browser environments, the function always returns zero-filled arrays.
|
|
261
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
262
|
-
*
|
|
263
|
-
* @param x - input array from which to derive the output array length
|
|
264
|
-
* @param dtype - data type
|
|
265
|
-
* @returns empty array
|
|
266
|
-
*
|
|
267
|
-
* @example
|
|
268
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
269
|
-
*
|
|
270
|
-
* var x = zeros( 2, 'float32' );
|
|
271
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
272
|
-
*
|
|
273
|
-
* var arr = emptyLike( x, 'uint8c' );
|
|
274
|
-
* // returns <Uint8ClampedArray>
|
|
275
|
-
*/
|
|
276
|
-
declare function emptyLike( x: AnyArray, dtype: 'uint8c' ): Uint8ClampedArray;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Creates a zero-filled array having a specified length.
|
|
280
|
-
*
|
|
281
|
-
* @param x - input array from which to derive the output array length
|
|
282
|
-
* @param dtype - data type
|
|
283
|
-
* @returns zero-filled array
|
|
284
|
-
*
|
|
285
|
-
* @example
|
|
286
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
287
|
-
*
|
|
288
|
-
* var x = zeros( 2, 'float32' );
|
|
289
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
290
|
-
*
|
|
291
|
-
* var arr = emptyLike( x, 'generic' );
|
|
292
|
-
* // returns [ 0.0, 0.0 ]
|
|
293
|
-
*/
|
|
294
|
-
declare function emptyLike( x: AnyArray, dtype: 'generic' ): Array<number>;
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
298
|
-
*
|
|
299
|
-
* The function supports the following data types:
|
|
300
|
-
*
|
|
301
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
302
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
303
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
304
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
305
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
306
|
-
* - `uint32`: 32-bit unsigned integers
|
|
307
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
308
|
-
* - `uint16`: 16-bit unsigned integers
|
|
309
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
310
|
-
* - `uint8`: 8-bit unsigned integers
|
|
311
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
312
|
-
* - `generic`: generic JavaScript values
|
|
313
|
-
*
|
|
314
|
-
* ## Notes
|
|
315
|
-
*
|
|
316
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
317
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
318
|
-
*
|
|
319
|
-
* @param x - input array from which to derive the output array length
|
|
320
|
-
* @param dtype - data type
|
|
321
|
-
* @returns empty array
|
|
322
|
-
*
|
|
323
|
-
* @example
|
|
324
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
325
|
-
*
|
|
326
|
-
* var x = zeros( 2, 'float64' );
|
|
327
|
-
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
328
|
-
*
|
|
329
|
-
* var arr = emptyLike( x );
|
|
330
|
-
* // returns <Float64Array>
|
|
331
|
-
*/
|
|
332
|
-
declare function emptyLike( x: Float64Array, dtype?: DataType ): Float64Array;
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
336
|
-
*
|
|
337
|
-
* The function supports the following data types:
|
|
338
|
-
*
|
|
339
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
340
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
341
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
342
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
343
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
344
|
-
* - `uint32`: 32-bit unsigned integers
|
|
345
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
346
|
-
* - `uint16`: 16-bit unsigned integers
|
|
347
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
348
|
-
* - `uint8`: 8-bit unsigned integers
|
|
349
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
350
|
-
* - `generic`: generic JavaScript values
|
|
351
|
-
*
|
|
352
|
-
* ## Notes
|
|
353
|
-
*
|
|
354
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
355
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
356
|
-
*
|
|
357
|
-
* @param x - input array from which to derive the output array length
|
|
358
|
-
* @param dtype - data type
|
|
359
|
-
* @returns empty array
|
|
360
|
-
*
|
|
361
|
-
* @example
|
|
362
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
363
|
-
*
|
|
364
|
-
* var x = zeros( 2, 'float32' );
|
|
365
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
366
|
-
*
|
|
367
|
-
* var arr = emptyLike( x );
|
|
368
|
-
* // returns <Float32Array>
|
|
369
|
-
*/
|
|
370
|
-
declare function emptyLike( x: Float32Array, dtype?: DataType ): Float32Array;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
374
|
-
*
|
|
375
|
-
* The function supports the following data types:
|
|
376
|
-
*
|
|
377
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
378
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
379
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
380
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
381
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
382
|
-
* - `uint32`: 32-bit unsigned integers
|
|
383
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
384
|
-
* - `uint16`: 16-bit unsigned integers
|
|
385
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
386
|
-
* - `uint8`: 8-bit unsigned integers
|
|
387
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
388
|
-
* - `generic`: generic JavaScript values
|
|
389
|
-
*
|
|
390
|
-
* ## Notes
|
|
391
|
-
*
|
|
392
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
393
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
394
|
-
*
|
|
395
|
-
* @param x - input array from which to derive the output array length
|
|
396
|
-
* @param dtype - data type
|
|
397
|
-
* @returns empty array
|
|
398
|
-
*
|
|
399
|
-
* @example
|
|
400
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
401
|
-
*
|
|
402
|
-
* var x = zeros( 2, 'complex128' );
|
|
403
|
-
* // returns <Complex128Array>
|
|
404
|
-
*
|
|
405
|
-
* var arr = emptyLike( x );
|
|
406
|
-
* // returns <Complex128Array>
|
|
407
|
-
*/
|
|
408
|
-
declare function emptyLike( x: Complex128Array, dtype?: DataType ): Complex128Array;
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
412
|
-
*
|
|
413
|
-
* The function supports the following data types:
|
|
414
|
-
*
|
|
415
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
416
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
417
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
418
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
419
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
420
|
-
* - `uint32`: 32-bit unsigned integers
|
|
421
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
422
|
-
* - `uint16`: 16-bit unsigned integers
|
|
423
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
424
|
-
* - `uint8`: 8-bit unsigned integers
|
|
425
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
426
|
-
* - `generic`: generic JavaScript values
|
|
427
|
-
*
|
|
428
|
-
* ## Notes
|
|
429
|
-
*
|
|
430
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
431
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
432
|
-
*
|
|
433
|
-
* @param x - input array from which to derive the output array length
|
|
434
|
-
* @param dtype - data type
|
|
435
|
-
* @returns empty array
|
|
436
|
-
*
|
|
437
|
-
* @example
|
|
438
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
439
|
-
*
|
|
440
|
-
* var x = zeros( 2, 'complex64' );
|
|
441
|
-
* // returns <Complex64Array>
|
|
442
|
-
*
|
|
443
|
-
* var arr = emptyLike( x );
|
|
444
|
-
* // returns <Complex64Array>
|
|
445
|
-
*/
|
|
446
|
-
declare function emptyLike( x: Complex64Array, dtype?: DataType ): Complex64Array;
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
450
|
-
*
|
|
451
|
-
* The function supports the following data types:
|
|
452
|
-
*
|
|
453
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
454
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
455
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
456
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
457
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
458
|
-
* - `uint32`: 32-bit unsigned integers
|
|
459
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
460
|
-
* - `uint16`: 16-bit unsigned integers
|
|
461
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
462
|
-
* - `uint8`: 8-bit unsigned integers
|
|
463
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
464
|
-
* - `generic`: generic JavaScript values
|
|
465
|
-
*
|
|
466
|
-
* ## Notes
|
|
467
|
-
*
|
|
468
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
469
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
470
|
-
*
|
|
471
|
-
* @param x - input array from which to derive the output array length
|
|
472
|
-
* @param dtype - data type
|
|
473
|
-
* @returns empty array
|
|
474
|
-
*
|
|
475
|
-
* @example
|
|
476
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
477
|
-
*
|
|
478
|
-
* var x = zeros( 2, 'int32' );
|
|
479
|
-
* // returns <Int32Array>[ 0, 0 ]
|
|
480
|
-
*
|
|
481
|
-
* var arr = emptyLike( x );
|
|
482
|
-
* // returns <Int32Array>
|
|
483
|
-
*/
|
|
484
|
-
declare function emptyLike( x: Int32Array, dtype?: DataType ): Int32Array;
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
488
|
-
*
|
|
489
|
-
* The function supports the following data types:
|
|
490
|
-
*
|
|
491
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
492
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
493
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
494
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
495
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
496
|
-
* - `uint32`: 32-bit unsigned integers
|
|
497
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
498
|
-
* - `uint16`: 16-bit unsigned integers
|
|
499
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
500
|
-
* - `uint8`: 8-bit unsigned integers
|
|
501
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
502
|
-
* - `generic`: generic JavaScript values
|
|
503
|
-
*
|
|
504
|
-
* ## Notes
|
|
505
|
-
*
|
|
506
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
507
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
508
|
-
*
|
|
509
|
-
* @param x - input array from which to derive the output array length
|
|
510
|
-
* @param dtype - data type
|
|
511
|
-
* @returns empty array
|
|
512
|
-
*
|
|
513
|
-
* @example
|
|
514
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
515
|
-
*
|
|
516
|
-
* var x = zeros( 2, 'int16' );
|
|
517
|
-
* // returns <Int16Array>[ 0, 0 ]
|
|
518
|
-
*
|
|
519
|
-
* var arr = emptyLike( x );
|
|
520
|
-
* // returns <Int16Array>
|
|
521
|
-
*/
|
|
522
|
-
declare function emptyLike( x: Int16Array, dtype?: DataType ): Int16Array;
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
526
|
-
*
|
|
527
|
-
* The function supports the following data types:
|
|
528
|
-
*
|
|
529
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
530
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
531
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
532
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
533
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
534
|
-
* - `uint32`: 32-bit unsigned integers
|
|
535
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
536
|
-
* - `uint16`: 16-bit unsigned integers
|
|
537
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
538
|
-
* - `uint8`: 8-bit unsigned integers
|
|
539
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
540
|
-
* - `generic`: generic JavaScript values
|
|
541
|
-
*
|
|
542
|
-
* ## Notes
|
|
543
|
-
*
|
|
544
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
545
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
546
|
-
*
|
|
547
|
-
* @param x - input array from which to derive the output array length
|
|
548
|
-
* @param dtype - data type
|
|
549
|
-
* @returns empty array
|
|
550
|
-
*
|
|
551
|
-
* @example
|
|
552
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
553
|
-
*
|
|
554
|
-
* var x = zeros( 2, 'int8' );
|
|
555
|
-
* // returns <Int8Array>[ 0, 0 ]
|
|
556
|
-
*
|
|
557
|
-
* var arr = emptyLike( x );
|
|
558
|
-
* // returns <Int8Array>
|
|
559
|
-
*/
|
|
560
|
-
declare function emptyLike( x: Int8Array, dtype?: DataType ): Int8Array;
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
564
|
-
*
|
|
565
|
-
* The function supports the following data types:
|
|
566
|
-
*
|
|
567
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
568
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
569
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
570
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
571
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
572
|
-
* - `uint32`: 32-bit unsigned integers
|
|
573
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
574
|
-
* - `uint16`: 16-bit unsigned integers
|
|
575
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
576
|
-
* - `uint8`: 8-bit unsigned integers
|
|
577
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
578
|
-
* - `generic`: generic JavaScript values
|
|
579
|
-
*
|
|
580
|
-
* ## Notes
|
|
581
|
-
*
|
|
582
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
583
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
584
|
-
*
|
|
585
|
-
* @param x - input array from which to derive the output array length
|
|
586
|
-
* @param dtype - data type
|
|
587
|
-
* @returns empty array
|
|
588
|
-
*
|
|
589
|
-
* @example
|
|
590
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
591
|
-
*
|
|
592
|
-
* var x = zeros( 2, 'uint32' );
|
|
593
|
-
* // returns <Uint32Array>[ 0, 0 ]
|
|
594
|
-
*
|
|
595
|
-
* var arr = emptyLike( x );
|
|
596
|
-
* // returns <Uint32Array>
|
|
597
|
-
*/
|
|
598
|
-
declare function emptyLike( x: Uint32Array, dtype?: DataType ): Uint32Array;
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
602
|
-
*
|
|
603
|
-
* The function supports the following data types:
|
|
604
|
-
*
|
|
605
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
606
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
607
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
608
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
609
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
610
|
-
* - `uint32`: 32-bit unsigned integers
|
|
611
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
612
|
-
* - `uint16`: 16-bit unsigned integers
|
|
613
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
614
|
-
* - `uint8`: 8-bit unsigned integers
|
|
615
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
616
|
-
* - `generic`: generic JavaScript values
|
|
617
|
-
*
|
|
618
|
-
* ## Notes
|
|
619
|
-
*
|
|
620
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
621
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
622
|
-
*
|
|
623
|
-
* @param x - input array from which to derive the output array length
|
|
624
|
-
* @param dtype - data type
|
|
625
|
-
* @returns empty array
|
|
626
|
-
*
|
|
627
|
-
* @example
|
|
628
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
629
|
-
*
|
|
630
|
-
* var x = zeros( 2, 'uint16' );
|
|
631
|
-
* // returns <Uint16Array>[ 0, 0 ]
|
|
632
|
-
*
|
|
633
|
-
* var arr = emptyLike( x );
|
|
634
|
-
* // returns <Uint16Array>
|
|
635
|
-
*/
|
|
636
|
-
declare function emptyLike( x: Uint16Array, dtype?: DataType ): Uint16Array;
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
640
|
-
*
|
|
641
|
-
* The function supports the following data types:
|
|
642
|
-
*
|
|
643
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
644
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
645
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
646
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
647
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
648
|
-
* - `uint32`: 32-bit unsigned integers
|
|
649
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
650
|
-
* - `uint16`: 16-bit unsigned integers
|
|
651
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
652
|
-
* - `uint8`: 8-bit unsigned integers
|
|
653
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
654
|
-
* - `generic`: generic JavaScript values
|
|
655
|
-
*
|
|
656
|
-
* ## Notes
|
|
657
|
-
*
|
|
658
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
659
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
660
|
-
*
|
|
661
|
-
* @param x - input array from which to derive the output array length
|
|
662
|
-
* @param dtype - data type
|
|
663
|
-
* @returns empty array
|
|
664
|
-
*
|
|
665
|
-
* @example
|
|
666
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
667
|
-
*
|
|
668
|
-
* var x = zeros( 2, 'uint8' );
|
|
669
|
-
* // returns <Uint8Array>[ 0, 0 ]
|
|
670
|
-
*
|
|
671
|
-
* var arr = emptyLike( x );
|
|
672
|
-
* // returns <Uint8Array>
|
|
673
|
-
*/
|
|
674
|
-
declare function emptyLike( x: Uint8Array, dtype?: DataType ): Uint8Array;
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
678
|
-
*
|
|
679
|
-
* The function supports the following data types:
|
|
680
|
-
*
|
|
681
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
682
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
683
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
684
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
685
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
686
|
-
* - `uint32`: 32-bit unsigned integers
|
|
687
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
688
|
-
* - `uint16`: 16-bit unsigned integers
|
|
689
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
690
|
-
* - `uint8`: 8-bit unsigned integers
|
|
691
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
692
|
-
* - `generic`: generic JavaScript values
|
|
693
|
-
*
|
|
694
|
-
* ## Notes
|
|
695
|
-
*
|
|
696
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
697
|
-
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
698
|
-
*
|
|
699
|
-
* @param x - input array from which to derive the output array length
|
|
700
|
-
* @param dtype - data type
|
|
701
|
-
* @returns empty array
|
|
702
|
-
*
|
|
703
|
-
* @example
|
|
704
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
705
|
-
*
|
|
706
|
-
* var x = zeros( 2, 'uint8c' );
|
|
707
|
-
* // returns <Uint8ClampedArray>[ 0, 0 ]
|
|
708
|
-
*
|
|
709
|
-
* var arr = emptyLike( x );
|
|
710
|
-
* // returns <Uint8ClampedArray>
|
|
711
|
-
*/
|
|
712
|
-
declare function emptyLike( x: Uint8ClampedArray, dtype?: DataType ): Uint8ClampedArray;
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
716
|
-
*
|
|
717
|
-
* The function supports the following data types:
|
|
718
|
-
*
|
|
719
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
720
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
721
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
722
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
723
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
724
|
-
* - `uint32`: 32-bit unsigned integers
|
|
725
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
726
|
-
* - `uint16`: 16-bit unsigned integers
|
|
727
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
728
|
-
* - `uint8`: 8-bit unsigned integers
|
|
729
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
730
|
-
* - `generic`: generic JavaScript values
|
|
731
|
-
*
|
|
732
|
-
* @param x - input array from which to derive the output array length
|
|
733
|
-
* @param dtype - data type
|
|
734
|
-
* @returns empty array
|
|
735
|
-
*
|
|
736
|
-
* @example
|
|
737
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
738
|
-
*
|
|
739
|
-
* var x = zeros( 2, 'generic' );
|
|
740
|
-
* // returns [ 0.0, 0.0 ]
|
|
741
|
-
*
|
|
742
|
-
* var arr = emptyLike( x );
|
|
743
|
-
* // returns [ 0.0, 0.0 ]
|
|
744
|
-
*/
|
|
745
|
-
declare function emptyLike( x: Array<any>, dtype?: DataType ): Array<number>;
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
749
|
-
*
|
|
750
|
-
* ## Notes
|
|
751
|
-
*
|
|
752
|
-
* - In browser environments, the function always returns zero-filled arrays.
|
|
753
75
|
* - If `dtype` is `'generic'`, the function always returns a zero-filled array.
|
|
754
76
|
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
755
77
|
*
|
|
756
|
-
* The function recognizes the following data types:
|
|
757
|
-
*
|
|
758
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
759
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
760
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
761
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
762
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
763
|
-
* - `uint32`: 32-bit unsigned integers
|
|
764
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
765
|
-
* - `uint16`: 16-bit unsigned integers
|
|
766
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
767
|
-
* - `uint8`: 8-bit unsigned integers
|
|
768
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
769
|
-
* - `generic`: generic JavaScript values
|
|
770
|
-
*
|
|
771
78
|
* @param x - input array from which to derive the output array length
|
|
772
79
|
* @param dtype - data type
|
|
773
80
|
* @returns empty array
|
|
@@ -775,22 +82,13 @@ declare function emptyLike( x: Array<any>, dtype?: DataType ): Array<number>;
|
|
|
775
82
|
* @example
|
|
776
83
|
* var zeros = require( '@stdlib/array-zeros' );
|
|
777
84
|
*
|
|
778
|
-
* var x = zeros( 2, 'float32' );
|
|
779
|
-
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
780
|
-
*
|
|
781
|
-
* var arr = emptyLike( x );
|
|
782
|
-
* // returns <Float32Array>
|
|
783
|
-
*
|
|
784
|
-
* @example
|
|
785
|
-
* var zeros = require( '@stdlib/array-zeros' );
|
|
786
|
-
*
|
|
787
85
|
* var x = zeros( 2, 'float64' );
|
|
788
86
|
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
789
87
|
*
|
|
790
|
-
* var arr = emptyLike( x );
|
|
791
|
-
* // returns <
|
|
88
|
+
* var arr = emptyLike( x, 'float32' );
|
|
89
|
+
* // returns <Float32Array>
|
|
792
90
|
*/
|
|
793
|
-
declare function emptyLike( x: AnyArray, dtype
|
|
91
|
+
declare function emptyLike<T extends keyof DataTypeMap<number>>( x: AnyArray, dtype: T ): DataTypeMap<number>[T];
|
|
794
92
|
|
|
795
93
|
|
|
796
94
|
// EXPORTS //
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-empty-like",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Create an uninitialized array having the same length and data type as a provided array.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -15,19 +15,12 @@
|
|
|
15
15
|
],
|
|
16
16
|
"main": "./lib",
|
|
17
17
|
"directories": {
|
|
18
|
-
"benchmark": "./benchmark",
|
|
19
18
|
"doc": "./docs",
|
|
20
|
-
"example": "./examples",
|
|
21
19
|
"lib": "./lib",
|
|
22
|
-
"
|
|
20
|
+
"dist": "./dist"
|
|
23
21
|
},
|
|
24
22
|
"types": "./docs/types",
|
|
25
|
-
"scripts": {
|
|
26
|
-
"test": "make test",
|
|
27
|
-
"test-cov": "make test-cov",
|
|
28
|
-
"examples": "make examples",
|
|
29
|
-
"benchmark": "make benchmark"
|
|
30
|
-
},
|
|
23
|
+
"scripts": {},
|
|
31
24
|
"homepage": "https://stdlib.io",
|
|
32
25
|
"repository": {
|
|
33
26
|
"type": "git",
|
|
@@ -37,37 +30,12 @@
|
|
|
37
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
31
|
},
|
|
39
32
|
"dependencies": {
|
|
40
|
-
"@stdlib/array-dtype": "^0.2.
|
|
41
|
-
"@stdlib/array-empty": "^0.2.
|
|
42
|
-
"@stdlib/string-format": "^0.2.
|
|
43
|
-
"@stdlib/
|
|
44
|
-
"@stdlib/error-tools-fmtprodmsg": "^0.2.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@stdlib/array-complex128": "^0.1.0",
|
|
48
|
-
"@stdlib/array-complex64": "^0.1.0",
|
|
49
|
-
"@stdlib/array-dtypes": "^0.2.0",
|
|
50
|
-
"@stdlib/array-float32": "^0.2.0",
|
|
51
|
-
"@stdlib/array-float64": "^0.2.0",
|
|
52
|
-
"@stdlib/array-int16": "^0.2.0",
|
|
53
|
-
"@stdlib/array-int32": "^0.2.0",
|
|
54
|
-
"@stdlib/array-int8": "^0.2.0",
|
|
55
|
-
"@stdlib/array-uint16": "^0.2.0",
|
|
56
|
-
"@stdlib/array-uint32": "^0.2.0",
|
|
57
|
-
"@stdlib/array-uint8": "^0.2.0",
|
|
58
|
-
"@stdlib/array-uint8c": "^0.2.0",
|
|
59
|
-
"@stdlib/array-zeros": "^0.1.0",
|
|
60
|
-
"@stdlib/assert-instance-of": "^0.2.0",
|
|
61
|
-
"@stdlib/assert-is-array": "^0.2.0",
|
|
62
|
-
"@stdlib/assert-is-typed-array": "^0.2.0",
|
|
63
|
-
"@stdlib/assert-is-typed-array-like": "^0.2.0",
|
|
64
|
-
"@stdlib/math-base-special-pow": "^0.2.0",
|
|
65
|
-
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
66
|
-
"istanbul": "^0.4.1",
|
|
67
|
-
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",
|
|
68
|
-
"@stdlib/bench-harness": "^0.2.0",
|
|
69
|
-
"@stdlib/bench": "^0.3.1"
|
|
33
|
+
"@stdlib/array-dtype": "^0.2.1",
|
|
34
|
+
"@stdlib/array-empty": "^0.2.1",
|
|
35
|
+
"@stdlib/string-format": "^0.2.2",
|
|
36
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
|
|
70
37
|
},
|
|
38
|
+
"devDependencies": {},
|
|
71
39
|
"engines": {
|
|
72
40
|
"node": ">=0.10.0",
|
|
73
41
|
"npm": ">2.7.0"
|
|
@@ -107,6 +75,7 @@
|
|
|
107
75
|
"uint8clampedarray",
|
|
108
76
|
"complex128array",
|
|
109
77
|
"complex64array",
|
|
78
|
+
"booleanarray",
|
|
110
79
|
"complex128",
|
|
111
80
|
"complex64",
|
|
112
81
|
"complex",
|
|
@@ -133,6 +102,7 @@
|
|
|
133
102
|
"clamped",
|
|
134
103
|
"short",
|
|
135
104
|
"long",
|
|
105
|
+
"bool",
|
|
136
106
|
"generic",
|
|
137
107
|
"empty",
|
|
138
108
|
"empty-like"
|