@stdlib/array-complex64 0.1.0 → 0.2.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
@@ -537,6 +537,56 @@ len = arr.length;
537
537
  // returns 2
538
538
  ```
539
539
 
540
+ <a name="method-at"></a>
541
+
542
+ #### Complex64Array.prototype.at( i )
543
+
544
+ Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer positions.
545
+
546
+ ```javascript
547
+ var realf = require( '@stdlib/complex-realf' );
548
+ var imagf = require( '@stdlib/complex-imagf' );
549
+
550
+ var arr = new Complex64Array( 10 );
551
+
552
+ // Set the first, second, and last elements:
553
+ arr.set( [ 1.0, -1.0 ], 0 );
554
+ arr.set( [ 2.0, -2.0 ], 1 );
555
+ arr.set( [ 9.0, -9.0 ], 9 );
556
+
557
+ // Get the first element:
558
+ var z = arr.at( 0 );
559
+ // returns <Complex64>
560
+
561
+ var re = realf( z );
562
+ // returns 1.0
563
+
564
+ var im = imagf( z );
565
+ // returns -1.0
566
+
567
+ // Get the last element:
568
+ z = arr.at( -1 );
569
+ // returns <Complex64>
570
+
571
+ re = realf( z );
572
+ // returns 9.0
573
+
574
+ im = imagf( z );
575
+ // returns -9.0
576
+ ```
577
+
578
+ If provided an out-of-bounds index, the method returns `undefined`.
579
+
580
+ ```javascript
581
+ var arr = new Complex64Array( 10 );
582
+
583
+ var z = arr.at( 100 );
584
+ // returns undefined
585
+
586
+ z = arr.at( -100 );
587
+ // returns undefined
588
+ ```
589
+
540
590
  <a name="method-copy-within"></a>
541
591
 
542
592
  #### Complex64Array.prototype.copyWithin( target, start\[, end] )
@@ -771,172 +821,1351 @@ var bool = it.next().done;
771
821
  // returns true
772
822
  ```
773
823
 
774
- <a name="method-get"></a>
824
+ <a name="method-every"></a>
775
825
 
776
- #### Complex64Array.prototype.get( i )
826
+ #### Complex64Array.prototype.every( predicate\[, thisArg] )
777
827
 
778
- Returns an array element located at position (index) `i`.
828
+ Returns a boolean indicating whether all elements pass a test.
779
829
 
780
830
  ```javascript
781
831
  var realf = require( '@stdlib/complex-realf' );
782
832
  var imagf = require( '@stdlib/complex-imagf' );
783
833
 
784
- var arr = new Complex64Array( 10 );
785
-
786
- // Set the first element:
787
- arr.set( [ 1.0, -1.0 ], 0 );
834
+ function predicate( v ) {
835
+ return ( realf( v ) === imagf( v ) );
836
+ }
788
837
 
789
- // Get the first element:
790
- var z = arr.get( 0 );
791
- // returns <Complex64>
838
+ var arr = new Complex64Array( 3 );
792
839
 
793
- var re = realf( z );
794
- // returns 1.0
840
+ // Set the first three elements:
841
+ arr.set( [ 1.0, 1.0 ], 0 );
842
+ arr.set( [ 2.0, 2.0 ], 1 );
843
+ arr.set( [ 3.0, 3.0 ], 2 );
795
844
 
796
- var im = imagf( z );
797
- // returns -1.0
845
+ // Check whether all elements pass a test:
846
+ var z = arr.every( predicate );
847
+ // returns true
798
848
  ```
799
849
 
800
- If provided an out-of-bounds index, the method returns `undefined`.
850
+ The `predicate` function is provided three arguments:
851
+
852
+ - **value**: current array element.
853
+ - **index**: current array element index.
854
+ - **arr**: the array on which this method was called.
855
+
856
+ To set the function execution context, provide a `thisArg`.
801
857
 
802
858
  ```javascript
803
- var arr = new Complex64Array( 10 );
859
+ function predicate( v, i ) {
860
+ this.count += 1;
861
+ return ( i >= 0 );
862
+ }
804
863
 
805
- var z = arr.get( 100 );
806
- // returns undefined
864
+ var arr = new Complex64Array( 3 );
865
+
866
+ var context = {
867
+ 'count': 0
868
+ };
869
+
870
+ // Set the first three elements:
871
+ arr.set( [ 1.0, 1.0 ], 0 );
872
+ arr.set( [ 2.0, 2.0 ], 1 );
873
+ arr.set( [ 3.0, 3.0 ], 2 );
874
+
875
+ var z = arr.every( predicate, context );
876
+ // returns true
877
+
878
+ var count = context.count;
879
+ // returns 3
807
880
  ```
808
881
 
809
- <a name="method-set"></a>
882
+ <a name="method-fill"></a>
810
883
 
811
- #### Complex64Array.prototype.set( z\[, i] )
884
+ #### Complex64Array.prototype.fill( value\[, start\[, end]] )
812
885
 
813
- Sets one or more array elements.
886
+ Returns a modified typed array filled with a fill value.
814
887
 
815
888
  ```javascript
816
889
  var Complex64 = require( '@stdlib/complex-float32' );
817
890
  var realf = require( '@stdlib/complex-realf' );
818
891
  var imagf = require( '@stdlib/complex-imagf' );
819
892
 
820
- var arr = new Complex64Array( 10 );
893
+ var arr = new Complex64Array( 3 );
894
+
895
+ // Set all elements to the same value:
896
+ arr.fill( new Complex64( 1.0, 1.0 ) );
821
897
 
822
- // Get the first element:
823
898
  var z = arr.get( 0 );
824
899
  // returns <Complex64>
825
900
 
826
901
  var re = realf( z );
827
- // returns 0.0
902
+ // returns 1.0
828
903
 
829
904
  var im = imagf( z );
830
- // returns 0.0
905
+ // returns 1.0
831
906
 
832
- // Set the first element:
833
- arr.set( new Complex64( 1.0, -1.0 ) );
907
+ z = arr.get( 2 );
908
+ // returns <Complex64>
909
+
910
+ re = realf( z );
911
+ // returns 1.0
912
+
913
+ im = imagf( z );
914
+ // returns 1.0
915
+
916
+ // Fill all elements starting from the second element:
917
+ arr.fill( new Complex64( 2.0, 2.0 ), 1 );
918
+
919
+ z = arr.get( 1 );
920
+ // returns <Complex64>
921
+
922
+ re = realf( z );
923
+ // returns 2.0
924
+
925
+ im = imagf( z );
926
+ // returns 2.0
927
+
928
+ z = arr.get( 2 );
929
+ // returns <Complex64>
930
+
931
+ re = realf( z );
932
+ // returns 2.0
933
+
934
+ im = imagf( z );
935
+ // returns 2.0
936
+
937
+ // Fill all elements from first element until the second-to-last element:
938
+ arr.fill( new Complex64( 3.0, 3.0 ), 0, 2 );
834
939
 
835
- // Get the first element:
836
940
  z = arr.get( 0 );
837
941
  // returns <Complex64>
838
942
 
839
943
  re = realf( z );
840
- // returns 1.0
944
+ // returns 3.0
841
945
 
842
946
  im = imagf( z );
843
- // returns -1.0
947
+ // returns 3.0
948
+
949
+ z = arr.get( 1 );
950
+ // returns <Complex64>
951
+
952
+ re = realf( z );
953
+ // returns 3.0
954
+
955
+ im = imagf( z );
956
+ // returns 3.0
844
957
  ```
