@stdlib/array-complex64 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 +1360 -74
- package/SECURITY.md +5 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/docs/types/index.d.ts +1040 -66
- package/lib/main.js +1631 -188
- package/package.json +32 -53
- package/CITATION.cff +0 -30
package/docs/types/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* @license Apache-2.0
|
|
3
5
|
*
|
|
@@ -28,6 +30,225 @@ import ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
|
28
30
|
// Define a union type representing both iterable and non-iterable iterators:
|
|
29
31
|
type Iterator = Iter | IterableIterator;
|
|
30
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Callback invoked for each element in a source object.
|
|
35
|
+
*
|
|
36
|
+
* @returns transformed value
|
|
37
|
+
*/
|
|
38
|
+
type FromNullary<U> = ( this: U ) => ComplexLike | ArrayLike<number>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Callback invoked for each element in a source object.
|
|
42
|
+
*
|
|
43
|
+
* @param value - source element
|
|
44
|
+
* @returns transformed value
|
|
45
|
+
*/
|
|
46
|
+
type FromUnary<U> = ( this: U, value: ComplexLike | ArrayLike<number> | number ) => ComplexLike | ArrayLike<number>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Callback invoked for each element in a source object.
|
|
50
|
+
*
|
|
51
|
+
* @param value - source element
|
|
52
|
+
* @param index - source element index
|
|
53
|
+
* @returns transformed value
|
|
54
|
+
*/
|
|
55
|
+
type FromBinary<U> = ( this: U, value: ComplexLike | ArrayLike<number> | number, index: number ) => ComplexLike | ArrayLike<number>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Callback invoked for each element in a source object.
|
|
59
|
+
*
|
|
60
|
+
* @param value - source element
|
|
61
|
+
* @param index - source element index
|
|
62
|
+
* @returns transformed value
|
|
63
|
+
*/
|
|
64
|
+
type FromCallback<U> = FromNullary<U> | FromUnary<U> | FromBinary<U>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Checks whether an element in an array passes a test.
|
|
68
|
+
*
|
|
69
|
+
* @returns boolean indicating whether an element in an array passes a test
|
|
70
|
+
*/
|
|
71
|
+
type NullaryPredicate<U> = ( this: U ) => boolean;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Checks whether an element in an array passes a test.
|
|
75
|
+
*
|
|
76
|
+
* @param value - current array element
|
|
77
|
+
* @returns boolean indicating whether an element in an array passes a test
|
|
78
|
+
*/
|
|
79
|
+
type UnaryPredicate<U> = ( this: U, value: Complex64 ) => boolean;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Checks whether an element in an array passes a test.
|
|
83
|
+
*
|
|
84
|
+
* @param value - current array element
|
|
85
|
+
* @param index - current array element index
|
|
86
|
+
* @returns boolean indicating whether an element in an array passes a test
|
|
87
|
+
*/
|
|
88
|
+
type BinaryPredicate<U> = ( this: U, value: Complex64, index: number ) => boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Checks whether an element in an array passes a test.
|
|
92
|
+
*
|
|
93
|
+
* @param value - current array element
|
|
94
|
+
* @param index - current array element index
|
|
95
|
+
* @param arr - array on which the method was called
|
|
96
|
+
* @returns boolean indicating whether an element in an array passes a test
|
|
97
|
+
*/
|
|
98
|
+
type TernaryPredicate<U> = ( this: U, value: Complex64, index: number, arr: Complex64Array ) => boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Checks whether an element in an array passes a test.
|
|
102
|
+
*
|
|
103
|
+
* @param value - current array element
|
|
104
|
+
* @param index - current array element index
|
|
105
|
+
* @param arr - array on which the method was called
|
|
106
|
+
* @returns boolean indicating whether an element in an array passes a test
|
|
107
|
+
*/
|
|
108
|
+
type Predicate<U> = NullaryPredicate<U> | UnaryPredicate<U> | BinaryPredicate<U> | TernaryPredicate<U>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Callback invoked for each element in an array.
|
|
112
|
+
*
|
|
113
|
+
* @returns undefined
|
|
114
|
+
*/
|
|
115
|
+
type NullaryCallback<U> = ( this: U ) => void;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Callback invoked for each element in an array.
|
|
119
|
+
*
|
|
120
|
+
* @param value - current array element
|
|
121
|
+
* @returns undefined
|
|
122
|
+
*/
|
|
123
|
+
type UnaryCallback<U> = ( this: U, value: Complex64 ) => void;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Callback invoked for each element in an array.
|
|
127
|
+
*
|
|
128
|
+
* @param value - current array element
|
|
129
|
+
* @param index - current array element index
|
|
130
|
+
* @returns undefined
|
|
131
|
+
*/
|
|
132
|
+
type BinaryCallback<U> = ( this: U, value: Complex64, index: number ) => void;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Callback invoked for each element in an array.
|
|
136
|
+
*
|
|
137
|
+
* @param value - current array element
|
|
138
|
+
* @param index - current array element index
|
|
139
|
+
* @param arr - array on which the method was called
|
|
140
|
+
* @returns undefined
|
|
141
|
+
*/
|
|
142
|
+
type TernaryCallback<U> = ( this: U, value: Complex64, index: number, arr: Complex64Array ) => void;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Callback invoked for each element in an array.
|
|
146
|
+
*
|
|
147
|
+
* @param value - current array element
|
|
148
|
+
* @param index - current array element index
|
|
149
|
+
* @param arr - array on which the method was called
|
|
150
|
+
* @returns undefined
|
|
151
|
+
*/
|
|
152
|
+
type Callback<U> = NullaryCallback<U> | UnaryCallback<U> | BinaryCallback<U> | TernaryCallback<U>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Callback invoked for each element in an array.
|
|
156
|
+
*
|
|
157
|
+
* @returns transformed value
|
|
158
|
+
*/
|
|
159
|
+
type NullaryMapFcn<U> = ( this: U ) => ComplexLike | ArrayLike<number>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Callback invoked for each element in an array.
|
|
163
|
+
*
|
|
164
|
+
* @param value - current array element
|
|
165
|
+
* @returns transformed value
|
|
166
|
+
*/
|
|
167
|
+
type UnaryMapFcn<U> = ( this: U, value: Complex64 ) => ComplexLike | ArrayLike<number>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Callback invoked for each element in an array.
|
|
171
|
+
*
|
|
172
|
+
* @param value - current array element
|
|
173
|
+
* @param index - current array element index
|
|
174
|
+
* @returns transformed value
|
|
175
|
+
*/
|
|
176
|
+
type BinaryMapFcn<U> = ( this: U, value: Complex64, index: number ) => ComplexLike | ArrayLike<number>;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Callback invoked for each element in an array.
|
|
180
|
+
*
|
|
181
|
+
* @param value - current array element
|
|
182
|
+
* @param index - current array element index
|
|
183
|
+
* @param arr - array on which the method was called
|
|
184
|
+
* @returns transformed value
|
|
185
|
+
*/
|
|
186
|
+
type TernaryMapFcn<U> = ( this: U, value: Complex64, index: number, arr: Complex64Array ) => ComplexLike | ArrayLike<number>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Callback invoked for each element in an array.
|
|
190
|
+
*
|
|
191
|
+
* @param value - current array element
|
|
192
|
+
* @param index - current array element index
|
|
193
|
+
* @param arr - array on which the method was called
|
|
194
|
+
* @returns transformed value
|
|
195
|
+
*/
|
|
196
|
+
type MapFcn<U> = NullaryMapFcn<U> | UnaryMapFcn<U> | BinaryMapFcn<U> | TernaryMapFcn<U>;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Reducer function invoked for each element in an array.
|
|
200
|
+
*
|
|
201
|
+
* @returns accumulated result
|
|
202
|
+
*/
|
|
203
|
+
type NullaryReducer<U> = () => U;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Reducer function invoked for each element in an array.
|
|
207
|
+
*
|
|
208
|
+
* @param acc - accumulated result
|
|
209
|
+
* @returns accumulated result
|
|
210
|
+
*/
|
|
211
|
+
type UnaryReducer<U> = ( acc: U ) => U;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Reducer function invoked for each element in an array.
|
|
215
|
+
*
|
|
216
|
+
* @param acc - accumulated result
|
|
217
|
+
* @param value - current array element
|
|
218
|
+
* @returns accumulated result
|
|
219
|
+
*/
|
|
220
|
+
type BinaryReducer<U> = ( acc: U, value: Complex64 ) => U;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Reducer function invoked for each element in an array.
|
|
224
|
+
*
|
|
225
|
+
* @param acc - accumulated result
|
|
226
|
+
* @param value - current array element
|
|
227
|
+
* @param index - current array element index
|
|
228
|
+
* @returns accumulated result
|
|
229
|
+
*/
|
|
230
|
+
type TernaryReducer<U> = ( acc: U, value: Complex64, index: number ) => U;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @param acc - accumulated result
|
|
234
|
+
* @param value - current array element
|
|
235
|
+
* @param index - current array element index
|
|
236
|
+
* @param arr - array on which the method was called
|
|
237
|
+
* @returns accumulated result
|
|
238
|
+
*/
|
|
239
|
+
type QuaternaryReducer<U> = ( acc: U, value: Complex64, index: number, arr: Complex64Array ) => U;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Reducer function invoked for each element in an array.
|
|
243
|
+
*
|
|
244
|
+
* @param acc - accumulated result
|
|
245
|
+
* @param value - current array element
|
|
246
|
+
* @param index - current array element index
|
|
247
|
+
* @param arr - array on which the method was called
|
|
248
|
+
* @returns accumulated result
|
|
249
|
+
*/
|
|
250
|
+
type Reducer<U> = NullaryReducer<U> | UnaryReducer<U> | BinaryReducer<U> | TernaryReducer<U> | QuaternaryReducer<U>;
|
|
251
|
+
|
|
31
252
|
/**
|
|
32
253
|
* Class for creating a 64-bit complex number array.
|
|
33
254
|
*/
|
|
@@ -70,7 +291,7 @@ declare class Complex64Array implements Complex64ArrayInterface {
|
|
|
70
291
|
* // returns 1
|
|
71
292
|
*
|
|
72
293
|
* @example
|
|
73
|
-
* var ArrayBuffer = require(
|
|
294
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
74
295
|
*
|
|
75
296
|
* var buf = new ArrayBuffer( 16 );
|
|
76
297
|
* var arr = new Complex64Array( buf );
|
|
@@ -80,7 +301,7 @@ declare class Complex64Array implements Complex64ArrayInterface {
|
|
|
80
301
|
* // returns 2
|
|
81
302
|
*
|
|
82
303
|
* @example
|
|
83
|
-
* var ArrayBuffer = require(
|
|
304
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
84
305
|
*
|
|
85
306
|
* var buf = new ArrayBuffer( 16 );
|
|
86
307
|
* var arr = new Complex64Array( buf, 8 );
|
|
@@ -90,7 +311,7 @@ declare class Complex64Array implements Complex64ArrayInterface {
|
|
|
90
311
|
* // returns 1
|
|
91
312
|
*
|
|
92
313
|
* @example
|
|
93
|
-
* var ArrayBuffer = require(
|
|
314
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
94
315
|
*
|
|
95
316
|
* var buf = new ArrayBuffer( 32 );
|
|
96
317
|
* var arr = new Complex64Array( buf, 8, 2 );
|
|
@@ -99,7 +320,34 @@ declare class Complex64Array implements Complex64ArrayInterface {
|
|
|
99
320
|
* var len = arr.length;
|
|
100
321
|
* // returns 2
|
|
101
322
|
*/
|
|
102
|
-
constructor( arg?: number | RealOrComplexTypedArray | ArrayLike<number | ComplexLike> | ArrayBuffer | Iterable<number | ComplexLike>, byteOffset?: number, length?: number );
|
|
323
|
+
constructor( arg?: number | RealOrComplexTypedArray | ArrayLike<number | ComplexLike> | ArrayBuffer | Iterable<number | ComplexLike>, byteOffset?: number, length?: number );
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Returns an array element with support for both nonnegative and negative integer indices.
|
|
327
|
+
*
|
|
328
|
+
* @param i - element index
|
|
329
|
+
* @throws index argument must be a integer
|
|
330
|
+
* @returns array element
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* var arr = new Complex64Array( 10 );
|
|
334
|
+
*
|
|
335
|
+
* var z = arr.at( 0 );
|
|
336
|
+
* // returns <Complex64>
|
|
337
|
+
*
|
|
338
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
339
|
+
* arr.set( [ 9.0, -9.0 ], 9 );
|
|
340
|
+
*
|
|
341
|
+
* z = arr.get( -1 )
|
|
342
|
+
* // return <Complex64>
|
|
343
|
+
*
|
|
344
|
+
* z = arr.at( 100 );
|
|
345
|
+
* // returns undefined
|
|
346
|
+
*
|
|
347
|
+
* z = arr.at( -100 );
|
|
348
|
+
* // returns undefined
|
|
349
|
+
*/
|
|
350
|
+
at( i: number ): Complex64 | void;
|
|
103
351
|
|
|
104
352
|
/**
|
|
105
353
|
* Length (in bytes) of the array.
|
|
@@ -154,9 +402,9 @@ declare class Complex64Array implements Complex64ArrayInterface {
|
|
|
154
402
|
* @returns modified array
|
|
155
403
|
*
|
|
156
404
|
* @example
|
|
157
|
-
* var Complex64 = require(
|
|
158
|
-
* var realf = require(
|
|
159
|
-
* var imagf = require(
|
|
405
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
406
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
407
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
160
408
|
*
|
|
161
409
|
* var arr = new Complex64Array( 4 );
|
|
162
410
|
*
|
|
@@ -186,7 +434,7 @@ declare class Complex64Array implements Complex64ArrayInterface {
|
|
|
186
434
|
* @returns iterator
|
|
187
435
|
*
|
|
188
436
|
* @example
|
|
189
|
-
* var Complex64 = require(
|
|
437
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
190
438
|
*
|
|
191
439
|
* var arr = [
|
|
192
440
|
* new Complex64( 1.0, 1.0 ),
|
|
@@ -214,83 +462,809 @@ declare class Complex64Array implements Complex64ArrayInterface {
|
|
|
214
462
|
entries(): Iterator;
|
|
215
463
|
|
|
216
464
|
/**
|
|
217
|
-
*
|
|
465
|
+
* Tests whether all elements in an array pass a test implemented by a predicate function.
|
|
218
466
|
*
|
|
219
|
-
* @param
|
|
220
|
-
* @
|
|
221
|
-
* @returns
|
|
467
|
+
* @param predicate - test function
|
|
468
|
+
* @param thisArg - execution context
|
|
469
|
+
* @returns boolean indicating whether all elements pass a test
|
|
222
470
|
*
|
|
223
471
|
* @example
|
|
224
|
-
* var
|
|
472
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
473
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
225
474
|
*
|
|
226
|
-
*
|
|
475
|
+
* function predicate( v ) {
|
|
476
|
+
* return ( realf( v ) === imagf( v ) );
|
|
477
|
+
* }
|
|
478
|
+
*
|
|
479
|
+
* var arr = new Complex64Array( 3 );
|
|
480
|
+
*
|
|
481
|
+
* arr.set( [ 1.0 , 1.0 ], 0 );
|
|
482
|
+
* arr.set( [ 2.0 , 2.0 ], 1 );
|
|
483
|
+
* arr.set( [ 3.0 , 3.0 ], 2 );
|
|
484
|
+
*
|
|
485
|
+
* var bool = arr.every( predicate );
|
|
486
|
+
* // returns true
|
|
487
|
+
*/
|
|
488
|
+
every<U = unknown>( predicate: Predicate<U>, thisArg?: ThisParameterType<Predicate<U>> ): boolean;
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Returns a modified typed array filled with a fill value.
|
|
492
|
+
*
|
|
493
|
+
* @param value - fill value
|
|
494
|
+
* @param start - starting index (inclusive)
|
|
495
|
+
* @param end - ending index (exclusive)
|
|
496
|
+
* @returns modified typed array
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
500
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
501
|
+
*
|
|
502
|
+
* var arr = new Complex64Array( 3 );
|
|
503
|
+
*
|
|
504
|
+
* arr.fill( new Complex64( 1.0, 1.0 ), 1 );
|
|
505
|
+
*
|
|
506
|
+
* var z = arr.get( 1 );
|
|
227
507
|
* // returns <Complex64>
|
|
228
508
|
*
|
|
229
|
-
*
|
|
509
|
+
* var re = realf( z );
|
|
510
|
+
* // returns 1.0
|
|
230
511
|
*
|
|
231
|
-
*
|
|
232
|
-
* // returns
|
|
512
|
+
* var im = imagf( z );
|
|
513
|
+
* // returns 1.0
|
|
514
|
+
*
|
|
515
|
+
* z = arr.get( 2 );
|
|
516
|
+
* // returns <Complex64>
|
|
517
|
+
*
|
|
518
|
+
* re = realf( z );
|
|
519
|
+
* // returns 1.0
|
|
520
|
+
*
|
|
521
|
+
* im = imagf( z );
|
|
522
|
+
* // returns 1.0
|
|
233
523
|
*/
|
|
234
|
-
|
|
524
|
+
fill( value: ComplexLike, start?: number, end?: number ): Complex64Array;
|
|
235
525
|
|
|
236
526
|
/**
|
|
237
|
-
*
|
|
527
|
+
* Returns a new array containing the elements of an array which pass a test implemented by a predicate function.
|
|
238
528
|
*
|
|
239
|
-
*
|
|
529
|
+
* @param predicate - test function
|
|
530
|
+
* @param thisArg - execution context
|
|
531
|
+
* @returns new array containing elements which pass a test implemented by a predicate function
|
|
240
532
|
*
|
|
241
|
-
*
|
|
533
|
+
* @example
|
|
534
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
535
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
242
536
|
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* ```
|
|
537
|
+
* function predicate( v ) {
|
|
538
|
+
* return ( realf( v ) === imagf( v ) );
|
|
539
|
+
* }
|
|
247
540
|
*
|
|
248
|
-
*
|
|
541
|
+
* var arr = new Complex64Array( 3 );
|
|
249
542
|
*
|
|
250
|
-
*
|
|
543
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
544
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
545
|
+
* arr.set( [ 3.0, -3.0 ], 2 );
|
|
251
546
|
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* src: ---------------------
|
|
255
|
-
* ```
|
|
547
|
+
* var out = arr.filter( predicate );
|
|
548
|
+
* // returns <Complex64Array>
|
|
256
549
|
*
|
|
257
|
-
*
|
|
550
|
+
* var len = out.length;
|
|
551
|
+
* // returns 1
|
|
258
552
|
*
|
|
553
|
+
* var z = out.get( 0 );
|
|
554
|
+
* // returns <Complex64>
|
|
259
555
|
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
|
|
556
|
+
* var re = realf( z );
|
|
557
|
+
* // returns 2.0
|
|
558
|
+
*
|
|
559
|
+
* var im = imagf( z );
|
|
560
|
+
* // returns 2.0
|
|
561
|
+
*/
|
|
562
|
+
filter<U = unknown>( predicate: Predicate<U>, thisArg?: ThisParameterType<Predicate<U>> ): Complex64Array;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Returns the first element in an array for which a predicate function returns a truthy value.
|
|
566
|
+
*
|
|
567
|
+
* @param predicate - test function
|
|
568
|
+
* @param thisArg - execution context
|
|
569
|
+
* @returns array element or undefined
|
|
266
570
|
*
|
|
267
571
|
* @example
|
|
268
|
-
* var realf = require(
|
|
269
|
-
* var imagf = require(
|
|
572
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
573
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
574
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
270
575
|
*
|
|
271
|
-
*
|
|
576
|
+
* function predicate( v ) {
|
|
577
|
+
* return ( realf( v ) === imagf( v ) );
|
|
578
|
+
* }
|
|
272
579
|
*
|
|
273
|
-
* var
|
|
580
|
+
* var arr = new Complex64Array( 3 );
|
|
581
|
+
*
|
|
582
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
583
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
584
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
585
|
+
*
|
|
586
|
+
* var z = arr.find( predicate );
|
|
274
587
|
* // returns <Complex64>
|
|
275
588
|
*
|
|
276
589
|
* var re = realf( z );
|
|
277
|
-
* // returns
|
|
590
|
+
* // returns 1.0
|
|
278
591
|
*
|
|
279
592
|
* var im = imagf( z );
|
|
280
|
-
* // returns
|
|
593
|
+
* // returns 1.0
|
|
594
|
+
*/
|
|
595
|
+
find<U = unknown>( predicate: Predicate<U>, thisArg?: ThisParameterType<Predicate<U>> ): Complex64 | void;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Returns the index of the first element in an array for which a predicate function returns a truthy value.
|
|
599
|
+
*
|
|
600
|
+
* @param predicate - test function
|
|
601
|
+
* @param thisArg - execution context
|
|
602
|
+
* @returns index or -1
|
|
603
|
+
*
|
|
604
|
+
* @example
|
|
605
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
606
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
607
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
608
|
+
*
|
|
609
|
+
* function predicate( v ) {
|
|
610
|
+
* return ( realf( v ) === imagf( v ) );
|
|
611
|
+
* }
|
|
612
|
+
*
|
|
613
|
+
* var arr = new Complex64Array( 3 );
|
|
281
614
|
*
|
|
282
615
|
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
616
|
+
* arr.set( [ 2.0, -2.0 ], 1 );
|
|
617
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
283
618
|
*
|
|
284
|
-
*
|
|
619
|
+
* var idx = arr.findIndex( predicate );
|
|
620
|
+
* // returns 2
|
|
621
|
+
*/
|
|
622
|
+
findIndex<U = unknown>( predicate: Predicate<U>, thisArg?: ThisParameterType<Predicate<U>> ): number;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Returns the last element in an array for which a predicate function returns a truthy value.
|
|
626
|
+
*
|
|
627
|
+
* @param predicate - test function
|
|
628
|
+
* @param thisArg - execution context
|
|
629
|
+
* @returns array element or undefined
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
633
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
634
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
635
|
+
*
|
|
636
|
+
* function predicate( v ) {
|
|
637
|
+
* return ( realf( v ) === imagf( v ) );
|
|
638
|
+
* }
|
|
639
|
+
*
|
|
640
|
+
* var arr = new Complex64Array( 3 );
|
|
641
|
+
*
|
|
642
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
643
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
644
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
645
|
+
*
|
|
646
|
+
* var z = arr.findLast( predicate );
|
|
285
647
|
* // returns <Complex64>
|
|
286
648
|
*
|
|
287
|
-
* re = realf( z );
|
|
288
|
-
* // returns
|
|
649
|
+
* var re = realf( z );
|
|
650
|
+
* // returns 3.0
|
|
289
651
|
*
|
|
290
|
-
* im = imagf( z );
|
|
291
|
-
* // returns
|
|
652
|
+
* var im = imagf( z );
|
|
653
|
+
* // returns 3.0
|
|
654
|
+
*/
|
|
655
|
+
findLast<U = unknown>( predicate: Predicate<U>, thisArg?: ThisParameterType<Predicate<U>> ): Complex64 | void;
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Returns the index of the last element in an array for which a predicate function returns a truthy value.
|
|
659
|
+
*
|
|
660
|
+
* @param predicate - test function
|
|
661
|
+
* @param thisArg - execution context
|
|
662
|
+
* @returns index or -1
|
|
663
|
+
*
|
|
664
|
+
* @example
|
|
665
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
666
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
667
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
668
|
+
*
|
|
669
|
+
* function predicate( v ) {
|
|
670
|
+
* return ( realf( v ) === imagf( v ) );
|
|
671
|
+
* }
|
|
672
|
+
*
|
|
673
|
+
* var arr = new Complex64Array( 3 );
|
|
674
|
+
*
|
|
675
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
676
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
677
|
+
* arr.set( [ 3.0, -3.0 ], 2 );
|
|
678
|
+
*
|
|
679
|
+
* var idx = arr.findLastIndex( predicate );
|
|
680
|
+
* // returns 1
|
|
681
|
+
*/
|
|
682
|
+
findLastIndex<U = unknown>( predicate: Predicate<U>, thisArg?: ThisParameterType<Predicate<U>> ): number;
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Invokes a function once for each array element.
|
|
686
|
+
*
|
|
687
|
+
* @param fcn - function to invoke
|
|
688
|
+
* @param thisArg - execution context
|
|
689
|
+
* @returns undefined
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
693
|
+
*
|
|
694
|
+
* function log( v, i ) {
|
|
695
|
+
* console.log( '%s: %s', i, v.toString() );
|
|
696
|
+
* }
|
|
697
|
+
*
|
|
698
|
+
* var arr = new Complex64Array( 3 );
|
|
699
|
+
*
|
|
700
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
701
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
702
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
703
|
+
*
|
|
704
|
+
* arr.forEach( log );
|
|
705
|
+
* // => 0: 1 + 1i
|
|
706
|
+
* // => 1: 2 + 2i
|
|
707
|
+
* // => 2: 3 + 3i
|
|
708
|
+
*/
|
|
709
|
+
forEach<U = unknown>( fcn: Callback<U>, thisArg?: ThisParameterType<Callback<U>> ): void;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Returns an array element.
|
|
713
|
+
*
|
|
714
|
+
* @param i - element index
|
|
715
|
+
* @throws index argument must be a nonnegative integer
|
|
716
|
+
* @returns array element
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
* var arr = new Complex64Array( 10 );
|
|
720
|
+
*
|
|
721
|
+
* var z = arr.get( 0 );
|
|
722
|
+
* // returns <Complex64>
|
|
723
|
+
*
|
|
724
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
725
|
+
*
|
|
726
|
+
* z = arr.get( 100 );
|
|
727
|
+
* // returns undefined
|
|
728
|
+
*/
|
|
729
|
+
get( i: number ): Complex64 | void;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Returns a boolean indicating whether an array contains a provided value.
|
|
733
|
+
*
|
|
734
|
+
* @param searchElement - search element
|
|
735
|
+
* @param fromIndex - starting index (inclusive)
|
|
736
|
+
* @returns boolean indicating whether an array contains a provided value
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* var arr = new Complex64Array( 5 );
|
|
740
|
+
*
|
|
741
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
742
|
+
* arr.set( [ 2.0, -2.0 ], 1 );
|
|
743
|
+
* arr.set( [ 3.0, -3.0 ], 2 );
|
|
744
|
+
* arr.set( [ 4.0, -4.0 ], 3 );
|
|
745
|
+
* arr.set( [ 5.0, -5.0 ], 4 );
|
|
746
|
+
*
|
|
747
|
+
* var bool = arr.includes( new Complex64( 3.0, -3.0 ) );
|
|
748
|
+
* // returns true
|
|
749
|
+
*
|
|
750
|
+
* bool = arr.includes( new Complex64( 3.0, -3.0 ), 3 );
|
|
751
|
+
* // returns false
|
|
752
|
+
*
|
|
753
|
+
* bool = arr.includes( new Complex64( 4.0, -4.0 ), -3 );
|
|
754
|
+
* // returns true
|
|
755
|
+
*/
|
|
756
|
+
includes( searchElement: ComplexLike, fromIndex?: number ): boolean;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Returns the first index at which a given element can be found.
|
|
760
|
+
*
|
|
761
|
+
* @param searchElement - element to find
|
|
762
|
+
* @param fromIndex - starting index (inclusive)
|
|
763
|
+
* @returns index or -1
|
|
764
|
+
*
|
|
765
|
+
* @example
|
|
766
|
+
* var arr = new Complex64Array( 5 );
|
|
767
|
+
*
|
|
768
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
769
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
770
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
771
|
+
* arr.set( [ 2.0, 2.0 ], 3 );
|
|
772
|
+
* arr.set( [ 5.0, 5.0 ], 4 );
|
|
773
|
+
*
|
|
774
|
+
* var idx = arr.indexOf( new Complex64( [ 2.0, 2.0 ] ) );
|
|
775
|
+
* // returns 1
|
|
776
|
+
*
|
|
777
|
+
* idx = arr.indexOf( new Complex64( [ 2.0, 2.0 ] ), 2 );
|
|
778
|
+
* // returns 3
|
|
779
|
+
*
|
|
780
|
+
* idx = arr.indexOf( new Complex64( [ 2.0, 2.0 ] ), -3 );
|
|
781
|
+
* // returns 3
|
|
782
|
+
*/
|
|
783
|
+
indexOf( searchElement: ComplexLike, fromIndex?: number ): number;
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Returns a new string by concatenating all array elements.
|
|
787
|
+
*
|
|
788
|
+
* @param separator - value separator (default: ',')
|
|
789
|
+
* @returns string
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* var arr = new Complex64Array( 2 );
|
|
793
|
+
*
|
|
794
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
795
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
796
|
+
*
|
|
797
|
+
* var str = arr.join();
|
|
798
|
+
* // returns '1 + 1i,2 + 2i'
|
|
799
|
+
*
|
|
800
|
+
* str = arr.join( '/' );
|
|
801
|
+
* // returns '1 + 1i/2 + 2i'
|
|
802
|
+
*/
|
|
803
|
+
join( separator?: string ): string;
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Returns the last index at which a given element can be found.
|
|
807
|
+
*
|
|
808
|
+
* @param searchElement - element to find
|
|
809
|
+
* @param fromIndex - index at which to start searching backward (inclusive)
|
|
810
|
+
* @returns index or -1
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
814
|
+
*
|
|
815
|
+
* var arr = new Complex64Array( 5 );
|
|
816
|
+
*
|
|
817
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
818
|
+
* arr.set( [ 2.0, -2.0 ], 1 );
|
|
819
|
+
* arr.set( [ 3.0, -3.0 ], 2 );
|
|
820
|
+
* arr.set( [ 4.0, -4.0 ], 3 );
|
|
821
|
+
* arr.set( [ 3.0, -3.0 ], 4 );
|
|
822
|
+
*
|
|
823
|
+
* var idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ) );
|
|
824
|
+
* // returns 4
|
|
825
|
+
*
|
|
826
|
+
* idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ), 3 );
|
|
827
|
+
* // returns 2
|
|
828
|
+
*
|
|
829
|
+
* idx = arr.lastIndexOf( new Complex64( 2.0, -2.0 ), -3 );
|
|
830
|
+
* // returns 1
|
|
831
|
+
*/
|
|
832
|
+
lastIndexOf( searchElement: ComplexLike, fromIndex?: number ): number;
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Returns a new array with each element being the result of a provided callback function.
|
|
836
|
+
*
|
|
837
|
+
* @param fcn - callback function
|
|
838
|
+
* @param thisArg - execution context
|
|
839
|
+
* @returns new array containing transformed elements
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
843
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
844
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
845
|
+
*
|
|
846
|
+
* function scale( v, i ) {
|
|
847
|
+
* return new Complex64( 2.0*realf( v ), 2.0*imagf( v ) );
|
|
848
|
+
* }
|
|
849
|
+
*
|
|
850
|
+
* var arr = new Complex64Array( 3 );
|
|
851
|
+
*
|
|
852
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
853
|
+
* arr.set( [ 2.0, -2.0 ], 1 );
|
|
854
|
+
* arr.set( [ 3.0, -3.0 ], 2 );
|
|
855
|
+
*
|
|
856
|
+
* var out = arr.map( scale );
|
|
857
|
+
* // returns <Complex64Array>
|
|
858
|
+
*
|
|
859
|
+
* var z = out.get( 0 );
|
|
860
|
+
* // returns <Complex64>
|
|
861
|
+
*
|
|
862
|
+
* var re = realf( z );
|
|
863
|
+
* // returns 2.0
|
|
864
|
+
*
|
|
865
|
+
* var im = imagf( z );
|
|
866
|
+
* // returns -2.0
|
|
867
|
+
*/
|
|
868
|
+
map<U = unknown>( fcn: MapFcn<U>, thisArg?: ThisParameterType<MapFcn<U>> ): Complex64Array;
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.
|
|
872
|
+
*
|
|
873
|
+
* @param reducer - callback function
|
|
874
|
+
* @param initialValue - initial value
|
|
875
|
+
* @returns accumulated result
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
879
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
880
|
+
* var caddf = require( '@stdlib/math-base-ops-caddf' );
|
|
881
|
+
*
|
|
882
|
+
* var arr = new Complex64Array( 3 );
|
|
883
|
+
*
|
|
884
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
885
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
886
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
887
|
+
*
|
|
888
|
+
* var z = arr.reduce( caddf );
|
|
889
|
+
* // returns <Complex64>
|
|
890
|
+
*
|
|
891
|
+
* var re = realf( z );
|
|
892
|
+
* // returns 6.0
|
|
893
|
+
*
|
|
894
|
+
* var im = imagf( z );
|
|
895
|
+
* // returns 6.0
|
|
896
|
+
*/
|
|
897
|
+
reduce<U = unknown>( reducer: Reducer<U>, initialValue?: U ): U;
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Reverses an array in-place.
|
|
901
|
+
*
|
|
902
|
+
* @returns reversed array
|
|
903
|
+
*
|
|
904
|
+
* @example
|
|
905
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
906
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
907
|
+
*
|
|
908
|
+
* var arr = new Complex64Array( 3 );
|
|
909
|
+
*
|
|
910
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
911
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
912
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
913
|
+
*
|
|
914
|
+
* var out = arr.reverse();
|
|
915
|
+
* // returns <Complex64Array>
|
|
916
|
+
*
|
|
917
|
+
* var z = out.get( 0 );
|
|
918
|
+
* // returns <Complex64>
|
|
919
|
+
*
|
|
920
|
+
* var re = realf( z );
|
|
921
|
+
* // returns 3.0
|
|
922
|
+
*
|
|
923
|
+
* var im = imagf( z );
|
|
924
|
+
* // returns 3.0
|
|
925
|
+
*
|
|
926
|
+
* z = out.get( 1 );
|
|
927
|
+
* // returns <Complex64>
|
|
928
|
+
*
|
|
929
|
+
* re = realf( z );
|
|
930
|
+
* // returns 2.0
|
|
931
|
+
*
|
|
932
|
+
* im = imagf( z );
|
|
933
|
+
* // returns 2.0
|
|
934
|
+
*
|
|
935
|
+
* z = out.get( 2 );
|
|
936
|
+
* // returns <Complex64>
|
|
937
|
+
*
|
|
938
|
+
* re = realf( z );
|
|
939
|
+
* // returns 1.0
|
|
940
|
+
*
|
|
941
|
+
* im = imagf( z );
|
|
942
|
+
* // returns 1.0
|
|
943
|
+
*/
|
|
944
|
+
reverse(): Complex64Array;
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Sets an array element.
|
|
948
|
+
*
|
|
949
|
+
* ## Notes
|
|
950
|
+
*
|
|
951
|
+
* - When provided a typed array, real or complex, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:
|
|
952
|
+
*
|
|
953
|
+
* ```text
|
|
954
|
+
* buf: ---------------------
|
|
955
|
+
* src: ---------------------
|
|
956
|
+
* ```
|
|
957
|
+
*
|
|
958
|
+
* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.
|
|
959
|
+
*
|
|
960
|
+
* In the other overlapping scenario,
|
|
961
|
+
*
|
|
962
|
+
* ```text
|
|
963
|
+
* buf: ---------------------
|
|
964
|
+
* src: ---------------------
|
|
965
|
+
* ```
|
|
966
|
+
*
|
|
967
|
+
* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values as intended.
|
|
968
|
+
*
|
|
969
|
+
*
|
|
970
|
+
* @param value - value(s)
|
|
971
|
+
* @param i - element index at which to start writing values (default: 0)
|
|
972
|
+
* @throws index argument must be a nonnegative integer
|
|
973
|
+
* @throws array-like objects must have a length which is a multiple of two
|
|
974
|
+
* @throws index argument is out-of-bounds
|
|
975
|
+
* @throws target array lacks sufficient storage to accommodate source values
|
|
976
|
+
*
|
|
977
|
+
* @example
|
|
978
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
979
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
980
|
+
*
|
|
981
|
+
* var arr = new Complex64Array( 10 );
|
|
982
|
+
*
|
|
983
|
+
* var z = arr.get( 0 );
|
|
984
|
+
* // returns <Complex64>
|
|
985
|
+
*
|
|
986
|
+
* var re = realf( z );
|
|
987
|
+
* // returns 0.0
|
|
988
|
+
*
|
|
989
|
+
* var im = imagf( z );
|
|
990
|
+
* // returns 0.0
|
|
991
|
+
*
|
|
992
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
993
|
+
*
|
|
994
|
+
* z = arr.get( 0 );
|
|
995
|
+
* // returns <Complex64>
|
|
996
|
+
*
|
|
997
|
+
* re = realf( z );
|
|
998
|
+
* // returns 1.0
|
|
999
|
+
*
|
|
1000
|
+
* im = imagf( z );
|
|
1001
|
+
* // returns -1.0
|
|
1002
|
+
*/
|
|
1003
|
+
set( value: ArrayLike<number | ComplexLike> | RealOrComplexTypedArray | ComplexLike, i?: number ): void;
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Copies a portion of a typed array to a new typed array.
|
|
1007
|
+
*
|
|
1008
|
+
* @param start - starting index (inclusive)
|
|
1009
|
+
* @param end - ending index (exclusive)
|
|
1010
|
+
* @throws indices must be integers
|
|
1011
|
+
* @returns output array
|
|
1012
|
+
*
|
|
1013
|
+
* @example
|
|
1014
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
1015
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
1016
|
+
*
|
|
1017
|
+
* var arr = new Complex64Array( 5 );
|
|
1018
|
+
*
|
|
1019
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
1020
|
+
* arr.set( [ 2.0, -2.0 ], 1 );
|
|
1021
|
+
* arr.set( [ 3.0, -3.0 ], 2 );
|
|
1022
|
+
* arr.set( [ 4.0, -4.0 ], 3 );
|
|
1023
|
+
* arr.set( [ 5.0, -5.0 ], 4 );
|
|
1024
|
+
*
|
|
1025
|
+
* var out = arr.slice();
|
|
1026
|
+
* // returns <Complex64Array>
|
|
1027
|
+
*
|
|
1028
|
+
* var len = out.length;
|
|
1029
|
+
* // returns 5
|
|
1030
|
+
*
|
|
1031
|
+
* var z = out.get( 0 );
|
|
1032
|
+
* // returns <Complex64>
|
|
1033
|
+
*
|
|
1034
|
+
* var re = realf( z );
|
|
1035
|
+
* // returns 1.0
|
|
1036
|
+
*
|
|
1037
|
+
* var im = imagf( z );
|
|
1038
|
+
* // returns -1.0
|
|
1039
|
+
*
|
|
1040
|
+
* z = out.get( len-1 );
|
|
1041
|
+
* // returns <Complex64>
|
|
1042
|
+
*
|
|
1043
|
+
* re = realf( z );
|
|
1044
|
+
* // returns 5.0
|
|
1045
|
+
*
|
|
1046
|
+
* im = imagf( z );
|
|
1047
|
+
* // returns -5.0
|
|
1048
|
+
*
|
|
1049
|
+
* out = arr.slice( 1, -2 );
|
|
1050
|
+
* // returns <Complex64Array>
|
|
1051
|
+
*
|
|
1052
|
+
* len = out.length;
|
|
1053
|
+
* // returns 2
|
|
1054
|
+
*
|
|
1055
|
+
* z = out.get( 0 );
|
|
1056
|
+
* // returns <Complex64>
|
|
1057
|
+
*
|
|
1058
|
+
* re = realf( z );
|
|
1059
|
+
* // returns 2.0
|
|
1060
|
+
*
|
|
1061
|
+
* im = imagf( z );
|
|
1062
|
+
* // returns -2.0
|
|
1063
|
+
*
|
|
1064
|
+
* z = out.get( len-1 );
|
|
1065
|
+
* // returns <Complex64>
|
|
1066
|
+
*
|
|
1067
|
+
* re = realf( z );
|
|
1068
|
+
* // returns 3.0
|
|
1069
|
+
*
|
|
1070
|
+
* im = imagf( z );
|
|
1071
|
+
* // returns -3.0
|
|
1072
|
+
*/
|
|
1073
|
+
slice( start?: number, end?: number ): Complex64Array;
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Tests whether at least one element in an array passes a test implemented by a predicate function.
|
|
1077
|
+
*
|
|
1078
|
+
* @param predicate - test function
|
|
1079
|
+
* @param thisArg - execution context
|
|
1080
|
+
* @returns boolean indicating whether at least one element passes a test
|
|
1081
|
+
*
|
|
1082
|
+
* @example
|
|
1083
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
1084
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
1085
|
+
*
|
|
1086
|
+
* function predicate( v ) {
|
|
1087
|
+
* return ( realf( v ) === imagf( v ) );
|
|
1088
|
+
* }
|
|
1089
|
+
*
|
|
1090
|
+
* var arr = new Complex64Array( 3 );
|
|
1091
|
+
*
|
|
1092
|
+
* arr.set( [ 1.0 , -1.0 ], 0 );
|
|
1093
|
+
* arr.set( [ 2.0 , 2.0 ], 1 );
|
|
1094
|
+
* arr.set( [ 3.0 , -3.0 ], 2 );
|
|
1095
|
+
*
|
|
1096
|
+
* var bool = arr.some( predicate );
|
|
1097
|
+
* // returns true
|
|
1098
|
+
*/
|
|
1099
|
+
some<U = unknown>( predicate: Predicate<U>, thisArg?: ThisParameterType<Predicate<U>> ): boolean;
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array.
|
|
1103
|
+
*
|
|
1104
|
+
* @param begin - starting index (inclusive)
|
|
1105
|
+
* @param end - ending index (exclusive)
|
|
1106
|
+
* @throws indices must be integers
|
|
1107
|
+
* @returns subarray
|
|
1108
|
+
*
|
|
1109
|
+
* @example
|
|
1110
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
1111
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
1112
|
+
*
|
|
1113
|
+
* var arr = new Complex64Array( 5 );
|
|
1114
|
+
*
|
|
1115
|
+
* arr.set( [ 1.0, -1.0 ], 0 );
|
|
1116
|
+
* arr.set( [ 2.0, -2.0 ], 1 );
|
|
1117
|
+
* arr.set( [ 3.0, -3.0 ], 2 );
|
|
1118
|
+
* arr.set( [ 4.0, -4.0 ], 3 );
|
|
1119
|
+
* arr.set( [ 5.0, -5.0 ], 4 );
|
|
1120
|
+
*
|
|
1121
|
+
* var subarr = arr.subarray();
|
|
1122
|
+
* // returns <Complex64Array>
|
|
1123
|
+
*
|
|
1124
|
+
* var len = subarr.length;
|
|
1125
|
+
* // returns 5
|
|
1126
|
+
*
|
|
1127
|
+
* var z = subarr.get( 0 );
|
|
1128
|
+
* // returns <Complex64>
|
|
1129
|
+
*
|
|
1130
|
+
* var re = realf( z );
|
|
1131
|
+
* // returns 1.0
|
|
1132
|
+
*
|
|
1133
|
+
* var im = imagf( z );
|
|
1134
|
+
* // returns -1.0
|
|
1135
|
+
*
|
|
1136
|
+
* z = subarr.get( len-1 );
|
|
1137
|
+
* // returns <Complex64>
|
|
1138
|
+
*
|
|
1139
|
+
* re = realf( z );
|
|
1140
|
+
* // returns 5.0
|
|
1141
|
+
*
|
|
1142
|
+
* im = imagf( z );
|
|
1143
|
+
* // returns -5.0
|
|
1144
|
+
*
|
|
1145
|
+
* subarr = arr.subarray( 1, -2 );
|
|
1146
|
+
* // returns <Complex64Array>
|
|
1147
|
+
*
|
|
1148
|
+
* len = subarr.length;
|
|
1149
|
+
* // returns 2
|
|
1150
|
+
*
|
|
1151
|
+
* z = subarr.get( 0 );
|
|
1152
|
+
* // returns <Complex64>
|
|
1153
|
+
*
|
|
1154
|
+
* re = realf( z );
|
|
1155
|
+
* // returns 2.0
|
|
1156
|
+
*
|
|
1157
|
+
* im = imagf( z );
|
|
1158
|
+
* // returns -2.0
|
|
1159
|
+
*
|
|
1160
|
+
* z = subarr.get( len-1 );
|
|
1161
|
+
* // returns <Complex64>
|
|
1162
|
+
*
|
|
1163
|
+
* re = realf( z );
|
|
1164
|
+
* // returns 3.0
|
|
1165
|
+
*
|
|
1166
|
+
* im = imagf( z );
|
|
1167
|
+
* // returns -3.0
|
|
1168
|
+
*/
|
|
1169
|
+
subarray( begin?: number, end?: number ): Complex64Array;
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* Returns a new typed array containing the elements in reversed order.
|
|
1173
|
+
*
|
|
1174
|
+
* @returns reversed array
|
|
1175
|
+
*
|
|
1176
|
+
* @example
|
|
1177
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
1178
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
1179
|
+
*
|
|
1180
|
+
* var arr = new Complex64Array( 3 );
|
|
1181
|
+
*
|
|
1182
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
1183
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
1184
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
1185
|
+
*
|
|
1186
|
+
* var out = arr.toReversed();
|
|
1187
|
+
* // returns <Complex64Array>
|
|
1188
|
+
*
|
|
1189
|
+
* var z = out.get( 0 );
|
|
1190
|
+
* // returns <Complex64>
|
|
1191
|
+
*
|
|
1192
|
+
* var re = realf( z );
|
|
1193
|
+
* // returns 3.0
|
|
1194
|
+
*
|
|
1195
|
+
* var im = imagf( z );
|
|
1196
|
+
* // returns 3.0
|
|
1197
|
+
*
|
|
1198
|
+
* z = out.get( 1 );
|
|
1199
|
+
* // returns <Complex64>
|
|
1200
|
+
*
|
|
1201
|
+
* re = realf( z );
|
|
1202
|
+
* // returns 2.0
|
|
1203
|
+
*
|
|
1204
|
+
* im = imagf( z );
|
|
1205
|
+
* // returns 2.0
|
|
1206
|
+
*
|
|
1207
|
+
* z = out.get( 2 );
|
|
1208
|
+
* // returns <Complex64>
|
|
1209
|
+
*
|
|
1210
|
+
* re = realf( z );
|
|
1211
|
+
* // returns 1.0
|
|
1212
|
+
*
|
|
1213
|
+
* im = imagf( z );
|
|
1214
|
+
* // returns 1.0
|
|
1215
|
+
*/
|
|
1216
|
+
toReversed(): Complex64Array;
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Serializes an array as a string.
|
|
1220
|
+
*
|
|
1221
|
+
* @returns string
|
|
1222
|
+
*
|
|
1223
|
+
* @example
|
|
1224
|
+
* var arr = new Complex64Array( 2 );
|
|
1225
|
+
*
|
|
1226
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
1227
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
1228
|
+
*
|
|
1229
|
+
* var str = arr.toString();
|
|
1230
|
+
* // returns '1 + 1i,2 + 2i'
|
|
1231
|
+
*/
|
|
1232
|
+
toString(): string;
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Returns a new typed array with the element at a provided index replaced with a provided value.
|
|
1236
|
+
*
|
|
1237
|
+
* @param index - element index
|
|
1238
|
+
* @param value - new value
|
|
1239
|
+
* @throws first argument must be an integer
|
|
1240
|
+
* @throws second argument must be a complex number
|
|
1241
|
+
* @throws index argument is out-of-bounds
|
|
1242
|
+
* @returns modified typed array
|
|
1243
|
+
*
|
|
1244
|
+
* @example
|
|
1245
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
1246
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
1247
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
1248
|
+
*
|
|
1249
|
+
* var arr = new Complex64Array( 3 );
|
|
1250
|
+
*
|
|
1251
|
+
* arr.set( [ 1.0, 1.0 ], 0 );
|
|
1252
|
+
* arr.set( [ 2.0, 2.0 ], 1 );
|
|
1253
|
+
* arr.set( [ 3.0, 3.0 ], 2 );
|
|
1254
|
+
*
|
|
1255
|
+
* var out = arr.with( 0, new Complex64( 4.0, 4.0 ) );
|
|
1256
|
+
* // returns <Complex64Array>
|
|
1257
|
+
*
|
|
1258
|
+
* var z = out.get( 0 );
|
|
1259
|
+
* // returns <Complex64>
|
|
1260
|
+
*
|
|
1261
|
+
* var re = realf( z );
|
|
1262
|
+
* // returns 4.0
|
|
1263
|
+
*
|
|
1264
|
+
* var im = imagf( z );
|
|
1265
|
+
* // returns 4.0
|
|
292
1266
|
*/
|
|
293
|
-
|
|
1267
|
+
with( index: number, value: ComplexLike ): Complex64Array;
|
|
294
1268
|
}
|
|
295
1269
|
|
|
296
1270
|
/**
|
|
@@ -335,7 +1309,7 @@ interface Complex64ArrayConstructor {
|
|
|
335
1309
|
* // returns 1
|
|
336
1310
|
*
|
|
337
1311
|
* @example
|
|
338
|
-
* var ArrayBuffer = require(
|
|
1312
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
339
1313
|
*
|
|
340
1314
|
* var buf = new ArrayBuffer( 16 );
|
|
341
1315
|
* var arr = new Complex64Array( buf );
|
|
@@ -345,7 +1319,7 @@ interface Complex64ArrayConstructor {
|
|
|
345
1319
|
* // returns 2
|
|
346
1320
|
*
|
|
347
1321
|
* @example
|
|
348
|
-
* var ArrayBuffer = require(
|
|
1322
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
349
1323
|
*
|
|
350
1324
|
* var buf = new ArrayBuffer( 16 );
|
|
351
1325
|
* var arr = new Complex64Array( buf, 8 );
|
|
@@ -355,7 +1329,7 @@ interface Complex64ArrayConstructor {
|
|
|
355
1329
|
* // returns 1
|
|
356
1330
|
*
|
|
357
1331
|
* @example
|
|
358
|
-
* var ArrayBuffer = require(
|
|
1332
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
359
1333
|
*
|
|
360
1334
|
* var buf = new ArrayBuffer( 32 );
|
|
361
1335
|
* var arr = new Complex64Array( buf, 8, 2 );
|
|
@@ -364,7 +1338,7 @@ interface Complex64ArrayConstructor {
|
|
|
364
1338
|
* var len = arr.length;
|
|
365
1339
|
* // returns 2
|
|
366
1340
|
*/
|
|
367
|
-
new( arg?: number | RealOrComplexTypedArray | ArrayLike<number | ComplexLike> | ArrayBuffer | Iterable<number | ComplexLike>, byteOffset?: number, length?: number ): Complex64Array;
|
|
1341
|
+
new( arg?: number | RealOrComplexTypedArray | ArrayLike<number | ComplexLike> | ArrayBuffer | Iterable<number | ComplexLike>, byteOffset?: number, length?: number ): Complex64Array;
|
|
368
1342
|
|
|
369
1343
|
/**
|
|
370
1344
|
* 64-bit complex number array constructor.
|
|
@@ -404,7 +1378,7 @@ interface Complex64ArrayConstructor {
|
|
|
404
1378
|
* // returns 1
|
|
405
1379
|
*
|
|
406
1380
|
* @example
|
|
407
|
-
* var ArrayBuffer = require(
|
|
1381
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
408
1382
|
*
|
|
409
1383
|
* var buf = new ArrayBuffer( 16 );
|
|
410
1384
|
* var arr = new Complex64Array( buf );
|
|
@@ -414,7 +1388,7 @@ interface Complex64ArrayConstructor {
|
|
|
414
1388
|
* // returns 2
|
|
415
1389
|
*
|
|
416
1390
|
* @example
|
|
417
|
-
* var ArrayBuffer = require(
|
|
1391
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
418
1392
|
*
|
|
419
1393
|
* var buf = new ArrayBuffer( 16 );
|
|
420
1394
|
* var arr = new Complex64Array( buf, 8 );
|
|
@@ -424,7 +1398,7 @@ interface Complex64ArrayConstructor {
|
|
|
424
1398
|
* // returns 1
|
|
425
1399
|
*
|
|
426
1400
|
* @example
|
|
427
|
-
* var ArrayBuffer = require(
|
|
1401
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
428
1402
|
*
|
|
429
1403
|
* var buf = new ArrayBuffer( 32 );
|
|
430
1404
|
* var arr = new Complex64Array( buf, 8, 2 );
|
|
@@ -433,7 +1407,7 @@ interface Complex64ArrayConstructor {
|
|
|
433
1407
|
* var len = arr.length;
|
|
434
1408
|
* // returns 2
|
|
435
1409
|
*/
|
|
436
|
-
( arg?: number | RealOrComplexTypedArray | ArrayLike<number | ComplexLike> | ArrayBuffer | Iterable<number | ComplexLike>, byteOffset?: number, length?: number ): Complex64Array;
|
|
1410
|
+
( arg?: number | RealOrComplexTypedArray | ArrayLike<number | ComplexLike> | ArrayBuffer | Iterable<number | ComplexLike>, byteOffset?: number, length?: number ): Complex64Array;
|
|
437
1411
|
|
|
438
1412
|
/**
|
|
439
1413
|
* Constructor name.
|
|
@@ -472,7 +1446,7 @@ interface Complex64ArrayConstructor {
|
|
|
472
1446
|
* // returns 1
|
|
473
1447
|
*
|
|
474
1448
|
* @example
|
|
475
|
-
* var Complex64 = require(
|
|
1449
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
476
1450
|
*
|
|
477
1451
|
* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ] );
|
|
478
1452
|
* // returns <Complex64Array>
|
|
@@ -481,9 +1455,9 @@ interface Complex64ArrayConstructor {
|
|
|
481
1455
|
* // returns 1
|
|
482
1456
|
*
|
|
483
1457
|
* @example
|
|
484
|
-
* var Complex64 = require(
|
|
485
|
-
* var realf = require(
|
|
486
|
-
* var imagf = require(
|
|
1458
|
+
* var Complex64 = require( '@stdlib/complex-float32' );
|
|
1459
|
+
* var realf = require( '@stdlib/complex-realf' );
|
|
1460
|
+
* var imagf = require( '@stdlib/complex-imagf' );
|
|
487
1461
|
*
|
|
488
1462
|
* function clbk( v ) {
|
|
489
1463
|
* return new Complex64( realf(v)*2.0, imagf(v)*2.0 );
|
|
@@ -495,7 +1469,7 @@ interface Complex64ArrayConstructor {
|
|
|
495
1469
|
* var len = arr.length;
|
|
496
1470
|
* // returns 1
|
|
497
1471
|
*/
|
|
498
|
-
from( src: ArrayLike<number | ComplexLike> | RealOrComplexTypedArray | Iterable<number | ComplexLike>, clbk?:
|
|
1472
|
+
from( src: ArrayLike<number | ComplexLike> | RealOrComplexTypedArray | Iterable<number | ComplexLike>, clbk?: FromCallback<U>, thisArg?: ThisParameterType<FromCallback<U>> ): Complex64Array;
|
|
499
1473
|
|
|
500
1474
|
/**
|
|
501
1475
|
* Creates a new 64-bit complex number array from a variable number of arguments.
|
|
@@ -551,7 +1525,7 @@ interface Complex64ArrayConstructor {
|
|
|
551
1525
|
* // returns 1
|
|
552
1526
|
*
|
|
553
1527
|
* @example
|
|
554
|
-
* var ArrayBuffer = require(
|
|
1528
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
555
1529
|
*
|
|
556
1530
|
* var buf = new ArrayBuffer( 16 );
|
|
557
1531
|
* var arr = new Complex64Array( buf );
|
|
@@ -561,7 +1535,7 @@ interface Complex64ArrayConstructor {
|
|
|
561
1535
|
* // returns 2
|
|
562
1536
|
*
|
|
563
1537
|
* @example
|
|
564
|
-
* var ArrayBuffer = require(
|
|
1538
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
565
1539
|
*
|
|
566
1540
|
* var buf = new ArrayBuffer( 16 );
|
|
567
1541
|
* var arr = new Complex64Array( buf, 8 );
|
|
@@ -571,7 +1545,7 @@ interface Complex64ArrayConstructor {
|
|
|
571
1545
|
* // returns 1
|
|
572
1546
|
*
|
|
573
1547
|
* @example
|
|
574
|
-
* var ArrayBuffer = require(
|
|
1548
|
+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
|
|
575
1549
|
*
|
|
576
1550
|
* var buf = new ArrayBuffer( 32 );
|
|
577
1551
|
* var arr = new Complex64Array( buf, 8, 2 );
|