@stdlib/array-full-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.
- package/LICENSE +481 -0
- package/NOTICE +1 -0
- package/README.md +224 -0
- package/docs/repl.txt +45 -0
- package/docs/types/index.d.ts +724 -0
- package/docs/types/test.ts +97 -0
- package/lib/index.js +46 -0
- package/lib/main.js +77 -0
- package/package.json +145 -0
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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 { Complex128Array, Complex64Array, AnyArray, DataType } from '@stdlib/types/array';
|
|
24
|
+
import { ComplexLike } from '@stdlib/types/object';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a filled array having the same length as a provided input array.
|
|
28
|
+
*
|
|
29
|
+
* @param x - input array from which to derive the output array length
|
|
30
|
+
* @param value - fill value
|
|
31
|
+
* @param dtype - data type
|
|
32
|
+
* @returns filled array
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
36
|
+
*
|
|
37
|
+
* var x = zeros( 2, 'float32' );
|
|
38
|
+
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
39
|
+
*
|
|
40
|
+
* var y = fullLike( x, 1.0, 'float64' );
|
|
41
|
+
* // returns <Float64Array>[ 1.0, 1.0 ]
|
|
42
|
+
*/
|
|
43
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'float64' ): Float64Array; // tslint:disable-line:max-line-length
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Creates a filled array having the same length as a provided input array.
|
|
47
|
+
*
|
|
48
|
+
* @param x - input array from which to derive the output array length
|
|
49
|
+
* @param value - fill value
|
|
50
|
+
* @param dtype - data type
|
|
51
|
+
* @returns filled array
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
55
|
+
*
|
|
56
|
+
* var x = zeros( 2, 'float64' );
|
|
57
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
58
|
+
*
|
|
59
|
+
* var y = fullLike( x, 1.0, 'float32' );
|
|
60
|
+
* // returns <Float32Array>[ 1.0, 1.0 ]
|
|
61
|
+
*/
|
|
62
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'float32' ): Float32Array; // tslint:disable-line:max-line-length
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Creates a filled array having the same length as a provided input array.
|
|
66
|
+
*
|
|
67
|
+
* ## Notes
|
|
68
|
+
*
|
|
69
|
+
* - If provided a number, the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
|
|
70
|
+
*
|
|
71
|
+
* @param x - input array from which to derive the output array length
|
|
72
|
+
* @param value - fill value
|
|
73
|
+
* @param dtype - data type
|
|
74
|
+
* @returns filled array
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
78
|
+
*
|
|
79
|
+
* var x = zeros( 2, 'float64' );
|
|
80
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
81
|
+
*
|
|
82
|
+
* var y = fullLike( x, 1.0, 'complex128' );
|
|
83
|
+
* // returns <Complex128Array>
|
|
84
|
+
*/
|
|
85
|
+
declare function fullLike( x: AnyArray, value: number | ComplexLike, dtype: 'complex128' ): Complex128Array; // tslint:disable-line:max-line-length
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Creates a filled array having the same length as a provided input array.
|
|
89
|
+
*
|
|
90
|
+
* ## Notes
|
|
91
|
+
*
|
|
92
|
+
* - If provided a number, the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
|
|
93
|
+
*
|
|
94
|
+
* @param x - input array from which to derive the output array length
|
|
95
|
+
* @param value - fill value
|
|
96
|
+
* @param dtype - data type
|
|
97
|
+
* @returns filled array
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
101
|
+
*
|
|
102
|
+
* var x = zeros( 2, 'float64' );
|
|
103
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
104
|
+
*
|
|
105
|
+
* var y = fullLike( x, 1.0, 'complex64' );
|
|
106
|
+
* // returns <Complex64Array>
|
|
107
|
+
*/
|
|
108
|
+
declare function fullLike( x: AnyArray, value: number | ComplexLike, dtype: 'complex64' ): Complex64Array; // tslint:disable-line:max-line-length
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Creates a filled array having the same length as a provided input array.
|
|
112
|
+
*
|
|
113
|
+
* @param x - input array from which to derive the output array length
|
|
114
|
+
* @param value - fill value
|
|
115
|
+
* @param dtype - data type
|
|
116
|
+
* @returns filled array
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
120
|
+
*
|
|
121
|
+
* var x = zeros( 2, 'float64' );
|
|
122
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
123
|
+
*
|
|
124
|
+
* var y = fullLike( x, 1, 'int32' );
|
|
125
|
+
* // returns <Int32Array>[ 1, 1 ]
|
|
126
|
+
*/
|
|
127
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'int32' ): Int32Array; // tslint:disable-line:max-line-length
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Creates a filled array having the same length as a provided input array.
|
|
131
|
+
*
|
|
132
|
+
* @param x - input array from which to derive the output array length
|
|
133
|
+
* @param value - fill value
|
|
134
|
+
* @param dtype - data type
|
|
135
|
+
* @returns filled array
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
139
|
+
*
|
|
140
|
+
* var x = zeros( 2, 'float64' );
|
|
141
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
142
|
+
*
|
|
143
|
+
* var y = fullLike( x, 1, 'int16' );
|
|
144
|
+
* // returns <Int16Array>[ 1, 1 ]
|
|
145
|
+
*/
|
|
146
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'int16' ): Int16Array; // tslint:disable-line:max-line-length
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Creates a filled array having the same length as a provided input array.
|
|
150
|
+
*
|
|
151
|
+
* @param x - input array from which to derive the output array length
|
|
152
|
+
* @param value - fill value
|
|
153
|
+
* @param dtype - data type
|
|
154
|
+
* @returns filled array
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
158
|
+
*
|
|
159
|
+
* var x = zeros( 2, 'float64' );
|
|
160
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
161
|
+
*
|
|
162
|
+
* var y = fullLike( x, 1, 'int8' );
|
|
163
|
+
* // returns <Int8Array>[ 1, 1 ]
|
|
164
|
+
*/
|
|
165
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'int8' ): Int8Array; // tslint:disable-line:max-line-length
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Creates a filled array having the same length as a provided input array.
|
|
169
|
+
*
|
|
170
|
+
* @param x - input array from which to derive the output array length
|
|
171
|
+
* @param value - fill value
|
|
172
|
+
* @param dtype - data type
|
|
173
|
+
* @returns filled array
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
177
|
+
*
|
|
178
|
+
* var x = zeros( 2, 'float64' );
|
|
179
|
+
* // returns <Float64Array>[ 0, 0 ]
|
|
180
|
+
*
|
|
181
|
+
* var y = fullLike( x, 1, 'uint32' );
|
|
182
|
+
* // returns <Uint32Array>[ 1, 1 ]
|
|
183
|
+
*/
|
|
184
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'uint32' ): Uint32Array; // tslint:disable-line:max-line-length
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Creates a filled array having the same length as a provided input array.
|
|
188
|
+
*
|
|
189
|
+
* @param x - input array from which to derive the output array length
|
|
190
|
+
* @param value - fill value
|
|
191
|
+
* @param dtype - data type
|
|
192
|
+
* @returns filled array
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
196
|
+
*
|
|
197
|
+
* var x = zeros( 2, 'float64' );
|
|
198
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
199
|
+
*
|
|
200
|
+
* var y = fullLike( x, 1, 'uint16' );
|
|
201
|
+
* // returns <Uint16Array>[ 1, 1 ]
|
|
202
|
+
*/
|
|
203
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'uint16' ): Uint16Array; // tslint:disable-line:max-line-length
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Creates a filled array having the same length as a provided input array.
|
|
207
|
+
*
|
|
208
|
+
* @param x - input array from which to derive the output array length
|
|
209
|
+
* @param value - fill value
|
|
210
|
+
* @param dtype - data type
|
|
211
|
+
* @returns filled array
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
215
|
+
*
|
|
216
|
+
* var x = zeros( 2, 'float64' );
|
|
217
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
218
|
+
*
|
|
219
|
+
* var y = fullLike( x, 1, 'uint8' );
|
|
220
|
+
* // returns <Uint8Array>[ 1, 1 ]
|
|
221
|
+
*/
|
|
222
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'uint8' ): Uint8Array; // tslint:disable-line:max-line-length
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Creates a filled array having the same length as a provided input array.
|
|
226
|
+
*
|
|
227
|
+
* @param x - input array from which to derive the output array length
|
|
228
|
+
* @param value - fill value
|
|
229
|
+
* @param dtype - data type
|
|
230
|
+
* @returns filled array
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
234
|
+
*
|
|
235
|
+
* var x = zeros( 2, 'float64' );
|
|
236
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
237
|
+
*
|
|
238
|
+
* var y = fullLike( x, 1, 'uint8c' );
|
|
239
|
+
* // returns <Uint8ClampedArray>[ 1, 1 ]
|
|
240
|
+
*/
|
|
241
|
+
declare function fullLike( x: AnyArray, value: number, dtype: 'uint8c' ): Uint8ClampedArray; // tslint:disable-line:max-line-length
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Creates a filled array having the same length as a provided input array.
|
|
245
|
+
*
|
|
246
|
+
* @param x - input array from which to derive the output array length
|
|
247
|
+
* @param value - fill value
|
|
248
|
+
* @param dtype - data type
|
|
249
|
+
* @returns filled array
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
253
|
+
*
|
|
254
|
+
* var x = zeros( 2, 'float64' );
|
|
255
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
256
|
+
*
|
|
257
|
+
* var y = fullLike( x, 1.0, 'generic' );
|
|
258
|
+
* // returns [ 1.0, 1.0 ]
|
|
259
|
+
*/
|
|
260
|
+
declare function fullLike( x: AnyArray, value: any, dtype: 'generic' ): Array<any>; // tslint:disable-line:max-line-length
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
264
|
+
*
|
|
265
|
+
* The function supports the following data types:
|
|
266
|
+
*
|
|
267
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
268
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
269
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
270
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
271
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
272
|
+
* - `uint32`: 32-bit unsigned integers
|
|
273
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
274
|
+
* - `uint16`: 16-bit unsigned integers
|
|
275
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
276
|
+
* - `uint8`: 8-bit unsigned integers
|
|
277
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
278
|
+
* - `generic`: generic JavaScript values
|
|
279
|
+
*
|
|
280
|
+
* @param x - input array from which to derive the output array length
|
|
281
|
+
* @param value - fill value
|
|
282
|
+
* @param dtype - data type
|
|
283
|
+
* @returns filled array
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
287
|
+
*
|
|
288
|
+
* var x = zeros( 2, 'float64' );
|
|
289
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
290
|
+
*
|
|
291
|
+
* var y = fullLike( x, 1.0 );
|
|
292
|
+
* // returns <Float64Array>[ 1.0, 1.0 ]
|
|
293
|
+
*/
|
|
294
|
+
declare function fullLike( x: Float64Array, value: number, dtype?: DataType ): Float64Array; // tslint:disable-line:max-line-length
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Creates a filled 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
|
+
* @param x - input array from which to derive the output array length
|
|
315
|
+
* @param value - fill value
|
|
316
|
+
* @param dtype - data type
|
|
317
|
+
* @returns filled array
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
321
|
+
*
|
|
322
|
+
* var x = zeros( 2, 'float32' );
|
|
323
|
+
* // returns <Float32Array>[ 0.0, 0.0 ]
|
|
324
|
+
*
|
|
325
|
+
* var y = fullLike( x, 1.0 );
|
|
326
|
+
* // returns <Float32Array>[ 1.0, 1.0 ]
|
|
327
|
+
*/
|
|
328
|
+
declare function fullLike( x: Float32Array, value: number, dtype?: DataType ): Float32Array; // tslint:disable-line:max-line-length
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
332
|
+
*
|
|
333
|
+
* The function supports the following data types:
|
|
334
|
+
*
|
|
335
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
336
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
337
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
338
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
339
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
340
|
+
* - `uint32`: 32-bit unsigned integers
|
|
341
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
342
|
+
* - `uint16`: 16-bit unsigned integers
|
|
343
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
344
|
+
* - `uint8`: 8-bit unsigned integers
|
|
345
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
346
|
+
* - `generic`: generic JavaScript values
|
|
347
|
+
*
|
|
348
|
+
* ## Notes
|
|
349
|
+
*
|
|
350
|
+
* - If provided a number, the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
|
|
351
|
+
*
|
|
352
|
+
* @param x - input array from which to derive the output array length
|
|
353
|
+
* @param value - fill value
|
|
354
|
+
* @param dtype - data type
|
|
355
|
+
* @returns filled array
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
359
|
+
*
|
|
360
|
+
* var x = zeros( 2, 'complex128' );
|
|
361
|
+
* // returns <Complex128Array>
|
|
362
|
+
*
|
|
363
|
+
* var y = fullLike( x, 1.0 );
|
|
364
|
+
* // returns <Complex128Array>
|
|
365
|
+
*/
|
|
366
|
+
declare function fullLike( x: Complex128Array, value: number | ComplexLike, dtype?: DataType ): Complex128Array; // tslint:disable-line:max-line-length
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
370
|
+
*
|
|
371
|
+
* The function supports the following data types:
|
|
372
|
+
*
|
|
373
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
374
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
375
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
376
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
377
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
378
|
+
* - `uint32`: 32-bit unsigned integers
|
|
379
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
380
|
+
* - `uint16`: 16-bit unsigned integers
|
|
381
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
382
|
+
* - `uint8`: 8-bit unsigned integers
|
|
383
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
384
|
+
* - `generic`: generic JavaScript values
|
|
385
|
+
*
|
|
386
|
+
* ## Notes
|
|
387
|
+
*
|
|
388
|
+
* - If provided a number, the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
|
|
389
|
+
*
|
|
390
|
+
* @param x - input array from which to derive the output array length
|
|
391
|
+
* @param value - fill value
|
|
392
|
+
* @param dtype - data type
|
|
393
|
+
* @returns filled array
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
397
|
+
*
|
|
398
|
+
* var x = zeros( 2, 'complex64' );
|
|
399
|
+
* // returns <Complex64Array>
|
|
400
|
+
*
|
|
401
|
+
* var y = fullLike( x, 1.0 );
|
|
402
|
+
* // returns <Complex64Array>
|
|
403
|
+
*/
|
|
404
|
+
declare function fullLike( x: Complex64Array, value: number | ComplexLike, dtype?: DataType ): Complex64Array; // tslint:disable-line:max-line-length
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
408
|
+
*
|
|
409
|
+
* The function supports the following data types:
|
|
410
|
+
*
|
|
411
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
412
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
413
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
414
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
415
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
416
|
+
* - `uint32`: 32-bit unsigned integers
|
|
417
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
418
|
+
* - `uint16`: 16-bit unsigned integers
|
|
419
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
420
|
+
* - `uint8`: 8-bit unsigned integers
|
|
421
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
422
|
+
* - `generic`: generic JavaScript values
|
|
423
|
+
*
|
|
424
|
+
* @param x - input array from which to derive the output array length
|
|
425
|
+
* @param value - fill value
|
|
426
|
+
* @param dtype - data type
|
|
427
|
+
* @returns filled array
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
431
|
+
*
|
|
432
|
+
* var x = zeros( 2, 'int32' );
|
|
433
|
+
* // returns <Int32Array>[ 0, 0 ]
|
|
434
|
+
*
|
|
435
|
+
* var y = fullLike( x, 1 );
|
|
436
|
+
* // returns <Int32Array>[ 1, 1 ]
|
|
437
|
+
*/
|
|
438
|
+
declare function fullLike( x: Int32Array, value: number, dtype?: DataType ): Int32Array; // tslint:disable-line:max-line-length
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
442
|
+
*
|
|
443
|
+
* The function supports the following data types:
|
|
444
|
+
*
|
|
445
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
446
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
447
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
448
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
449
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
450
|
+
* - `uint32`: 32-bit unsigned integers
|
|
451
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
452
|
+
* - `uint16`: 16-bit unsigned integers
|
|
453
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
454
|
+
* - `uint8`: 8-bit unsigned integers
|
|
455
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
456
|
+
* - `generic`: generic JavaScript values
|
|
457
|
+
*
|
|
458
|
+
* @param x - input array from which to derive the output array length
|
|
459
|
+
* @param value - fill value
|
|
460
|
+
* @param dtype - data type
|
|
461
|
+
* @returns filled array
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
465
|
+
*
|
|
466
|
+
* var x = zeros( 2, 'int16' );
|
|
467
|
+
* // returns <Int16Array>[ 0, 0 ]
|
|
468
|
+
*
|
|
469
|
+
* var y = fullLike( x, 1 );
|
|
470
|
+
* // returns <Int16Array>[ 1, 1 ]
|
|
471
|
+
*/
|
|
472
|
+
declare function fullLike( x: Int16Array, value: number, dtype?: DataType ): Int16Array; // tslint:disable-line:max-line-length
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
476
|
+
*
|
|
477
|
+
* The function supports the following data types:
|
|
478
|
+
*
|
|
479
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
480
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
481
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
482
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
483
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
484
|
+
* - `uint32`: 32-bit unsigned integers
|
|
485
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
486
|
+
* - `uint16`: 16-bit unsigned integers
|
|
487
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
488
|
+
* - `uint8`: 8-bit unsigned integers
|
|
489
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
490
|
+
* - `generic`: generic JavaScript values
|
|
491
|
+
*
|
|
492
|
+
* @param x - input array from which to derive the output array length
|
|
493
|
+
* @param value - fill value
|
|
494
|
+
* @param dtype - data type
|
|
495
|
+
* @returns filled array
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
499
|
+
*
|
|
500
|
+
* var x = zeros( 2, 'int8' );
|
|
501
|
+
* // returns <Int8Array>[ 0, 0 ]
|
|
502
|
+
*
|
|
503
|
+
* var y = fullLike( x, 1 );
|
|
504
|
+
* // returns <Int8Array>[ 1, 1 ]
|
|
505
|
+
*/
|
|
506
|
+
declare function fullLike( x: Int8Array, value: number, dtype?: DataType ): Int8Array; // tslint:disable-line:max-line-length
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
510
|
+
*
|
|
511
|
+
* The function supports the following data types:
|
|
512
|
+
*
|
|
513
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
514
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
515
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
516
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
517
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
518
|
+
* - `uint32`: 32-bit unsigned integers
|
|
519
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
520
|
+
* - `uint16`: 16-bit unsigned integers
|
|
521
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
522
|
+
* - `uint8`: 8-bit unsigned integers
|
|
523
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
524
|
+
* - `generic`: generic JavaScript values
|
|
525
|
+
*
|
|
526
|
+
* @param x - input array from which to derive the output array length
|
|
527
|
+
* @param value - fill value
|
|
528
|
+
* @param dtype - data type
|
|
529
|
+
* @returns filled array
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
533
|
+
*
|
|
534
|
+
* var x = zeros( 2, 'uint32' );
|
|
535
|
+
* // returns <Uint32Array>[ 0, 0 ]
|
|
536
|
+
*
|
|
537
|
+
* var y = fullLike( x, 1 );
|
|
538
|
+
* // returns <Uint32Array>[ 1, 1 ]
|
|
539
|
+
*/
|
|
540
|
+
declare function fullLike( x: Uint32Array, value: number, dtype?: DataType ): Uint32Array; // tslint:disable-line:max-line-length
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
544
|
+
*
|
|
545
|
+
* The function supports the following data types:
|
|
546
|
+
*
|
|
547
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
548
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
549
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
550
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
551
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
552
|
+
* - `uint32`: 32-bit unsigned integers
|
|
553
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
554
|
+
* - `uint16`: 16-bit unsigned integers
|
|
555
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
556
|
+
* - `uint8`: 8-bit unsigned integers
|
|
557
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
558
|
+
* - `generic`: generic JavaScript values
|
|
559
|
+
*
|
|
560
|
+
* @param x - input array from which to derive the output array length
|
|
561
|
+
* @param value - fill value
|
|
562
|
+
* @param dtype - data type
|
|
563
|
+
* @returns filled array
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
567
|
+
*
|
|
568
|
+
* var x = zeros( 2, 'uint16' );
|
|
569
|
+
* // returns <Uint16Array>[ 0, 0 ]
|
|
570
|
+
*
|
|
571
|
+
* var y = fullLike( x, 1 );
|
|
572
|
+
* // returns <Uint16Array>[ 1, 1 ]
|
|
573
|
+
*/
|
|
574
|
+
declare function fullLike( x: Uint16Array, value: number, dtype?: DataType ): Uint16Array; // tslint:disable-line:max-line-length
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
578
|
+
*
|
|
579
|
+
* The function supports the following data types:
|
|
580
|
+
*
|
|
581
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
582
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
583
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
584
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
585
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
586
|
+
* - `uint32`: 32-bit unsigned integers
|
|
587
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
588
|
+
* - `uint16`: 16-bit unsigned integers
|
|
589
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
590
|
+
* - `uint8`: 8-bit unsigned integers
|
|
591
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
592
|
+
* - `generic`: generic JavaScript values
|
|
593
|
+
*
|
|
594
|
+
* @param x - input array from which to derive the output array length
|
|
595
|
+
* @param value - fill value
|
|
596
|
+
* @param dtype - data type
|
|
597
|
+
* @returns filled array
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
601
|
+
*
|
|
602
|
+
* var x = zeros( 2, 'uint8' );
|
|
603
|
+
* // returns <Uint8Array>[ 0, 0 ]
|
|
604
|
+
*
|
|
605
|
+
* var y = fullLike( x, 1 );
|
|
606
|
+
* // returns <Uint8Array>[ 1, 1 ]
|
|
607
|
+
*/
|
|
608
|
+
declare function fullLike( x: Uint8Array, value: number, dtype?: DataType ): Uint8Array; // tslint:disable-line:max-line-length
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
612
|
+
*
|
|
613
|
+
* The function supports the following data types:
|
|
614
|
+
*
|
|
615
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
616
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
617
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
618
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
619
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
620
|
+
* - `uint32`: 32-bit unsigned integers
|
|
621
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
622
|
+
* - `uint16`: 16-bit unsigned integers
|
|
623
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
624
|
+
* - `uint8`: 8-bit unsigned integers
|
|
625
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
626
|
+
* - `generic`: generic JavaScript values
|
|
627
|
+
*
|
|
628
|
+
* @param x - input array from which to derive the output array length
|
|
629
|
+
* @param value - fill value
|
|
630
|
+
* @param dtype - data type
|
|
631
|
+
* @returns filled array
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
635
|
+
*
|
|
636
|
+
* var x = zeros( 2, 'uint8c' );
|
|
637
|
+
* // returns <Uint8ClampedArray>[ 0, 0 ]
|
|
638
|
+
*
|
|
639
|
+
* var y = fullLike( x, 1 );
|
|
640
|
+
* // returns <Uint8ClampedArray>[ 1, 1 ]
|
|
641
|
+
*/
|
|
642
|
+
declare function fullLike( x: Uint8ClampedArray, value: number, dtype?: DataType ): Uint8ClampedArray; // tslint:disable-line:max-line-length
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
646
|
+
*
|
|
647
|
+
* The function supports the following data types:
|
|
648
|
+
*
|
|
649
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
650
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
651
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
652
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
653
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
654
|
+
* - `uint32`: 32-bit unsigned integers
|
|
655
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
656
|
+
* - `uint16`: 16-bit unsigned integers
|
|
657
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
658
|
+
* - `uint8`: 8-bit unsigned integers
|
|
659
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
660
|
+
* - `generic`: generic JavaScript values
|
|
661
|
+
*
|
|
662
|
+
* @param x - input array from which to derive the output array length
|
|
663
|
+
* @param value - fill value
|
|
664
|
+
* @param dtype - data type
|
|
665
|
+
* @returns filled array
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
669
|
+
*
|
|
670
|
+
* var x = zeros( 2, 'generic' );
|
|
671
|
+
* // returns [ 0, 0 ]
|
|
672
|
+
*
|
|
673
|
+
* var y = fullLike( x, 1.0 );
|
|
674
|
+
* // returns [ 1.0, 1.0 ]
|
|
675
|
+
*/
|
|
676
|
+
declare function fullLike( x: Array<any>, value: any, dtype?: DataType ): Array<any>; // tslint:disable-line:max-line-length
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
680
|
+
*
|
|
681
|
+
* The function supports the following data types:
|
|
682
|
+
*
|
|
683
|
+
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
684
|
+
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
685
|
+
* - `complex128`: double-precision complex floating-point numbers
|
|
686
|
+
* - `complex64`: single-precision complex floating-point numbers
|
|
687
|
+
* - `int32`: 32-bit two's complement signed integers
|
|
688
|
+
* - `uint32`: 32-bit unsigned integers
|
|
689
|
+
* - `int16`: 16-bit two's complement signed integers
|
|
690
|
+
* - `uint16`: 16-bit unsigned integers
|
|
691
|
+
* - `int8`: 8-bit two's complement signed integers
|
|
692
|
+
* - `uint8`: 8-bit unsigned integers
|
|
693
|
+
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
694
|
+
* - `generic`: generic JavaScript values
|
|
695
|
+
*
|
|
696
|
+
* @param x - input array from which to derive the output array length
|
|
697
|
+
* @param value - fill value
|
|
698
|
+
* @param dtype - data type
|
|
699
|
+
* @returns filled array
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
703
|
+
*
|
|
704
|
+
* var x = zeros( 2, 'float64' );
|
|
705
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
706
|
+
*
|
|
707
|
+
* var y = fullLike( x, 1.0 );
|
|
708
|
+
* // returns <Float64Array>[ 1.0, 1.0 ]
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* var zeros = require( `@stdlib/array/zeros` );
|
|
712
|
+
*
|
|
713
|
+
* var x = zeros( 2, 'float64' );
|
|
714
|
+
* // returns <Float64Array>[ 0.0, 0.0 ]
|
|
715
|
+
*
|
|
716
|
+
* var y = fullLike( x, 1.0, 'float32' );
|
|
717
|
+
* // returns <Float32Array>[ 1.0, 1.0 ]
|
|
718
|
+
*/
|
|
719
|
+
declare function fullLike( x: AnyArray, value: any, dtype?: DataType ): AnyArray; // tslint:disable-line:max-line-length
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
// EXPORTS //
|
|
723
|
+
|
|
724
|
+
export = fullLike;
|