845
958
 
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`.
959
+ When a `start` and/or `end` index is negative, the respective index is determined relative to the last array element.
847
960
 
848
961
  ```javascript
849
962
  var Complex64 = require( '@stdlib/complex-float32' );
850
963
  var realf = require( '@stdlib/complex-realf' );
851
964
  var imagf = require( '@stdlib/complex-imagf' );
852
965
 
853
- var arr = new Complex64Array( 10 );
966
+ var arr = new Complex64Array( 3 );
854
967
 
855
- // Get the fifth element:
856
- var z = arr.get( 4 );
968
+ // Set all array elements, except the last element, to the same value:
969
+ arr.fill( new Complex64( 1.0, 1.0 ), 0, -1 );
970
+
971
+ var z = arr.get( 0 );
857
972
  // returns <Complex64>
858
973
 
859
974
  var re = realf( z );
860
- // returns 0.0
975
+ // returns 1.0
861
976
 
862
977
  var im = imagf( z );
863
- // returns 0.0
864
-
865
- // Set the fifth element:
866
- arr.set( new Complex64( 1.0, -1.0 ), 4 );
978
+ // returns 1.0
867
979
 
868
- // Get the fifth element:
869
- z = arr.get( 4 );
980
+ z = arr.get( arr.length - 1 );
870
981
  // returns <Complex64>
871
982
 
872
983
  re = realf( z );
873
- // returns 1.0
984
+ // returns 0.0
874
985
 
875
986
  im = imagf( z );
876
- // returns -1.0
987
+ // returns 0.0
877
988
  ```
878
989
 
879
- In addition to providing a complex number, to set one or more array elements, provide an array-like object containing either complex numbers
990
+ <a name="method-filter"></a>
991
+
992
+ #### Complex64Array.prototype.filter( predicate\[, thisArg] )
993
+
994
+ Returns a new array containing the elements of an array which pass a test implemented by a predicate function.
880
995
 
881
996
  ```javascript
882
- var Complex64 = require( '@stdlib/complex-float32' );
883
997
  var realf = require( '@stdlib/complex-realf' );
884
998
  var imagf = require( '@stdlib/complex-imagf' );
885
999
 
886
- var arr = new Complex64Array( 10 );
1000
+ function predicate( v ) {
1001
+ return ( realf( v ) === imagf( v ) );
1002
+ }
887
1003
 
888
- // Define an array of complex numbers:
889
- var buf = [
890
- new Complex64( 1.0, -1.0 ),
891
- new Complex64( 2.0, -2.0 ),
892
- new Complex64( 3.0, -3.0 )
893
- ];
1004
+ var arr = new Complex64Array( 3 );
894
1005
 
895
- // Set the fifth, sixth, and seventh elements:
896
- arr.set( buf, 4 );
1006
+ // Set the first three elements:
1007
+ arr.set( [ 1.0, -1.0 ], 0 );
1008
+ arr.set( [ 2.0, 2.0 ], 1 );
1009
+ arr.set( [ 3.0, -3.0 ], 2 );
897
1010
 
898
- // Get the sixth element:
899
- var z = arr.get( 5 );
1011
+ var out = arr.filter( predicate );
1012
+ // returns <Complex64Array>
1013
+
1014
+ var len = out.length;
1015
+ // returns 1
1016
+
1017
+ var z = out.get( 0 );
900
1018
  // returns <Complex64>
901
1019
 
902
1020
  var re = realf( z );
903
1021
  // returns 2.0
904
1022
 
905
1023
  var im = imagf( z );
906
- // returns -2.0
1024
+ // returns 2.0
907
1025
  ```
908
1026
 
909
- or interleaved real and imaginary components
1027
+ The `predicate` function is provided three arguments:
1028
+
1029
+ - **value**: current array element.
1030
+ - **index**: current array element index.
1031
+ - **arr**: the array on which this method was called.
1032
+
1033
+ To set the function execution context, provide a `thisArg`.
910
1034
 
911
1035
  ```javascript
912
- var Float32Array = require( '@stdlib/array-float32' );
913
1036
  var realf = require( '@stdlib/complex-realf' );
914
1037
  var imagf = require( '@stdlib/complex-imagf' );
915
1038
 
916
- var arr = new Complex64Array( 10 );
1039
+ function predicate( v, i ) {
1040
+ this.count += 1;
1041
+ return ( i >= 0 && realf( v ) === imagf( v ) );
1042
+ }
917
1043
 
918
- // Define an interleaved array of real and imaginary components:
919
- var buf = new Float32Array( [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ] );
1044
+ var arr = new Complex64Array( 3 );
920
1045
 
921
- // Set the fifth, sixth, and seventh elements:
922
- arr.set( buf, 4 );
1046
+ var context = {
1047
+ 'count': 0
1048
+ };
923
1049
 
924
- // Get the sixth element:
925
- var z = arr.get( 5 );
1050
+ // Set the first three elements:
1051
+ arr.set( [ 1.0, -1.0 ], 0 );
1052
+ arr.set( [ 2.0, 2.0 ], 1 );
1053
+ arr.set( [ 3.0, 3.0 ], 2 );
1054
+
1055
+ var out = arr.filter( predicate, context );
1056
+ // returns <Complex64Array>
1057
+
1058
+ var len = out.length;
1059
+ // returns 2
1060
+
1061
+ var count = context.count;
1062
+ // returns 3
1063
+ ```
1064
+
1065
+ <a name="method-find"></a>
1066
+
1067
+ #### Complex64Array.prototype.find( predicate\[, thisArg] )
1068
+
1069
+ Returns the first element in an array for which a predicate function returns a truthy value.
1070
+
1071
+ ```javascript
1072
+ var realf = require( '@stdlib/complex-realf' );
1073
+ var imagf = require( '@stdlib/complex-imagf' );
1074
+ var Complex64 = require( '@stdlib/complex-float32' );
1075
+
1076
+ function predicate( v ) {
1077
+ return ( realf( v ) === imagf( v ) );
1078
+ }
1079
+
1080
+ var arr = new Complex64Array( 3 );
1081
+
1082
+ // Set the first three elements:
1083
+ arr.set( [ 1.0, 1.0 ], 0 );
1084
+ arr.set( [ 2.0, 2.0 ], 1 );
1085
+ arr.set( [ 3.0, 3.0 ], 2 );
1086
+
1087
+ var z = arr.find( predicate );
1088
+ // returns <Complex64>
1089
+
1090
+ var re = realf( z );
1091
+ // returns 1.0
1092
+
1093
+ var im = imagf( z );
1094
+ // returns 1.0
1095
+ ```
1096
+
1097
+ The `predicate` function is provided three arguments:
1098
+
1099
+ - **value**: current array element.
1100
+ - **index**: current array element index.
1101
+ - **arr**: the array on which this method was called.
1102
+
1103
+ To set the function execution context, provide a `thisArg`.
1104
+
1105
+ ```javascript
1106
+ var realf = require( '@stdlib/complex-realf' );
1107
+ var imagf = require( '@stdlib/complex-imagf' );
1108
+
1109
+ function predicate( v, i ) {
1110
+ this.count += 1;
1111
+ return ( i >= 0 && realf( v ) === imagf( v ) );
1112
+ }
1113
+
1114
+ var arr = new Complex64Array( 3 );
1115
+
1116
+ var context = {
1117
+ 'count': 0
1118
+ };
1119
+
1120
+ // Set the first three elements:
1121
+ arr.set( [ 1.0, -1.0 ], 0 );
1122
+ arr.set( [ 2.0, 2.0 ], 1 );
1123
+ arr.set( [ 3.0, 3.0 ], 2 );
1124
+
1125
+ var z = arr.find( predicate, context );
926
1126
  // returns <Complex64>
