@stdlib/array-complex64 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,9 +18,20 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # Complex64Array
22
33
 
23
- [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
24
35
 
25
36
  > 64-bit complex number array.
26
37
 
@@ -75,9 +86,24 @@ var len = arr.length;
75
86
  // returns 10
76
87
  ```
77
88
 
89
+ #### Complex64Array( complexarray )
90
+
91
+ Creates a 64-bit complex number array from another complex number array.
92
+
93
+ ```javascript
94
+ var arr1 = new Complex64Array( [ 1.0, -1.0, 2.0, -2.0 ] ); // [ re, im, re, im ]
95
+ // returns <Complex64Array>
96
+
97
+ var arr2 = new Complex64Array( arr1 );
98
+ // returns <Complex64Array>
99
+
100
+ var len = arr2.length;
101
+ // returns 2
102
+ ```
103
+
78
104
  #### Complex64Array( typedarray )
79
105
 
80
- Creates a 64-bit complex number array from a [typed array][@stdlib/array/typed] containing interleaves real and imaginary components.
106
+ Creates a 64-bit complex number array from a [typed array][@stdlib/array/typed] containing interleaved real and imaginary components.
81
107
 
82
108
  ```javascript
83
109
  var Float32Array = require( '@stdlib/array-float32' );
@@ -94,7 +120,7 @@ var len = arr.length;
94
120
 
95
121
  #### Complex64Array( obj )
96
122
 
97
- Creates a 64-bit complex number array from an array-like `object` or iterable.
123
+ Creates a 64-bit complex number array from an array-like object or iterable.
98
124
 
99
125
  ```javascript
100
126
  var Complex64 = require( '@stdlib/complex-float32' );
@@ -254,7 +280,7 @@ var len = arr.length;
254
280
 
255
281
  #### Complex64Array.from( src\[, clbk\[, thisArg]] )
256
282
 
257
- Creates a new 64-bit complex number array from an array-like `object` or an iterable.
283
+ Creates a new 64-bit complex number array from an array-like object or an iterable.
258
284
 
259
285
  ```javascript
260
286
  var Complex64 = require( '@stdlib/complex-float32' );
@@ -274,13 +300,13 @@ len = arr.length;
274
300
  // returns 1
275
301
  ```
276
302
 
277
- The iterator returned by an iterable must return either a complex number or an array-like `object` containing a real and imaginary component.
303
+ The iterator returned by an iterable must return either a complex number or an array-like object containing a real and imaginary component.
278
304
 
279
305
  ```javascript
280
306
  var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' );
281
307
  var Float32Array = require( '@stdlib/array-float32' );
282
- var real = require( '@stdlib/complex-real' );
283
- var imag = require( '@stdlib/complex-imag' );
308
+ var realf = require( '@stdlib/complex-realf' );
309
+ var imagf = require( '@stdlib/complex-imagf' );
284
310
 
285
311
  var iter;
286
312
  var arr;
@@ -330,23 +356,23 @@ if ( ITERATOR_SYMBOL === null ) {
330
356
  z = arr.get( 0 );
331
357
  // returns <Complex64>
332
358
 
333
- re = real( z );
359
+ re = realf( z );
334
360
  // returns 1.0
335
361
 
336
- im = imag( z );
362
+ im = imagf( z );
337
363
  // returns -1.0
338
364
  }
339
365
  ```
340
366
 
341
- To invoke a function for each `src` value, provide a callback function. If `src` is an iterable or an array-like `object` containing complex numbers, the callback must return either a complex number
367
+ To invoke a function for each `src` value, provide a callback function. If `src` is an iterable or an array-like object containing complex numbers, the callback must return either a complex number
342
368
 
343
369
  ```javascript
344
370
  var Complex64 = require( '@stdlib/complex-float32' );
345
- var real = require( '@stdlib/complex-real' );
346
- var imag = require( '@stdlib/complex-imag' );
371
+ var realf = require( '@stdlib/complex-realf' );
372
+ var imagf = require( '@stdlib/complex-imagf' );
347
373
 
348
374
  function map( z ) {
349
- return new Complex64( real(z)*2.0, imag(z)*2.0 );
375
+ return new Complex64( realf(z)*2.0, imagf(z)*2.0 );
350
376
  }
351
377
 
352
378
  // Create a source array:
@@ -362,20 +388,20 @@ var len = arr.length;
362
388
  var z = arr.get( 0 );
363
389
  // returns <Complex64>
364
390
 
365
- var re = real( z );
391
+ var re = realf( z );
366
392
  // returns 2.0
367
393
 
368
- var im = imag( z );
394
+ var im = imagf( z );
369
395
  // returns -2.0
370
396
  ```
371
397
 
372
- or an array-like `object` containing real and imaginary components
398
+ or an array-like object containing real and imaginary components
373
399
 
374
400
  ```javascript
375
401
  var Float32Array = require( '@stdlib/array-float32' );
376
402
  var Complex64 = require( '@stdlib/complex-float32' );
377
- var real = require( '@stdlib/complex-real' );
378
- var imag = require( '@stdlib/complex-imag' );
403
+ var realf = require( '@stdlib/complex-realf' );
404
+ var imagf = require( '@stdlib/complex-imagf' );
379
405
 
380
406
  // Return a callback which reuses allocated memory...
381
407
  function mapFcn() {
@@ -383,8 +409,8 @@ function mapFcn() {
383
409
  return map;
384
410
 
385
411
  function map( z ) {
386
- buf[ 0 ] = real( z ) * 2.0;
387
- buf[ 1 ] = imag( z ) * 2.0;
412
+ buf[ 0 ] = realf( z ) * 2.0;
413
+ buf[ 1 ] = imagf( z ) * 2.0;
388
414
  return buf;
389
415
  }
390
416
  }
@@ -402,29 +428,29 @@ var len = arr.length;
402
428
  var z = arr.get( 0 );
403
429
  // returns <Complex64>
404
430
 
405
- var re = real( z );
431
+ var re = realf( z );
406
432
  // returns 2.0
407
433
 
408
- var im = imag( z );
434
+ var im = imagf( z );
409
435
  // returns -2.0
410
436
 
411
437
  z = arr.get( 1 );
412
438
  // returns <Complex64>
413
439
 
414
- re = real( z );
440
+ re = realf( z );
415
441
  // returns 4.0
416
442
 
417
- im = imag( z );
443
+ im = imagf( z );
418
444
  // returns -4.0
419
445
  ```
420
446
 
421
- If `src` is an array-like `object` containing interleaved real and imaginary components, the callback is invoked for each component and should return the transformed component value.
447
+ If `src` is an array-like object containing interleaved real and imaginary components, the callback is invoked for each component and should return the transformed component value.
422
448
 
423
449
  ```javascript
424
450
  var Float32Array = require( '@stdlib/array-float32' );
425
451
  var Complex64 = require( '@stdlib/complex-float32' );
426
- var real = require( '@stdlib/complex-real' );
427
- var imag = require( '@stdlib/complex-imag' );
452
+ var realf = require( '@stdlib/complex-realf' );
453
+ var imagf = require( '@stdlib/complex-imagf' );
428
454
 
429
455
  function map( v ) {
430
456
  return v * 2.0;
@@ -443,28 +469,28 @@ var len = arr.length;
443
469
  var z = arr.get( 0 );
444
470
  // returns <Complex64>
445
471
 
446
- var re = real( z );
472
+ var re = realf( z );
447
473
  // returns 2.0
448
474
 
449
- var im = imag( z );
475
+ var im = imagf( z );
450
476
  // returns -2.0
451
477
  ```
452
478
 
453
479
  A callback function is provided two arguments:
454
480
 
455
- - `value`: source value
456
- - `index`: source index
481
+ - **value**: source value.
482
+ - **index**: source index.
457
483
 
458
484
  To set the callback execution context, provide a `thisArg`.
459
485
 
460
486
  ```javascript
461
487
  var Complex64 = require( '@stdlib/complex-float32' );
462
- var real = require( '@stdlib/complex-real' );
463
- var imag = require( '@stdlib/complex-imag' );
488
+ var realf = require( '@stdlib/complex-realf' );
489
+ var imagf = require( '@stdlib/complex-imagf' );
464
490
 
465
491
  function map( z ) {
466
492
  this.count += 1;
467
- return new Complex64( real(z)*2.0, imag(z)*2.0 );
493
+ return new Complex64( realf(z)*2.0, imagf(z)*2.0 );
468
494
  }
469
495
 
470
496
  // Create a source array:
@@ -519,6 +545,8 @@ Copies a sequence of elements within the array starting at `start` and ending at
519
545
 
520
546
  ```javascript
521
547
  var Complex64 = require( '@stdlib/complex-float32' );
548
+ var realf = require( '@stdlib/complex-realf' );
549
+ var imagf = require( '@stdlib/complex-imagf' );
522
550
 
523
551
  var arr = new Complex64Array( 4 );
524
552
 
@@ -529,29 +557,55 @@ arr.set( new Complex64( 3.0, -3.0 ), 2 );
529
557
  arr.set( new Complex64( 4.0, -4.0 ), 3 );
530
558
 
531
559
  // Get the first array element:
532
- var z = arr.get( [ 0.0, 0.0 ], 0 );
533
- // returns [ 1.0, -1.0 ]
560
+ var z = arr.get( 0 );
561
+ // returns <Complex64>
562
+
563
+ var re = realf( z );
564
+ // returns 1.0
565
+
566
+ var im = imagf( z );
567
+ // returns -1.0
534
568
 
535
569
  // Get the second array element:
536
- z = arr.get( [ 0.0, 0.0 ], 1 );
537
- // returns [ 2.0, -2.0 ]
570
+ z = arr.get( 1 );
571
+ // returns <Complex64>
572
+
573
+ re = realf( z );
574
+ // returns 2.0
575
+
576
+ im = imagf( z );
577
+ // returns -2.0
538
578
 
539
579
  // Copy the last two elements to the first two elements:
540
580
  arr.copyWithin( 0, 2 );
541
581
 
542
582
  // Get the first array element:
543
- z = arr.get( [ 0.0, 0.0 ], 0 );
544
- // returns [ 3.0, -3.0 ]
583
+ z = arr.get( 0 );
584
+ // returns <Complex64>
585
+
586
+ re = realf( z );
587
+ // returns 3.0
588
+
589
+ im = imagf( z );
590
+ // returns -3.0
545
591
 
546
592
  // Get the second array element:
547
- z = arr.get( [ 0.0, 0.0 ], 1 );
548
- // returns [ 4.0, -4.0 ]
593
+ z = arr.get( 1 );
594
+ // returns <Complex64>
595
+
596
+ re = realf( z );
597
+ // returns 4.0
598
+
599
+ im = imagf( z );
600
+ // returns -4.0
549
601
  ```
550
602
 
551
603
  By default, `end` equals the number of array elements (i.e., one more than the last array index). To limit the sequence length, provide an `end` argument.
552
604
 
553
605
  ```javascript
554
606
  var Complex64 = require( '@stdlib/complex-float32' );
607
+ var realf = require( '@stdlib/complex-realf' );
608
+ var imagf = require( '@stdlib/complex-imagf' );
555
609
 
556
610
  var arr = new Complex64Array( 4 );
557
611
 
@@ -562,29 +616,55 @@ arr.set( new Complex64( 3.0, -3.0 ), 2 );
562
616
  arr.set( new Complex64( 4.0, -4.0 ), 3 );
563
617
 
564
618
  // Get the third array element:
565
- var z = arr.get( [ 0.0, 0.0 ], 2 );
566
- // returns [ 3.0, -3.0 ]
619
+ var z = arr.get( 2 );
620
+ // returns <Complex64>
621
+
622
+ var re = realf( z );
623
+ // returns 3.0
624
+
625
+ var im = imagf( z );
626
+ // returns -3.0
567
627
 
568
628
  // Get the last array element:
569
- z = arr.get( [ 0.0, 0.0 ], 3 );
570
- // returns [ 4.0, -4.0 ]
629
+ z = arr.get( 3 );
630
+ // returns <Complex64>
631
+
632
+ re = realf( z );
633
+ // returns 4.0
634
+
635
+ im = imagf( z );
636
+ // returns -4.0
571
637
 
572
638
  // Copy the first two elements to the last two elements:
573
639
  arr.copyWithin( 2, 0, 2 );
574
640
 
575
641
  // Get the third array element:
576
- z = arr.get( [ 0.0, 0.0 ], 2 );
577
- // returns [ 1.0, -1.0 ]
642
+ z = arr.get( 2 );
643
+ // returns <Complex64>
644
+
645
+ re = realf( z );
646
+ // returns 1.0
647
+
648
+ im = imagf( z );
649
+ // returns -1.0
578
650
 
579
651
  // Get the last array element:
580
- z = arr.get( [ 0.0, 0.0 ], 3 );
581
- // returns [ 2.0, -2.0 ]
652
+ z = arr.get( 3 );
653
+ // returns <Complex64>
654
+
655
+ re = realf( z );
656
+ // returns 2.0
657
+
658
+ im = imagf( z );
659
+ // returns -2.0
582
660
  ```
583
661
 
584
662
  When a `target`, `start`, and/or `end` index is negative, the respective index is determined relative to the last array element. The following example achieves the same behavior as the previous example:
585
663
 
586
664
  ```javascript
587
665
  var Complex64 = require( '@stdlib/complex-float32' );
666
+ var realf = require( '@stdlib/complex-realf' );
667
+ var imagf = require( '@stdlib/complex-imagf' );
588
668
 
589
669
  var arr = new Complex64Array( 4 );
590
670
 
@@ -595,23 +675,47 @@ arr.set( new Complex64( 3.0, -3.0 ), 2 );
595
675
  arr.set( new Complex64( 4.0, -4.0 ), 3 );
596
676
 
597
677
  // Get the third array element:
598
- var z = arr.get( [ 0.0, 0.0 ], 2 );
599
- // returns [ 3.0, -3.0 ]
678
+ var z = arr.get( 2 );
679
+ // returns <Complex64>
680
+
681
+ var re = realf( z );
682
+ // returns 3.0
683
+
684
+ var im = imagf( z );
685
+ // returns -3.0
600
686
 
601
687
  // Get the last array element:
602
- z = arr.get( [ 0.0, 0.0 ], 3 );
603
- // returns [ 4.0, -4.0 ]
688
+ z = arr.get( 3 );
689
+ // returns <Complex64>
690
+
691
+ re = realf( z );
692
+ // returns 4.0
693
+
694
+ im = imagf( z );
695
+ // returns -4.0
604
696
 
605
697
  // Copy the first two elements to the last two elements using negative indices:
606
698
  arr.copyWithin( -2, -4, -2 );
607
699
 
608
700
  // Get the third array element:
609
- z = arr.get( [ 0.0, 0.0 ], 2 );
610
- // returns [ 1.0, -1.0 ]
701
+ z = arr.get( 2 );
702
+ // returns <Complex64>
703
+
704
+ re = realf( z );
705
+ // returns 1.0
706
+
707
+ im = imagf( z );
708
+ // returns -1.0
611
709
 
612
710
  // Get the last array element:
613
- z = arr.get( [ 0.0, 0.0 ], 3 );
614
- // returns [ 2.0, -2.0 ]
711
+ z = arr.get( 3 );
712
+ // returns <Complex64>
713
+
714
+ re = realf( z );
715
+ // returns 2.0
716
+
717
+ im = imagf( z );
718
+ // returns -2.0
615
719
  ```
616
720
 
617
721
  <a name="method-entries"></a>
@@ -622,8 +726,8 @@ Returns an iterator for iterating over array key-value pairs.
622
726
 
623
727
  ```javascript
624
728
  var Complex64 = require( '@stdlib/complex-float32' );
625
- var real = require( '@stdlib/complex-real' );
626
- var imag = require( '@stdlib/complex-imag' );
729
+ var realf = require( '@stdlib/complex-realf' );
730
+ var imagf = require( '@stdlib/complex-imagf' );
627
731
 
628
732
  var arr = [
629
733
  new Complex64( 1.0, -1.0 ),
@@ -639,28 +743,28 @@ var it = arr.entries();
639
743
  var v = it.next().value;
640
744
  // returns [ 0, <Complex64> ]
641
745
 
642
- var re = real( v[ 1 ] );
746
+ var re = realf( v[ 1 ] );
643
747
  // returns 1.0
644
748
 
645
- var im = imag( v[ 1 ] );
749
+ var im = imagf( v[ 1 ] );
646
750
  // returns -1.0
647
751
 
648
752
  v = it.next().value;
649
753
  // returns [ 1, <Complex64> ]
650
754
 
651
- re = real( v[ 1 ] );
755
+ re = realf( v[ 1 ] );
652
756
  // returns 2.0
653
757
 
654
- im = imag( v[ 1 ] );
758
+ im = imagf( v[ 1 ] );
655
759
  // returns -2.0
656
760
 
657
761
  v = it.next().value;
658
762
  // returns [ 2, <Complex64> ]
659
763
 
660
- re = real( v[ 1 ] );
764
+ re = realf( v[ 1 ] );
661
765
  // returns 3.0
662
766
 
663
- im = imag( v[ 1 ] );
767
+ im = imagf( v[ 1 ] );
664
768
  // returns -3.0
665
769
 
666
770
  var bool = it.next().done;
@@ -669,13 +773,13 @@ var bool = it.next().done;
669
773
 
670
774
  <a name="method-get"></a>
671
775
 
672
- #### Complex64Array.prototype.get( \[out,] i )
776
+ #### Complex64Array.prototype.get( i )
673
777
 
674
778
  Returns an array element located at position (index) `i`.
675
779
 
676
780
  ```javascript
677
- var real = require( '@stdlib/complex-real' );
678
- var imag = require( '@stdlib/complex-imag' );
781
+ var realf = require( '@stdlib/complex-realf' );
782
+ var imagf = require( '@stdlib/complex-imagf' );
679
783
 
680
784
  var arr = new Complex64Array( 10 );
681
785
 
@@ -686,32 +790,13 @@ arr.set( [ 1.0, -1.0 ], 0 );
686
790
  var z = arr.get( 0 );
687
791
  // returns <Complex64>
688
792
 
689
- var re = real( z );
793
+ var re = realf( z );
690
794
  // returns 1.0
691
795
 
692
- var im = imag( z );
796
+ var im = imagf( z );
693
797
  // returns -1.0
694
798
  ```
695
799
 
696
- By default, the method returns a [64-bit complex number][@stdlib/complex/float32]. To return real and imaginary components separately, provide an array-like `object` as the first argument.
697
-
698
- ```javascript
699
- var arr = new Complex64Array( 10 );
700
-
701
- // Set the first element:
702
- arr.set( [ 1.0, -1.0 ], 0 );
703
-
704
- // Define an output array:
705
- var out = [ 0.0, 0.0 ];
706
-
707
- // Get the first element:
708
- var z = arr.get( out, 0 );
709
- // returns [ 1.0, -1.0 ]
710
-
711
- var bool = ( out === z );
712
- // returns true
713
- ```
714
-
715
800
  If provided an out-of-bounds index, the method returns `undefined`.
716
801
 
717
802
  ```javascript
@@ -719,14 +804,6 @@ var arr = new Complex64Array( 10 );
719
804
 
720
805
  var z = arr.get( 100 );
721
806
  // returns undefined
722
-
723
- var out = [ 0.0, 0.0 ];
724
-
725
- z = arr.get( out, 100 );
726
- // returns undefined
727
-
728
- var bool = ( out === z );
729
- // returns false
730
807
  ```
731
808
 
732
809
  <a name="method-set"></a>
@@ -737,44 +814,74 @@ Sets one or more array elements.
737
814
 
738
815
  ```javascript
739
816
  var Complex64 = require( '@stdlib/complex-float32' );
817
+ var realf = require( '@stdlib/complex-realf' );
818
+ var imagf = require( '@stdlib/complex-imagf' );
740
819
 
741
820
  var arr = new Complex64Array( 10 );
742
821
 
743
822
  // Get the first element:
744
- var z = arr.get( [ 0.0, 0.0 ], 0 );
745
- // returns [ 0.0, 0.0 ]
823
+ var z = arr.get( 0 );
824
+ // returns <Complex64>
825
+
826
+ var re = realf( z );
827
+ // returns 0.0
828
+
829
+ var im = imagf( z );
830
+ // returns 0.0
746
831
 
747
832
  // Set the first element:
748
833
  arr.set( new Complex64( 1.0, -1.0 ) );
749
834
 
750
835
  // Get the first element:
751
- z = arr.get( [ 0.0, 0.0 ], 0 );
752
- // returns [ 1.0, -1.0 ]
836
+ z = arr.get( 0 );
837
+ // returns <Complex64>
838
+
839
+ re = realf( z );
840
+ // returns 1.0
841
+
842
+ im = imagf( z );
843
+ // returns -1.0
753
844
  ```
754
845
 
755
846
  By default, the method sets array elements starting at position (index) `i = 0`. To set elements starting elsewhere in the array, provide an index argument `i`.
756
847
 
757
848
  ```javascript
758
849
  var Complex64 = require( '@stdlib/complex-float32' );
850
+ var realf = require( '@stdlib/complex-realf' );
851
+ var imagf = require( '@stdlib/complex-imagf' );
759
852
 
760
853
  var arr = new Complex64Array( 10 );
761
854
 
762
855
  // Get the fifth element:
763
- var z = arr.get( [ 0.0, 0.0 ], 4 );
764
- // returns [ 0.0, 0.0 ]
856
+ var z = arr.get( 4 );
857
+ // returns <Complex64>
858
+
859
+ var re = realf( z );
860
+ // returns 0.0
861
+
862
+ var im = imagf( z );
863
+ // returns 0.0
765
864
 
766
865
  // Set the fifth element:
767
866
  arr.set( new Complex64( 1.0, -1.0 ), 4 );
768
867
 
769
868
  // Get the fifth element:
770
- z = arr.get( [ 0.0, 0.0 ], 4 );
771
- // returns [ 1.0, -1.0 ]
869
+ z = arr.get( 4 );
870
+ // returns <Complex64>
871
+
872
+ re = realf( z );
873
+ // returns 1.0
874
+
875
+ im = imagf( z );
876
+ // returns -1.0
772
877
  ```
773
878
 
774
- In addition to providing a complex number, to set one or more array elements, provide an array-like `object` containing either complex numbers
879
+ In addition to providing a complex number, to set one or more array elements, provide an array-like object containing either complex numbers
775
880
 
776
881
  ```javascript
777
882
  var Complex64 = require( '@stdlib/complex-float32' );
883
+ var realf = require( '@stdlib/complex-realf' );
884
+ var imagf = require( '@stdlib/complex-imagf' );
778
885
 
779
886
  var arr = new Complex64Array( 10 );
780
887
 
@@ -789,14 +896,22 @@ var buf = [
789
896
  arr.set( buf, 4 );
790
897
 
791
898
  // Get the sixth element:
792
- var z = arr.get( [ 0.0, 0.0 ], 5 );
793
- // returns [ 2.0, -2.0 ]
899
+ var z = arr.get( 5 );
900
+ // returns <Complex64>
901
+
902
+ var re = realf( z );
903
+ // returns 2.0
904
+
905
+ var im = imagf( z );
906
+ // returns -2.0
794
907
  ```
795
908
 
796
909
  or interleaved real and imaginary components
797
910
 
798
911
  ```javascript
799
912
  var Float32Array = require( '@stdlib/array-float32' );
913
+ var realf = require( '@stdlib/complex-realf' );
914
+ var imagf = require( '@stdlib/complex-imagf' );
800
915
 
801
916
  var arr = new Complex64Array( 10 );
802
917
 
@@ -807,8 +922,14 @@ var buf = new Float32Array( [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ] );
807
922
  arr.set( buf, 4 );
808
923
 
809
924
  // Get the sixth element:
810
- var z = arr.get( [ 0.0, 0.0 ], 5 );
811
- // returns [ 2.0, -2.0 ]
925
+ var z = arr.get( 5 );
926
+ // returns <Complex64>
927
+
928
+ var re = realf( z );
929
+ // returns 2.0
930
+
931
+ var im = imagf( z );
932
+ // returns -2.0
812
933
  ```
813
934
 
814
935
  A few notes:
@@ -853,38 +974,36 @@ A few notes:
853
974
  ```javascript
854
975
  var Complex64 = require( '@stdlib/complex-float32' );
855
976
  var Float32Array = require( '@stdlib/array-float32' );
977
+ var logEach = require( '@stdlib/console-log-each' );
856
978
  var Complex64Array = require( '@stdlib/array-complex64' );
857
979
 
858
- var arr;
859
- var out;
860
-
861
980
  // Create a complex array by specifying a length:
862
- out = new Complex64Array( 3 );
863
- console.log( out );
981
+ var out = new Complex64Array( 3 );
982
+ logEach( '%s', out );
864
983
 
865
984
  // Create a complex array from an array of complex numbers:
866
- arr = [
985
+ var arr = [
867
986
  new Complex64( 1.0, -1.0 ),
868
987
  new Complex64( -3.14, 3.14 ),
869
988
  new Complex64( 0.5, 0.5 )
870
989
  ];
871
990
  out = new Complex64Array( arr );
872
- console.log( out );
991
+ logEach( '%s', out );
873
992
 
874
993
  // Create a complex array from an interleaved typed array:
875
994
  arr = new Float32Array( [ 1.0, -1.0, -3.14, 3.14, 0.5, 0.5 ] );
876
995
  out = new Complex64Array( arr );
877
- console.log( out );
996
+ logEach( '%s', out );
878
997
 
879
998
  // Create a complex array from an array buffer:
880
999
  arr = new Float32Array( [ 1.0, -1.0, -3.14, 3.14, 0.5, 0.5 ] );
881
1000
  out = new Complex64Array( arr.buffer );
882
- console.log( out );
1001
+ logEach( '%s', out );
883
1002
 
884
1003
  // Create a complex array from an array buffer view:
885
1004
  arr = new Float32Array( [ 1.0, -1.0, -3.14, 3.14, 0.5, 0.5 ] );
886
1005
  out = new Complex64Array( arr.buffer, 8, 2 );
887
- console.log( out );
1006
+ logEach( '%s', out );
888
1007
  ```
889
1008
 
890
1009
  </section>
@@ -899,6 +1018,22 @@ console.log( out );
899
1018
 
900
1019
  <!-- /.references -->
901
1020
 
1021
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
1022
+
1023
+ <section class="related">
1024
+
1025
+ * * *
1026
+
1027
+ ## See Also
1028
+
1029
+ - <span class="package-name">[`@stdlib/array-complex128`][@stdlib/array/complex128]</span><span class="delimiter">: </span><span class="description">Complex128Array.</span>
1030
+ - <span class="package-name">[`@stdlib/complex-cmplx`][@stdlib/complex/cmplx]</span><span class="delimiter">: </span><span class="description">create a complex number.</span>
1031
+ - <span class="package-name">[`@stdlib/complex-float32`][@stdlib/complex/float32]</span><span class="delimiter">: </span><span class="description">64-bit complex number.</span>
1032
+
1033
+ </section>
1034
+
1035
+ <!-- /.related -->
1036
+
902
1037
  <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
903
1038
 
904
1039
 
@@ -925,7 +1060,7 @@ See [LICENSE][stdlib-license].
925
1060
 
926
1061
  ## Copyright
927
1062
 
928
- Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
1063
+ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
929
1064
 
930
1065
  </section>
931
1066
 
@@ -938,22 +1073,34 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
938
1073
  [npm-image]: http://img.shields.io/npm/v/@stdlib/array-complex64.svg
939
1074
  [npm-url]: https://npmjs.org/package/@stdlib/array-complex64
940
1075
 
941
- [test-image]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml/badge.svg
942
- [test-url]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml
1076
+ [test-image]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml/badge.svg?branch=v0.1.0
1077
+ [test-url]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml?query=branch:v0.1.0
943
1078
 
944
1079
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-complex64/main.svg
945
1080
  [coverage-url]: https://codecov.io/github/stdlib-js/array-complex64?branch=main
946
1081
 
1082
+ <!--
1083
+
947
1084
  [dependencies-image]: https://img.shields.io/david/stdlib-js/array-complex64.svg
948
1085
  [dependencies-url]: https://david-dm.org/stdlib-js/array-complex64/main
949
1086
 
1087
+ -->
1088
+
950
1089
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
951
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
1090
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
952
1091
 
953
1092
  [stdlib]: https://github.com/stdlib-js/stdlib
954
1093
 
955
1094
  [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
956
1095
 
1096
+ [umd]: https://github.com/umdjs/umd
1097
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
1098
+
1099
+ [deno-url]: https://github.com/stdlib-js/array-complex64/tree/deno
1100
+ [umd-url]: https://github.com/stdlib-js/array-complex64/tree/umd
1101
+ [esm-url]: https://github.com/stdlib-js/array-complex64/tree/esm
1102
+ [branches-url]: https://github.com/stdlib-js/array-complex64/blob/main/branches.md
1103
+
957
1104
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-complex64/main/LICENSE
958
1105
 
959
1106
  [@stdlib/array/typed]: https://www.npmjs.com/package/@stdlib/array-typed
@@ -962,6 +1109,14 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
962
1109
 
963
1110
  [@stdlib/complex/float32]: https://www.npmjs.com/package/@stdlib/complex-float32
964
1111
 
1112
+ <!-- <related-links> -->
1113
+
1114
+ [@stdlib/array/complex128]: https://www.npmjs.com/package/@stdlib/array-complex128
1115
+
1116
+ [@stdlib/complex/cmplx]: https://www.npmjs.com/package/@stdlib/complex-cmplx
1117
+
1118
+ <!-- </related-links> -->
1119
+
965
1120
  </section>
966
1121
 
967
1122
  <!-- /.links -->