@stdlib/array-empty-like 0.0.1

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.
@@ -0,0 +1,798 @@
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2023 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ // TypeScript Version: 2.0
20
+
21
+ /// <reference types="@stdlib/types"/>
22
+
23
+ import { AnyArray, Complex128Array, Complex64Array, DataType } from '@stdlib/types/array';
24
+
25
+ /**
26
+ * Creates an uninitialized array having the same length as a provided input array.
27
+ *
28
+ * ## Notes
29
+ *
30
+ * - In browser environments, the function always returns zero-filled arrays.
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
+ *
33
+ * @param x - input array from which to derive the output array length
34
+ * @param dtype - data type
35
+ * @returns empty array
36
+ *
37
+ * @example
38
+ * var zeros = require( `@stdlib/array/zeros` );
39
+ *
40
+ * var x = zeros( 2, 'float32' );
41
+ * // returns <Float32Array>[ 0.0, 0.0 ]
42
+ *
43
+ * var arr = emptyLike( x, 'float64' );
44
+ * // returns <Float64Array>
45
+ */
46
+ declare function emptyLike( x: AnyArray, dtype: 'float64' ): Float64Array;
47
+
48
+ /**
49
+ * Creates an uninitialized array having the same length as a provided input array.
50
+ *
51
+ * ## Notes
52
+ *
53
+ * - In browser environments, the function always returns zero-filled arrays.
54
+ * - 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
+ *
56
+ * @param x - input array from which to derive the output array length
57
+ * @param dtype - data type
58
+ * @returns empty array
59
+ *
60
+ * @example
61
+ * var zeros = require( `@stdlib/array/zeros` );
62
+ *
63
+ * var x = zeros( 2, 'float64' );
64
+ * // returns <Float64Array>[ 0.0, 0.0 ]
65
+ *
66
+ * var arr = emptyLike( x, 'float32' );
67
+ * // returns <Float32Array>
68
+ */
69
+ declare function emptyLike( x: AnyArray, dtype: 'float32' ): Float32Array;
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;
254
+
255
+ /**
256
+ * Creates an uninitialized array having the same length as a provided input array.
257
+ *
258
+ * ## Notes
259
+ *
260
+ * - 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; // tslint:disable-line:max-line-length
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; // tslint:disable-line:max-line-length
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; // tslint:disable-line:max-line-length
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
+ * - If `dtype` is `'generic'`, the function always returns a zero-filled array.
754
+ * - 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
+ *
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
+ * @param x - input array from which to derive the output array length
772
+ * @param dtype - data type
773
+ * @returns empty array
774
+ *
775
+ * @example
776
+ * var zeros = require( `@stdlib/array/zeros` );
777
+ *
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
+ * var x = zeros( 2, 'float64' );
788
+ * // returns <Float32Array>[ 0.0, 0.0 ]
789
+ *
790
+ * var arr = emptyLike( x );
791
+ * // returns <Float64Array>
792
+ */
793
+ declare function emptyLike( x: AnyArray, dtype?: DataType ): AnyArray;
794
+
795
+
796
+ // EXPORTS //
797
+
798
+ export = emptyLike;