927
1127
 
928
1128
  var re = realf( z );
929
1129
  // returns 2.0
930
1130
 
931
1131
  var im = imagf( z );
932
- // returns -2.0
1132
+ // returns 2.0
1133
+
1134
+ var count = context.count;
1135
+ // returns 2
933
1136
  ```
934
1137
 
935
- A few notes:
1138
+ <a name="method-find-index"></a>
936
1139
 
937
- - If `i` is out-of-bounds, the method throws an error.
938
- - If a target array cannot accommodate all values (i.e., the length of source array plus `i` exceeds the target array length), the method throws an error.
939
- - If provided a [typed array][@stdlib/array/typed] which shares an [`ArrayBuffer`][@stdlib/array/buffer] with the target array, the method will intelligently copy the source range to the destination range.
1140
+ #### Complex64Array.prototype.findIndex( predicate\[, thisArg] )
1141
+
1142
+ Returns the index of the first element in an array for which a predicate function returns a truthy value.
1143
+
1144
+ ```javascript
1145
+ var realf = require( '@stdlib/complex-realf' );
1146
+ var imagf = require( '@stdlib/complex-imagf' );
1147
+
1148
+ function predicate( v ) {
1149
+ return ( realf( v ) === imagf( v ) );
1150
+ }
1151
+
1152
+ var arr = new Complex64Array( 3 );
1153
+
1154
+ // Set the first three elements:
1155
+ arr.set( [ 1.0, -1.0 ], 0 );
1156
+ arr.set( [ 2.0, -2.0 ], 1 );
1157
+ arr.set( [ 3.0, 3.0 ], 2 );
1158
+
1159
+ var idx = arr.findIndex( predicate );
1160
+ // returns 2
1161
+ ```
1162
+
1163
+ The `predicate` function is provided three arguments:
1164
+
1165
+ - **value**: current array element.
1166
+ - **index**: current array element index.
1167
+ - **arr**: the array on which this method was called.
1168
+
1169
+ To set the function execution context, provide a `thisArg`.
1170
+
1171
+ ```javascript
1172
+ var realf = require( '@stdlib/complex-realf' );
1173
+ var imagf = require( '@stdlib/complex-imagf' );
1174
+
1175
+ function predicate( v, i ) {
1176
+ this.count += 1;
1177
+ return ( i >= 0 && realf( v ) === imagf( v ) );
1178
+ }
1179
+
1180
+ var arr = new Complex64Array( 3 );
1181
+
1182
+ var context = {
1183
+ 'count': 0
1184
+ };
1185
+
1186
+ // Set the first three elements:
1187
+ arr.set( [ 1.0, -1.0 ], 0 );
1188
+ arr.set( [ 2.0, -2.0 ], 1 );
1189
+ arr.set( [ 3.0, -3.0 ], 2 );
1190
+
1191
+ var idx = arr.findIndex( predicate, context );
1192
+ // returns -1
1193
+
1194
+ var count = context.count;
1195
+ // returns 3
1196
+ ```
1197
+
1198
+ <a name="method-find-last"></a>
1199
+
1200
+ #### Complex64Array.prototype.findLast( predicate\[, thisArg] )
1201
+
1202
+ Returns the last element in an array for which a predicate function returns a truthy value.
1203
+
1204
+ ```javascript
1205
+ var realf = require( '@stdlib/complex-realf' );
1206
+ var imagf = require( '@stdlib/complex-imagf' );
1207
+ var Complex64 = require( '@stdlib/complex-float32' );
1208
+
1209
+ function predicate( v ) {
1210
+ return ( realf( v ) === imagf( v ) );
1211
+ }
1212
+
1213
+ var arr = new Complex64Array( 3 );
1214
+
1215
+ // Set the first three elements:
1216
+ arr.set( [ 1.0, 1.0 ], 0 );
1217
+ arr.set( [ 2.0, 2.0 ], 1 );
1218
+ arr.set( [ 3.0, 3.0 ], 2 );
1219
+
1220
+ var z = arr.findLast( predicate );
1221
+ // returns <Complex64>
1222
+
1223
+ var re = realf( z );
1224
+ // returns 3.0
1225
+
1226
+ var im = imagf( z );
1227
+ // returns 3.0
1228
+ ```
1229
+
1230
+ The `predicate` function is provided three arguments:
1231
+
1232
+ - **value**: current array element.
1233
+ - **index**: current array element index.
1234
+ - **arr**: the array on which this method was called.
1235
+
1236
+ To set the function execution context, provide a `thisArg`.
1237
+
1238
+ ```javascript
1239
+ var realf = require( '@stdlib/complex-realf' );
1240
+ var imagf = require( '@stdlib/complex-imagf' );
1241
+
1242
+ function predicate( v, i ) {
1243
+ this.count += 1;
1244
+ return ( i >= 0 && realf( v ) === imagf( v ) );
1245
+ }
1246
+
1247
+ var arr = new Complex64Array( 3 );
1248
+
1249
+ var context = {
1250
+ 'count': 0
1251
+ };
1252
+
1253
+ // Set the first three elements:
1254
+ arr.set( [ 1.0, -1.0 ], 0 );
1255
+ arr.set( [ 2.0, 2.0 ], 1 );
1256
+ arr.set( [ 3.0, -3.0 ], 2 );
1257
+
1258
+ var z = arr.findLast( predicate, context );
1259
+ // returns <Complex64>
1260
+
1261
+ var re = realf( z );
1262
+ // returns 2.0
1263
+
1264
+ var im = imagf( z );
1265
+ // returns 2.0
1266
+
1267
+ var count = context.count;
1268
+ // returns 2
1269
+ ```
1270
+
1271
+ <a name="method-find-last-index"></a>
1272
+
1273
+ #### Complex64Array.prototype.findLastIndex( predicate\[, thisArg] )
1274
+
1275
+ Returns the index of the last element in an array for which a predicate function returns a truthy value.
1276
+
1277
+ ```javascript
1278
+ var realf = require( '@stdlib/complex-realf' );
1279
+ var imagf = require( '@stdlib/complex-imagf' );
1280
+
1281
+ function predicate( v ) {
1282
+ return ( realf( v ) === imagf( v ) );
1283
+ }
1284
+
1285
+ var arr = new Complex64Array( 3 );
1286
+
1287
+ // Set the first three elements:
1288
+ arr.set( [ 1.0, 1.0 ], 0 );
1289
+ arr.set( [ 2.0, 2.0 ], 1 );
1290
+ arr.set( [ 3.0, -3.0 ], 2 );
1291
+
1292
+ var idx = arr.findLastIndex( predicate );
1293
+ // returns 1
1294
+ ```
1295
+
1296
+ The `predicate` function is provided three arguments:
1297
+
1298
+ - **value**: current array element.
1299
+ - **index**: current array element index.
1300
+ - **arr**: the array on which this method was called.
1301
+
1302
+ To set the function execution context, provide a `thisArg`.
1303
+
1304
+ ```javascript
1305
+ var realf = require( '@stdlib/complex-realf' );
1306
+ var imagf = require( '@stdlib/complex-imagf' );
1307
+
1308
+ function predicate( v, i ) {
1309
+ this.count += 1;
1310
+ return ( i >= 0 && realf( v ) === imagf( v ) );
1311
+ }
1312
+
1313
+ var arr = new Complex64Array( 3 );
1314
+
1315
+ var context = {
1316
+ 'count': 0
1317
+ };
1318
+
1319
+ // Set the first three elements:
1320
+ arr.set( [ 1.0, -1.0 ], 0 );
1321
+ arr.set( [ 2.0, -2.0 ], 1 );
1322
+ arr.set( [ 3.0, -3.0 ], 2 );
1323
+
1324
+ var idx = arr.findLastIndex( predicate, context );
1325
+ // returns -1
1326
+
1327
+ var count = context.count;
1328
+ // returns 3
1329
+ ```
1330
+
1331
+ <a name="method-for-each"></a>
1332
+
1333
+ #### Complex64Array.prototype.forEach( callbackFn\[, thisArg] )
1334
+
1335
+ Invokes a function once for each array element.
1336
+
1337
+ ```javascript
1338
+ var Complex64 = require( '@stdlib/complex-float32' );
1339
+
1340
+ function log( v, i ) {
1341
+ console.log( '%s: %s', i, v.toString() );
1342
+ }
1343
+
1344
+ var arr = new Complex64Array( 3 );
1345
+
1346
+ // Set the first three elements:
1347
+ arr.set( [ 1.0, 1.0 ], 0 );
1348
+ arr.set( [ 2.0, 2.0 ], 1 );
1349
+ arr.set( [ 3.0, 3.0 ], 2 );
1350
+
1351
+ arr.forEach( log );
1352
+ /* =>
1353
+ 0: 1 + 1i
1354
+ 1: 2 + 2i
1355
+ 2: 3 + 3i
1356
+ */
1357
+ ```
1358
+
1359
+ The invoked function is provided three arguments:
1360
+
1361
+ - **value**: current array element.
1362
+ - **index**: current array element index.
1363
+ - **arr**: the array on which this method was called.
1364
+
1365
+ To set the function execution context, provide a `thisArg`.
1366
+
1367
+ ```javascript
1368
+ var Complex64 = require( '@stdlib/complex-float32' );
1369
+
1370
+ function fcn( v, i ) {
1371
+ this.count += 1;
1372
+ console.log( '%s: %s', i, v.toString() );
1373
+ }
1374
+
1375
+ var arr = new Complex64Array( 3 );
1376
+
1377
+ var context = {
1378
+ 'count': 0
1379
+ };
1380
+
1381
+ // Set the first three elements:
1382
+ arr.set( [ 1.0, -1.0 ], 0 );
1383
+ arr.set( [ 2.0, -2.0 ], 1 );
1384
+ arr.set( [ 3.0, -3.0 ], 2 );
1385
+
1386
+ arr.forEach( fcn, context );
1387
+ /* =>
1388
+ 0: 1 + 1i
1389
+ 1: 2 + 2i
1390
+ 2: 3 + 3i
1391
+ */
1392
+
1393
+ var count = context.count;
1394
+ // returns 3
1395
+ ```
1396
+
1397
+ <a name="method-get"></a>
1398
+
1399
+ #### Complex64Array.prototype.get( i )
1400
+
1401
+ Returns an array element located at a nonnegative integer position (index) `i`.
1402
+
1403
+ ```javascript
1404
+ var realf = require( '@stdlib/complex-realf' );
1405
+ var imagf = require( '@stdlib/complex-imagf' );
1406
+
1407
+ var arr = new Complex64Array( 10 );
1408
+
1409
+ // Set the first element:
1410
+ arr.set( [ 1.0, -1.0 ], 0 );
1411
+
1412
+ // Get the first element:
1413
+ var z = arr.get( 0 );
1414
+ // returns <Complex64>
1415
+
1416
+ var re = realf( z );
1417
+ // returns 1.0
1418
+
1419
+ var im = imagf( z );
1420
+ // returns -1.0
1421
+ ```
1422
+
1423
+ If provided an out-of-bounds index, the method returns `undefined`.
1424
+
1425
+ ```javascript
1426
+ var arr = new Complex64Array( 10 );
1427
+
1428
+ var z = arr.get( 100 );
1429
+ // returns undefined
1430
+ ```
1431
+
1432
+ <a name="method-includes"></a>
1433
+
1434
+ #### Complex64Array.prototype.includes( searchElement\[, fromIndex] )
1435
+
1436
+ Returns a boolean indicating whether an array includes a provided value.
1437
+
1438
+ ```javascript
1439
+ var Complex64 = require( '@stdlib/complex-float32' );
1440
+
1441
+ var arr = new Complex64Array( 5 );
1442
+
1443
+ arr.set( [ 1.0, -1.0 ], 0 );
1444
+ arr.set( [ 2.0, -2.0 ], 1 );
1445
+ arr.set( [ 3.0, -3.0 ], 2 );
1446
+ arr.set( [ 4.0, -4.0 ], 3 );
1447
+ arr.set( [ 5.0, -5.0 ], 4 );
1448
+
1449
+ var bool = arr.includes( new Complex64( 3.0, -3.0 ) );
1450
+ // returns true
1451
+
1452
+ bool = arr.includes( new Complex64( 3.0, -3.0 ), 3 );
1453
+ // returns false
1454
+
1455
+ bool = arr.includes( new Complex64( 4.0, -4.0 ), -3 );
1456
+ // returns true
1457
+ ```
1458
+
1459
+ <a name="method-index-of"></a>
1460
+
1461
+ #### Complex64Array.prototype.indexOf( searchElement\[, fromIndex] )
1462
+
1463
+ Returns the first index at which a given element can be found.
1464
+
1465
+ ```javascript
1466
+ var Complex64 = require( '@stdlib/complex-float32' );
1467
+
1468
+ var arr = new Complex64Array( 5 );
1469
+
1470
+ arr.set( [ 1.0, -1.0 ], 0 );
1471
+ arr.set( [ 2.0, -2.0 ], 1 );
1472
+ arr.set( [ 3.0, -3.0 ], 2 );
1473
+ arr.set( [ 4.0, -4.0 ], 3 );
1474
+ arr.set( [ 2.0, -2.0 ], 4 );
1475
+
1476
+ var idx = arr.indexOf( new Complex64( 3.0, -3.0 ) );
1477
+ // returns 2
1478
+
1479
+ idx = arr.indexOf( new Complex64( 2.0, -2.0 ), 2 );
1480
+ // returns 4
1481
+
1482
+ idx = arr.indexOf( new Complex64( 4.0, -4.0 ), -3 );
1483
+ // returns 3
1484
+ ```
1485
+
1486
+ If `searchElement` is not present in the array, the method returns `-1`.
1487
+
1488
+ ```javascript
1489
+ var Complex64 = require( '@stdlib/complex-float32' );
1490
+
1491
+ var arr = new Complex64Array( 10 );
1492
+
1493
+ arr.set( [ 1.0, -1.0 ], 0 );
1494
+ arr.set( [ 2.0, -2.0 ], 1 );
1495
+
1496
+ var idx = arr.indexOf( new Complex64( 3.0, -3.0 ) );
1497
+ // returns -1
1498
+
1499
+ idx = arr.indexOf( new Complex64( 1.0, -1.0 ), 1 );
1500
+ // returns -1
1501
+ ```
1502
+
1503
+ <a name="method-join"></a>
1504
+
1505
+ #### Complex64Array.prototype.join( \[separator] )
1506
+
1507
+ Returns a new string by concatenating all array elements.
1508
+
1509
+ ```javascript
1510
+ var arr = new Complex64Array( 3 );
1511
+
1512
+ arr.set( [ 1.0, 1.0 ], 0 );
1513
+ arr.set( [ 2.0, -2.0 ], 1 );
1514
+ arr.set( [ 3.0, 3.0 ], 2 );
1515
+
1516
+ var str = arr.join();
1517
+ // returns '1 + 1i,2 - 2i,3 + 3i'
1518
+ ```
1519
+
1520
+ By default, the method separates serialized array elements with a comma. To use an alternative separator, provide a `separator` string.
1521
+
1522
+ ```javascript
1523
+ var arr = new Complex64Array( 3 );
1524
+
1525
+ arr.set( [ 1.0, 1.0 ], 0 );
1526
+ arr.set( [ 2.0, -2.0 ], 1 );
1527
+ arr.set( [ 3.0, 3.0 ], 2 );
1528
+
1529
+ var str = arr.join( '/' );
1530
+ // returns '1 + 1i/2 - 2i/3 + 3i'
1531
+ ```
1532
+
1533
+ <a name="method-last-index-of"></a>
1534
+
1535
+ #### Complex64Array.prototype.lastIndexOf( searchElement\[, fromIndex] )
1536
+
1537
+ Returns the last index at which a given element can be found.
1538
+
1539
+ ```javascript
1540
+ var Complex64 = require( '@stdlib/complex-float32' );
1541
+
1542
+ var arr = new Complex64Array( 5 );
1543
+
1544
+ arr.set( [ 1.0, -1.0 ], 0 );
1545
+ arr.set( [ 2.0, -2.0 ], 1 );
1546
+ arr.set( [ 3.0, -3.0 ], 2 );
1547
+ arr.set( [ 4.0, -4.0 ], 3 );
1548
+ arr.set( [ 2.0, -2.0 ], 4 );
1549
+
1550
+ var idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ) );
1551
+ // returns 2
1552
+
1553
+ idx = arr.lastIndexOf( new Complex64( 2.0, -2.0 ), 2 );
1554
+ // returns 1
1555
+
1556
+ idx = arr.lastIndexOf( new Complex64( 4.0, -4.0 ), -1 );
1557
+ // returns 3
1558
+ ```
1559
+
1560
+ If `searchElement` is not present in the array, the method returns `-1`.
1561
+
1562
+ ```javascript
1563
+ var Complex64 = require( '@stdlib/complex-float32' );
1564
+
1565
+ var arr = new Complex64Array( 10 );
1566
+
1567
+ arr.set( [ 1.0, -1.0 ], 0 );
1568
+ arr.set( [ 2.0, -2.0 ], 1 );
1569
+
1570
+ var idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ) );
1571
+ // returns -1
1572
+
1573
+ idx = arr.lastIndexOf( new Complex64( 2.0, -2.0 ), 0 );
1574
+ // returns -1
1575
+ ```
1576
+
1577
+ <a name="method-map"></a>
1578
+
1579
+ #### Complex64Array.prototype.map( callbackFn\[, thisArg] )
1580
+
1581
+ Returns a new array with each element being the result of a provided callback function.
1582
+
1583
+ ```javascript
1584
+ var Complex64 = require( '@stdlib/complex-float32' );
1585
+ var realf = require( '@stdlib/complex-realf' );
1586
+ var imagf = require( '@stdlib/complex-imagf' );
1587
+
1588
+ function scale( v ) {
1589
+ return new Complex64( 2.0*realf( v ), 2.0*imagf( v ) );
1590
+ }
1591
+
1592
+ var arr = new Complex64Array( 3 );
1593
+
1594
+ // Set the first three elements:
1595
+ arr.set( [ 1.0, -1.0 ], 0 );
1596
+ arr.set( [ 2.0, -2.0 ], 1 );
1597
+ arr.set( [ 3.0, -3.0 ], 2 );
1598
+
1599
+ var out = arr.map( scale );
1600
+ // returns <Complex64Array>
1601
+
1602
+ var z = out.get( 0 );
1603
+ // returns <complex64>
1604
+
1605
+ var re = realf( z );
1606
+ // returns 2.0
1607
+
1608
+ var im = imagf( z );
1609
+ // returns -2.0
1610
+ ```
1611
+
1612
+ The callback function is provided three arguments:
1613
+
1614
+ - **value**: current array element.
1615
+ - **index**: current array element index.
1616
+ - **arr**: the array on which this method was called.
1617
+
1618
+ To set the function execution context, provide a `thisArg`.
1619
+
1620
+ ```javascript
1621
+ var Complex64 = require( '@stdlib/complex-float32' );
1622
+ var realf = require( '@stdlib/complex-realf' );
1623
+ var imagf = require( '@stdlib/complex-imagf' );
1624
+
1625
+ function scale( v ) {
1626
+ this.count += 1;
1627
+ return new Complex64( 2.0*realf( v ), 2.0*imagf( v ) );
1628
+ }
1629
+
1630
+ var arr = new Complex64Array( 3 );
1631
+
1632
+ var context = {
1633
+ 'count': 0
1634
+ };
1635
+
1636
+ // Set the first three elements:
1637
+ arr.set( [ 1.0, 1.0 ], 0 );
1638
+ arr.set( [ 2.0, 2.0 ], 1 );
1639
+ arr.set( [ 3.0, 3.0 ], 2 );
1640
+
1641
+ var out = arr.map( scale, context );
1642
+ // returns <Complex64Array>
1643
+
1644
+ var count = context.count;
1645
+ // returns 3
1646
+ ```
1647
+
1648
+ <a name="method-reverse"></a>
1649
+
1650
+ #### Complex64Array.prototype.reverse()
1651
+
1652
+ Reverses an array in-place.
1653
+
1654
+ ```javascript
1655
+ var realf = require( '@stdlib/complex-realf' );
1656
+ var imagf = require( '@stdlib/complex-imagf' );
1657
+
1658
+ var arr = new Complex64Array( 3 );
1659
+
1660
+ arr.set( [ 1.0, 1.0 ], 0 );
1661
+ arr.set( [ 2.0, 2.0 ], 1 );
1662
+ arr.set( [ 3.0, 3.0 ], 2 );
1663
+
1664
+ var out = arr.reverse();
1665
+ // returns <Complex64Array>
1666
+
1667
+ var z = out.get( 0 );
1668
+ // returns <Complex64>
1669
+
1670
+ var re = realf( z );
1671
+ // returns 3.0
1672
+
1673
+ var im = imagf( z );
1674
+ // returns 3.0
1675
+
1676
+ z = out.get( 1 );
1677
+ // returns <Complex64>
1678
+
1679
+ re = realf( z );
1680
+ // returns 2.0
1681
+
1682
+ im = imagf( z );
1683
+ // returns 2.0
1684
+
1685
+ z = out.get( 2 );
1686
+ // returns <Complex64>
1687
+
1688
+ re = realf( z );
1689
+ // returns 1.0
1690
+
1691
+ im = imagf( z );
1692
+ // returns 1.0
1693
+ ```
1694
+
1695
+ <a name="method-set"></a>
1696
+
1697
+ #### Complex64Array.prototype.set( z\[, i] )
1698
+
1699
+ Sets one or more array elements.
1700
+
1701
+ ```javascript
1702
+ var Complex64 = require( '@stdlib/complex-float32' );
1703
+ var realf = require( '@stdlib/complex-realf' );
1704
+ var imagf = require( '@stdlib/complex-imagf' );
1705
+
1706
+ var arr = new Complex64Array( 10 );
1707
+
1708
+ // Get the first element:
1709
+ var z = arr.get( 0 );
1710
+ // returns <Complex64>
1711
+
1712
+ var re = realf( z );
1713
+ // returns 0.0
1714
+
1715
+ var im = imagf( z );
1716
+ // returns 0.0
1717
+
1718
+ // Set the first element:
1719
+ arr.set( new Complex64( 1.0, -1.0 ) );
1720
+
1721
+ // Get the first element:
1722
+ z = arr.get( 0 );
1723
+ // returns <Complex64>
1724
+
1725
+ re = realf( z );
1726
+ // returns 1.0
1727
+
1728
+ im = imagf( z );
1729
+ // returns -1.0
1730
+ ```
1731
+
1732
+ 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`.
1733
+
1734
+ ```javascript
1735
+ var Complex64 = require( '@stdlib/complex-float32' );
1736
+ var realf = require( '@stdlib/complex-realf' );
1737
+ var imagf = require( '@stdlib/complex-imagf' );
1738
+
1739
+ var arr = new Complex64Array( 10 );
1740
+
1741
+ // Get the fifth element:
1742
+ var z = arr.get( 4 );
1743
+ // returns <Complex64>
1744
+
1745
+ var re = realf( z );
1746
+ // returns 0.0
1747
+
1748
+ var im = imagf( z );
1749
+ // returns 0.0
1750
+
1751
+ // Set the fifth element:
1752
+ arr.set( new Complex64( 1.0, -1.0 ), 4 );
1753
+
1754
+ // Get the fifth element:
1755
+ z = arr.get( 4 );
1756
+ // returns <Complex64>
1757
+
1758
+ re = realf( z );
1759
+ // returns 1.0
1760
+
1761
+ im = imagf( z );
1762
+ // returns -1.0
1763
+ ```
1764
+
1765
+ In addition to providing a complex number, to set one or more array elements, provide an array-like object containing either complex numbers
1766
+
1767
+ ```javascript
1768
+ var Complex64 = require( '@stdlib/complex-float32' );
1769
+ var realf = require( '@stdlib/complex-realf' );
1770
+ var imagf = require( '@stdlib/complex-imagf' );
1771
+
1772
+ var arr = new Complex64Array( 10 );
1773
+
1774
+ // Define an array of complex numbers:
1775
+ var buf = [
1776
+ new Complex64( 1.0, -1.0 ),
1777
+ new Complex64( 2.0, -2.0 ),
1778
+ new Complex64( 3.0, -3.0 )
1779
+ ];
1780
+
1781
+ // Set the fifth, sixth, and seventh elements:
1782
+ arr.set( buf, 4 );
1783
+
1784
+ // Get the sixth element:
1785
+ var z = arr.get( 5 );
1786
+ // returns <Complex64>
1787
+
1788
+ var re = realf( z );
1789
+ // returns 2.0
1790
+
1791
+ var im = imagf( z );
1792
+ // returns -2.0
1793
+ ```
1794
+
1795
+ or interleaved real and imaginary components
1796
+
1797
+ ```javascript
1798
+ var Float32Array = require( '@stdlib/array-float32' );
1799
+ var realf = require( '@stdlib/complex-realf' );
1800
+ var imagf = require( '@stdlib/complex-imagf' );
1801
+
1802
+ var arr = new Complex64Array( 10 );
1803
+
1804
+ // Define an interleaved array of real and imaginary components:
1805
+ var buf = new Float32Array( [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ] );
1806
+
1807
+ // Set the fifth, sixth, and seventh elements:
1808
+ arr.set( buf, 4 );
1809
+
1810
+ // Get the sixth element:
1811
+ var z = arr.get( 5 );
1812
+ // returns <Complex64>
1813
+
1814
+ var re = realf( z );
1815
+ // returns 2.0
1816
+
1817
+ var im = imagf( z );
1818
+ // returns -2.0
1819
+ ```
1820
+
1821
+ A few notes:
1822
+
1823
+ - If `i` is out-of-bounds, the method throws an error.
1824
+ - If a target array cannot accommodate all values (i.e., the length of source array plus `i` exceeds the target array length), the method throws an error.
1825
+ - If provided a [typed array][@stdlib/array/typed] which shares an [`ArrayBuffer`][@stdlib/array/buffer] with the target array, the method will intelligently copy the source range to the destination range.
1826
+
1827
+ <a name="method-slice"></a>
1828
+
1829
+ #### Complex64Array.prototype.slice( \[start\[, end]] )
1830
+
1831
+ Copies a portion of a typed array to a new typed array.
1832
+
1833
+ ```javascript
1834
+ var realf = require( '@stdlib/complex-realf' );
1835
+ var imagf = require( '@stdlib/complex-imagf' );
1836
+
1837
+ var arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
1838
+
1839
+ var out = arr.slice();
1840
+ // returns <Complex64Array>
1841
+
1842
+ var len = out.length;
1843
+ // returns 4
1844
+
1845
+ var z = out.get( 0 );
1846
+ // returns <Complex64>
1847
+
1848
+ var re = realf( z );
1849
+ // returns 1.0
1850
+
1851
+ var im = imagf( z );
1852
+ // returns 2.0
1853
+
1854
+ z = out.get( len-1 );
1855
+ // returns <Complex64>
1856
+
1857
+ re = realf( z );
1858
+ // returns 7.0
1859
+
1860
+ im = imagf( z );
1861
+ // returns 8.0
1862
+ ```
1863
+
1864
+ By default, the method returns a typed array beginning with the first array element. To specify an alternative array index at which to begin, provide a `start` index (inclusive).
1865
+
1866
+ ```javascript
1867
+ var imagf = require( '@stdlib/complex-imagf' );
1868
+ var realf = require( '@stdlib/complex-realf' );
1869
+
1870
+ var arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
1871
+
1872
+ var out = arr.slice( 1 );
1873
+ // returns <Complex64Array>
1874
+
1875
+ var len = out.length;
1876
+ // returns 3
1877
+
1878
+ var z = out.get( 0 );
1879
+ // returns <Complex64>
1880
+
1881
+ var re = realf( z );
1882
+ // returns 3.0
1883
+
1884
+ var im = imagf( z );
1885
+ // returns 4.0
1886
+ ```
1887
+
1888
+ By default, the method returns a typed array which includes all array elements after `start`. To limit the number of array elements after `start`, provide an `end` index (exclusive).
1889
+
1890
+ ```javascript
1891
+ var realf = require( '@stdlib/complex-realf' );
1892
+ var imagf = require( '@stdlib/complex-imagf' );
1893
+
1894
+ var arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
1895
+
1896
+ var out = arr.slice( 1, -1 );
1897
+ // returns <Complex64Array>
1898
+
1899
+ var len = out.length;
1900
+ // returns 2
1901
+
1902
+ var z = out.get( 0 );
1903
+ // returns <Complex64>
1904
+
1905
+ var re = realf( z );
1906
+ // returns 3.0
1907
+
1908
+ var im = imagf( z );
1909
+ // returns 4.0
1910
+
1911
+ z = out.get( len-1 );
1912
+ // returns <Complex64>
1913
+
1914
+ re = realf( z );
1915
+ // returns 5.0
1916
+
1917
+ im = imagf( z );
1918
+ // returns 6.0
1919
+ ```
1920
+
1921
+ <a name="method-some"></a>
1922
+
1923
+ #### Complex64Array.prototype.some( predicate\[, thisArg] )
1924
+
1925
+ Returns a boolean indicating whether at least one element passes a test.
1926
+
1927
+ ```javascript
1928
+ var realf = require( '@stdlib/complex-realf' );
1929
+ var imagf = require( '@stdlib/complex-imagf' );
1930
+
1931
+ function predicate( v ) {
1932
+ return ( realf( v ) === imagf( v ) );
1933
+ }
1934
+
1935
+ var arr = new Complex64Array( 3 );
1936
+
1937
+ // Set the first three elements:
1938
+ arr.set( [ 1.0, -1.0 ], 0 );
1939
+ arr.set( [ 2.0, 2.0 ], 1 );
1940
+ arr.set( [ 3.0, -3.0 ], 2 );
1941
+
1942
+ // Check whether at least one element passes a test:
1943
+ var z = arr.some( predicate );
1944
+ // returns true
1945
+ ```
1946
+
1947
+ The `predicate` function is provided three arguments:
1948
+
1949
+ - **value**: current array element.
1950
+ - **index**: current array element index.
1951
+ - **arr**: the array on which this method was called.
1952
+
1953
+ To set the function execution context, provide a `thisArg`.
1954
+
1955
+ ```javascript
1956
+ var realf = require( '@stdlib/complex-realf' );
1957
+ var imagf = require( '@stdlib/complex-imagf' );
1958
+
1959
+ function predicate( v, i ) {
1960
+ this.count += 1;
1961
+ return ( imagf( v ) === realf( v ) );
1962
+ }
1963
+
1964
+ var arr = new Complex64Array( 3 );
1965
+
1966
+ var context = {
1967
+ 'count': 0
1968
+ };
1969
+
1970
+ // Set the first three elements:
1971
+ arr.set( [ 1.0, -1.0 ], 0 );
1972
+ arr.set( [ 2.0, 2.0 ], 1 );
1973
+ arr.set( [ 3.0, -3.0 ], 2 );
1974
+
1975
+ var z = arr.some( predicate, context );
1976
+ // returns true
1977
+
1978
+ var count = context.count;
1979
+ // returns 2
1980
+ ```
1981
+
1982
+ <a name="method-subarray"></a>
1983
+
1984
+ #### Complex64Array.prototype.subarray( \[begin\[, end]] )
1985
+
1986
+ Creates a new typed array view over the same underlying [`ArrayBuffer`][@stdlib/array/buffer] and with the same underlying data type as the host array.
1987
+
1988
+ ```javascript
1989
+ var realf = require( '@stdlib/complex-realf' );
1990
+ var imagf = require( '@stdlib/complex-imagf' );
1991
+
1992
+ var arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
1993
+
1994
+ var subarr = arr.subarray();
1995
+ // returns <Complex64Array>
1996
+
1997
+ var len = subarr.length;
1998
+ // returns 4
1999
+
2000
+ var z = subarr.get( 0 );
2001
+ // returns <Complex64>
2002
+
2003
+ var re = realf( z );
2004
+ // returns 1.0
2005
+
2006
+ var im = imagf( z );
2007
+ // returns 2.0
2008
+
2009
+ z = subarr.get( len-1 );
2010
+ // returns <Complex64>
2011
+
2012
+ re = realf( z );
2013
+ // returns 7.0
2014
+
2015
+ im = imagf( z );
2016
+ // returns 8.0
2017
+ ```
2018
+
2019
+ By default, the method creates a typed array view beginning with the first array element. To specify an alternative array index at which to begin, provide a `begin` index (inclusive).
2020
+
2021
+ ```javascript
2022
+ var imagf = require( '@stdlib/complex-imagf' );
2023
+ var realf = require( '@stdlib/complex-realf' );
2024
+
2025
+ var arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
2026
+
2027
+ var subarr = arr.subarray( 1 );
2028
+ // returns <Complex64Array>
2029
+
2030
+ var len = subarr.length;
2031
+ // returns 3
2032
+
2033
+ var z = subarr.get( 0 );
2034
+ // returns <Complex64>
2035
+
2036
+ var re = realf( z );
2037
+ // returns 3.0
2038
+
2039
+ var im = imagf( z );
2040
+ // returns 4.0
2041
+ ```
2042
+
2043
+ By default, the method creates a typed array view which includes all array elements after `begin`. To limit the number of array elements after `begin`, provide an `end` index (exclusive).
2044
+
2045
+ ```javascript
2046
+ var realf = require( '@stdlib/complex-realf' );
2047
+ var imagf = require( '@stdlib/complex-imagf' );
2048
+
2049
+ var arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
2050
+
2051
+ var subarr = arr.subarray( 1, -1 );
2052
+ // returns <Complex64Array>
2053
+
2054
+ var len = subarr.length;
2055
+ // returns 2
2056
+
2057
+ var z = subarr.get( 0 );
2058
+ // returns <Complex64>
2059
+
2060
+ var re = realf( z );
2061
+ // returns 3.0
2062
+
2063
+ var im = imagf( z );
2064
+ // returns 4.0
2065
+
2066
+ z = subarr.get( len-1 );
2067
+ // returns <Complex64>
2068
+
2069
+ re = realf( z );
2070
+ // returns 5.0
2071
+
2072
+ im = imagf( z );
2073
+ // returns 6.0
2074
+ ```
2075
+
2076
+ <a name="method-to-reversed"></a>
2077
+
2078
+ #### Complex64Array.prototype.toReversed()
2079
+
2080
+ Returns a new typed array containing the elements in reversed order.
2081
+
2082
+ ```javascript
2083
+ var realf = require( '@stdlib/complex-realf' );
2084
+ var imagf = require( '@stdlib/complex-imagf' );
2085
+
2086
+ var arr = new Complex64Array( 3 );
2087
+
2088
+ arr.set( [ 1.0, 1.0 ], 0 );
2089
+ arr.set( [ 2.0, 2.0 ], 1 );
2090
+ arr.set( [ 3.0, 3.0 ], 2 );
2091
+
2092
+ var out = arr.toReversed();
2093
+ // returns <Complex64Array>
2094
+
2095
+ var z = out.get( 0 );
2096
+ // returns <Complex64>
2097
+
2098
+ var re = realf( z );
2099
+ // returns 3.0
2100
+
2101
+ var im = imagf( z );
2102
+ // returns 3.0
2103
+
2104
+ z = out.get( 1 );
2105
+ // returns <Complex64>
2106
+
2107
+ re = realf( z );
2108
+ // returns 2.0
2109
+
2110
+ im = imagf( z );
2111
+ // returns 2.0
2112
+
2113
+ z = out.get( 2 );
2114
+ // returns <Complex64>
2115
+
2116
+ re = realf( z );
2117
+ // returns 1.0
2118
+
2119
+ im = imagf( z );
2120
+ // returns 1.0
2121
+ ```
2122
+
2123
+ <a name="method-to-string"></a>
2124
+
2125
+ #### Complex64Array.prototype.toString()
2126
+
2127
+ Serializes an array as a string.
2128
+
2129
+ ```javascript
2130
+ var arr = new Complex64Array( 3 );
2131
+
2132
+ arr.set( [ 1.0, 1.0 ], 0 );
2133
+ arr.set( [ 2.0, -2.0 ], 1 );
2134
+ arr.set( [ 3.0, 3.0 ], 2 );
2135
+
2136
+ var str = arr.toString();
2137
+ // returns '1 + 1i,2 - 2i,3 + 3i'
2138
+ ```
2139
+
2140
+ <a name="method-with"></a>
2141
+
2142
+ #### Complex128Array.prototype.with( index, value )
2143
+
2144
+ Returns a new typed array with the element at a provided index replaced with a provided value.
2145
+
2146
+ ```javascript
2147
+ var realf = require( '@stdlib/complex-realf' );
2148
+ var imagf = require( '@stdlib/complex-imagf' );
2149
+ var Complex64 = require( '@stdlib/complex-float32' );
2150
+
2151
+ var arr = new Complex64Array( 3 );
2152
+
2153
+ arr.set( [ 1.0, 1.0 ], 0 );
2154
+ arr.set( [ 2.0, 2.0 ], 1 );
2155
+ arr.set( [ 3.0, 3.0 ], 1 );
2156
+
2157
+ var out = arr.with( 0, new Complex64( 4.0, 4.0 ) );
2158
+ // returns <Complex64Array>
2159
+
2160
+ var z = out.get( 0 );
2161
+ // returns <Complex64>
2162
+
2163
+ var re = realf( z );
2164
+ // returns 4.0
2165
+
2166
+ var im = imagf( z );
2167
+ // returns 4.0
2168
+ ```
940
2169
 
