@stdlib/array-empty-like 0.1.0 → 0.2.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.
- package/NOTICE +1 -1
- package/README.md +30 -3
- package/SECURITY.md +5 -0
- package/docs/types/index.d.ts +16 -703
- package/package.json +8 -39
- package/CITATION.cff +0 -30
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2024 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -160,6 +160,16 @@ for ( i = 0; i < dt.length; i++ ) {
|
|
|
160
160
|
|
|
161
161
|
<section class="related">
|
|
162
162
|
|
|
163
|
+
* * *
|
|
164
|
+
|
|
165
|
+
## See Also
|
|
166
|
+
|
|
167
|
+
- <span class="package-name">[`@stdlib/array-empty`][@stdlib/array/empty]</span><span class="delimiter">: </span><span class="description">create an uninitialized array having a specified length.</span>
|
|
168
|
+
- <span class="package-name">[`@stdlib/array-full-like`][@stdlib/array/full-like]</span><span class="delimiter">: </span><span class="description">create a filled array having the same length and data type as a provided array.</span>
|
|
169
|
+
- <span class="package-name">[`@stdlib/array-ones-like`][@stdlib/array/ones-like]</span><span class="delimiter">: </span><span class="description">create an array filled with ones and having the same length and data type as a provided array.</span>
|
|
170
|
+
- <span class="package-name">[`@stdlib/array-zeros-like`][@stdlib/array/zeros-like]</span><span class="delimiter">: </span><span class="description">create a zero-filled array having the same length and data type as a provided array.</span>
|
|
171
|
+
- <span class="package-name">[`@stdlib/ndarray-empty-like`][@stdlib/ndarray/empty-like]</span><span class="delimiter">: </span><span class="description">create an uninitialized ndarray having the same shape and data type as a provided ndarray.</span>
|
|
172
|
+
|
|
163
173
|
</section>
|
|
164
174
|
|
|
165
175
|
<!-- /.related -->
|
|
@@ -190,7 +200,7 @@ See [LICENSE][stdlib-license].
|
|
|
190
200
|
|
|
191
201
|
## Copyright
|
|
192
202
|
|
|
193
|
-
Copyright © 2016-
|
|
203
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
194
204
|
|
|
195
205
|
</section>
|
|
196
206
|
|
|
@@ -203,8 +213,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
203
213
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-empty-like.svg
|
|
204
214
|
[npm-url]: https://npmjs.org/package/@stdlib/array-empty-like
|
|
205
215
|
|
|
206
|
-
[test-image]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml/badge.svg?branch=v0.1
|
|
207
|
-
[test-url]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml?query=branch:v0.1
|
|
216
|
+
[test-image]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml/badge.svg?branch=v0.2.1
|
|
217
|
+
[test-url]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml?query=branch:v0.2.1
|
|
208
218
|
|
|
209
219
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-empty-like/main.svg
|
|
210
220
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-empty-like?branch=main
|
|
@@ -227,12 +237,29 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
227
237
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
228
238
|
|
|
229
239
|
[deno-url]: https://github.com/stdlib-js/array-empty-like/tree/deno
|
|
240
|
+
[deno-readme]: https://github.com/stdlib-js/array-empty-like/blob/deno/README.md
|
|
230
241
|
[umd-url]: https://github.com/stdlib-js/array-empty-like/tree/umd
|
|
242
|
+
[umd-readme]: https://github.com/stdlib-js/array-empty-like/blob/umd/README.md
|
|
231
243
|
[esm-url]: https://github.com/stdlib-js/array-empty-like/tree/esm
|
|
244
|
+
[esm-readme]: https://github.com/stdlib-js/array-empty-like/blob/esm/README.md
|
|
232
245
|
[branches-url]: https://github.com/stdlib-js/array-empty-like/blob/main/branches.md
|
|
233
246
|
|
|
234
247
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-empty-like/main/LICENSE
|
|
235
248
|
|
|
249
|
+
<!-- <related-links> -->
|
|
250
|
+
|
|
251
|
+
[@stdlib/array/empty]: https://www.npmjs.com/package/@stdlib/array-empty
|
|
252
|
+
|
|
253
|
+
[@stdlib/array/full-like]: https://www.npmjs.com/package/@stdlib/array-full-like
|
|
254
|
+
|
|
255
|
+
[@stdlib/array/ones-like]: https://www.npmjs.com/package/@stdlib/array-ones-like
|
|
256
|
+
|
|
257
|
+
[@stdlib/array/zeros-like]: https://www.npmjs.com/package/@stdlib/array-zeros-like
|
|
258
|
+
|
|
259
|
+
[@stdlib/ndarray/empty-like]: https://www.npmjs.com/package/@stdlib/ndarray-empty-like
|
|
260
|
+
|
|
261
|
+
<!-- </related-links> -->
|
|
262
|
+
|
|
236
263
|
</section>
|
|
237
264
|
|
|
238
265
|
<!-- /.links -->
|
package/SECURITY.md
ADDED
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, 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
|
-
* var zeros = require(
|
|
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
|
-
* var zeros = require(
|
|
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>( x: T ): T;
|
|
254
68
|
|
|
255
69
|
/**
|
|
256
70
|
* Creates an uninitialized array having the same length as a provided input array.
|
|
@@ -258,45 +72,10 @@ 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.
|
|
75
|
+
* - If `dtype` is `'generic'`, the function always returns a zero-filled array.
|
|
261
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.
|
|
262
77
|
*
|
|
263
|
-
*
|
|
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:
|
|
78
|
+
* The function recognizes the following data types:
|
|
300
79
|
*
|
|
301
80
|
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
302
81
|
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
@@ -311,486 +90,20 @@ declare function emptyLike( x: AnyArray, dtype: 'generic' ): Array<number>;
|
|
|
311
90
|
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
312
91
|
* - `generic`: generic JavaScript values
|
|
313
92
|
*
|
|
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
93
|
* @param x - input array from which to derive the output array length
|
|
320
94
|
* @param dtype - data type
|
|
321
95
|
* @returns empty array
|
|
322
96
|
*
|
|
323
97
|
* @example
|
|
324
|
-
* var zeros = require(
|
|
98
|
+
* var zeros = require( '@stdlib/array-zeros' );
|
|
325
99
|
*
|
|
326
100
|
* 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
101
|
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
366
102
|
*
|
|
367
|
-
* var arr = emptyLike( x );
|
|
103
|
+
* var arr = emptyLike( x, 'float32' );
|
|
368
104
|
* // returns <Float32Array>
|
|
369
105
|
*/
|
|
370
|
-
declare function emptyLike( x:
|
|
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;
|
|
106
|
+
declare function emptyLike<T extends keyof DataTypeMap<number>>( x: AnyArray, dtype: T ): DataTypeMap<number>[T];
|
|
794
107
|
|
|
795
108
|
|
|
796
109
|
// EXPORTS //
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-empty-like",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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,36 +30,12 @@
|
|
|
37
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
31
|
},
|
|
39
32
|
"dependencies": {
|
|
40
|
-
"@stdlib/array-dtype": "^0.1
|
|
41
|
-
"@stdlib/array-empty": "^0.1
|
|
42
|
-
"@stdlib/string-format": "^0.1
|
|
43
|
-
"@stdlib/
|
|
44
|
-
"@stdlib/error-tools-fmtprodmsg": "^0.1.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@stdlib/array-complex128": "^0.1.0",
|
|
48
|
-
"@stdlib/array-complex64": "^0.1.0",
|
|
49
|
-
"@stdlib/array-dtypes": "^0.1.0",
|
|
50
|
-
"@stdlib/array-float32": "^0.1.0",
|
|
51
|
-
"@stdlib/array-float64": "^0.1.0",
|
|
52
|
-
"@stdlib/array-int16": "^0.1.0",
|
|
53
|
-
"@stdlib/array-int32": "^0.1.0",
|
|
54
|
-
"@stdlib/array-int8": "^0.1.0",
|
|
55
|
-
"@stdlib/array-uint16": "^0.1.0",
|
|
56
|
-
"@stdlib/array-uint32": "^0.1.0",
|
|
57
|
-
"@stdlib/array-uint8": "^0.1.0",
|
|
58
|
-
"@stdlib/array-uint8c": "^0.1.0",
|
|
59
|
-
"@stdlib/array-zeros": "^0.1.0",
|
|
60
|
-
"@stdlib/assert-instance-of": "^0.1.0",
|
|
61
|
-
"@stdlib/assert-is-array": "^0.1.0",
|
|
62
|
-
"@stdlib/assert-is-typed-array": "^0.1.0",
|
|
63
|
-
"@stdlib/assert-is-typed-array-like": "^0.1.0",
|
|
64
|
-
"@stdlib/bench": "^0.1.0",
|
|
65
|
-
"@stdlib/math-base-special-pow": "^0.1.0",
|
|
66
|
-
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
67
|
-
"istanbul": "^0.4.1",
|
|
68
|
-
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
33
|
+
"@stdlib/array-dtype": "^0.2.1",
|
|
34
|
+
"@stdlib/array-empty": "^0.2.1",
|
|
35
|
+
"@stdlib/string-format": "^0.2.1",
|
|
36
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.1"
|
|
69
37
|
},
|
|
38
|
+
"devDependencies": {},
|
|
70
39
|
"engines": {
|
|
71
40
|
"node": ">=0.10.0",
|
|
72
41
|
"npm": ">2.7.0"
|
package/CITATION.cff
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
cff-version: 1.2.0
|
|
2
|
-
title: stdlib
|
|
3
|
-
message: >-
|
|
4
|
-
If you use this software, please cite it using the
|
|
5
|
-
metadata from this file.
|
|
6
|
-
|
|
7
|
-
type: software
|
|
8
|
-
|
|
9
|
-
authors:
|
|
10
|
-
- name: The Stdlib Authors
|
|
11
|
-
url: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
12
|
-
|
|
13
|
-
repository-code: https://github.com/stdlib-js/stdlib
|
|
14
|
-
url: https://stdlib.io
|
|
15
|
-
|
|
16
|
-
abstract: |
|
|
17
|
-
Standard library for JavaScript and Node.js.
|
|
18
|
-
|
|
19
|
-
keywords:
|
|
20
|
-
- JavaScript
|
|
21
|
-
- Node.js
|
|
22
|
-
- TypeScript
|
|
23
|
-
- standard library
|
|
24
|
-
- scientific computing
|
|
25
|
-
- numerical computing
|
|
26
|
-
- statistical computing
|
|
27
|
-
|
|
28
|
-
license: Apache-2.0 AND BSL-1.0
|
|
29
|
-
|
|
30
|
-
date-released: 2016
|