941
2170
  </section>
942
2171
 
@@ -1060,7 +2289,7 @@ See [LICENSE][stdlib-license].
1060
2289
 
1061
2290
  ## Copyright
1062
2291
 
1063
- Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
2292
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
1064
2293
 
1065
2294
  </section>
1066
2295
 
@@ -1073,8 +2302,8 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
1073
2302
  [npm-image]: http://img.shields.io/npm/v/@stdlib/array-complex64.svg
1074
2303
  [npm-url]: https://npmjs.org/package/@stdlib/array-complex64
1075
2304
 
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
2305
+ [test-image]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml/badge.svg?branch=v0.2.0
2306
+ [test-url]: https://github.com/stdlib-js/array-complex64/actions/workflows/test.yml?query=branch:v0.2.0
1078
2307
 
1079
2308
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-complex64/main.svg
1080
2309
  [coverage-url]: https://codecov.io/github/stdlib-js/array-complex64?branch=main
@@ -1097,8 +2326,11 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
1097
2326
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
1098
2327
 
1099
2328
  [deno-url]: https://github.com/stdlib-js/array-complex64/tree/deno
2329
+ [deno-readme]: https://github.com/stdlib-js/array-complex64/blob/deno/README.md
1100
2330
  [umd-url]: https://github.com/stdlib-js/array-complex64/tree/umd
2331
+ [umd-readme]: https://github.com/stdlib-js/array-complex64/blob/umd/README.md
1101
2332
  [esm-url]: https://github.com/stdlib-js/array-complex64/tree/esm
2333
+ [esm-readme]: https://github.com/stdlib-js/array-complex64/blob/esm/README.md
1102
2334
  [branches-url]: https://github.com/stdlib-js/array-complex64/blob/main/branches.md
1103
2335
 
1104
2336
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-complex64/main/LICENSE