@stdlib/strided-base 0.0.7 → 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.
@@ -16,27 +16,40 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /* tslint:disable:max-line-length */
22
22
  /* tslint:disable:max-file-line-count */
23
23
 
24
24
  import binary = require( '@stdlib/strided-base-binary' );
25
25
  import binaryAddonDispatch = require( '@stdlib/strided-base-binary-addon-dispatch' );
26
+ import binaryDtypeSignatures = require( '@stdlib/strided-base-binary-dtype-signatures' );
27
+ import binarySignatureCallbacks = require( '@stdlib/strided-base-binary-signature-callbacks' );
28
+ import cmap = require( '@stdlib/strided-base-cmap' );
26
29
  import dmap = require( '@stdlib/strided-base-dmap' );
27
30
  import dmap2 = require( '@stdlib/strided-base-dmap2' );
28
31
  import dmskmap = require( '@stdlib/strided-base-dmskmap' );
29
32
  import dmskmap2 = require( '@stdlib/strided-base-dmskmap2' );
30
33
  import dtypeEnum2Str = require( '@stdlib/strided-base-dtype-enum2str' );
31
34
  import dtypeResolveEnum = require( '@stdlib/strided-base-dtype-resolve-enum' );
35
+ import dtypeResolveStr = require( '@stdlib/strided-base-dtype-resolve-str' );
32
36
  import dtypeStr2Enum = require( '@stdlib/strided-base-dtype-str2enum' );
33
37
  import mapBy = require( '@stdlib/strided-base-map-by' );
34
38
  import mapBy2 = require( '@stdlib/strided-base-map-by2' );
39
+ import maxViewBufferIndex = require( '@stdlib/strided-base-max-view-buffer-index' );
35
40
  import metaDataProps = require( '@stdlib/strided-base-meta-data-props' );
41
+ import minViewBufferIndex = require( '@stdlib/strided-base-min-view-buffer-index' );
36
42
  import mskunary = require( '@stdlib/strided-base-mskunary' );
43
+ import mskunaryAddonDispatch = require( '@stdlib/strided-base-mskunary-addon-dispatch' );
44
+ import mskunaryDtypeSignatures = require( '@stdlib/strided-base-mskunary-dtype-signatures' );
45
+ import mskunarySignatureCallbacks = require( '@stdlib/strided-base-mskunary-signature-callbacks' );
37
46
  import nullary = require( '@stdlib/strided-base-nullary' );
47
+ import nullaryAddonDispatch = require( '@stdlib/strided-base-nullary-addon-dispatch' );
48
+ import offsetView = require( '@stdlib/strided-base-offset-view' );
38
49
  import quaternary = require( '@stdlib/strided-base-quaternary' );
39
50
  import quinary = require( '@stdlib/strided-base-quinary' );
51
+ import reinterpretComplex64 = require( '@stdlib/strided-base-reinterpret-complex64' );
52
+ import reinterpretComplex128 = require( '@stdlib/strided-base-reinterpret-complex128' );
40
53
  import smap = require( '@stdlib/strided-base-smap' );
41
54
  import smap2 = require( '@stdlib/strided-base-smap2' );
42
55
  import smskmap = require( '@stdlib/strided-base-smskmap' );
@@ -44,6 +57,10 @@ import smskmap2 = require( '@stdlib/strided-base-smskmap2' );
44
57
  import ternary = require( '@stdlib/strided-base-ternary' );
45
58
  import unary = require( '@stdlib/strided-base-unary' );
46
59
  import unaryAddonDispatch = require( '@stdlib/strided-base-unary-addon-dispatch' );
60
+ import unaryBy = require( '@stdlib/strided-base-unary-by' );
61
+ import unaryDtypeSignatures = require( '@stdlib/strided-base-unary-dtype-signatures' );
62
+ import unarySignatureCallbacks = require( '@stdlib/strided-base-unary-signature-callbacks' );
63
+ import zmap = require( '@stdlib/strided-base-zmap' );
47
64
 
48
65
  /**
49
66
  * Interface describing the `base` namespace.
@@ -141,6 +158,146 @@ interface Namespace {
141
158
  */
142
159
  binaryAddonDispatch: typeof binaryAddonDispatch;
143
160
 
161
+ /**
162
+ * Generates a list of binary interface signatures from strided array data types.
163
+ *
164
+ * ## Notes
165
+ *
166
+ * - The function returns a strided array having a stride length of `3` (i.e., every `3` elements define a binary interface signature).
167
+ * - For each signature (i.e., set of three consecutive non-overlapping strided array elements), the first two elements are the input data types and the third element is the return data type.
168
+ * - All signatures follow type promotion rules.
169
+ *
170
+ * @param dtypes1 - list of supported data types for the first argument
171
+ * @param dtypes2 - list of supported data types for the second argument
172
+ * @param dtypes3 - list of supported data types for the output
173
+ * @param options - options
174
+ * @param options.enums - boolean flag indicating whether to return signatures as a list of enumeration constants
175
+ * @throws must provide recognized data types
176
+ * @returns strided array containing binary interface signatures
177
+ *
178
+ * @example
179
+ * var dtypes = [
180
+ * 'float64',
181
+ * 'float32',
182
+ * 'int32',
183
+ * 'uint8'
184
+ * ];
185
+ *
186
+ * var sigs = ns.binaryDtypeSignatures( dtypes, dtypes, dtypes );
187
+ * // returns [ 'float32', 'float32', 'float32', ... ]
188
+ */
189
+ binaryDtypeSignatures: typeof binaryDtypeSignatures;
190
+
191
+ /**
192
+ * Assigns callbacks to binary interfaces according to type promotion rules.
193
+ *
194
+ * ## Notes
195
+ *
196
+ * - The function assumes that the provided signature array has the following properties:
197
+ *
198
+ * - a strided array having a stride length of `3` (i.e., every `3` elements define a binary interface signature).
199
+ * - for each signature (i.e., set of three consecutive non-overlapping strided array elements), the first two elements are the input data types and the third element is the return data type.
200
+ * - all signatures follow type promotion rules.
201
+ *
202
+ * @param table - callback table
203
+ * @param table.default - default callback
204
+ * @param table.complex64 - callback for single-precision complex floating-point numbers
205
+ * @param table.complex128 - callback for double-precision complex floating-point numbers
206
+ * @param signatures - strided array containing binary interface signatures
207
+ * @returns list of callbacks
208
+ *
209
+ * @example
210
+ * var signatures = require( `@stdlib/strided/base/binary-dtype-signatures` );
211
+ * var add = require( `@stdlib/math/base/ops/add` );
212
+ * var cadd = require( `@stdlib/math/base/ops/cadd` );
213
+ * var caddf = require( `@stdlib/math/base/ops/caddf` );
214
+ *
215
+ * var dtypes = [
216
+ * 'float64',
217
+ * 'float32',
218
+ * 'int32',
219
+ * 'uint8'
220
+ * ];
221
+ *
222
+ * var sigs = signatures( dtypes, dtypes, dtypes );
223
+ * // returns [...]
224
+ *
225
+ * var table = {
226
+ * 'default': add,
227
+ * 'complex64': caddf,
228
+ * 'complex128': cadd
229
+ * };
230
+ *
231
+ * var list = ns.binarySignatureCallbacks( table, sigs );
232
+ * // returns [...]
233
+ */
234
+ binarySignatureCallbacks: typeof binarySignatureCallbacks;
235
+
236
+ /**
237
+ * Applies a unary function to a single-precision complex floating-point strided input array and assigns results to a single-precision complex floating-point strided output array.
238
+ *
239
+ * @param N - number of indexed elements
240
+ * @param x - input array
241
+ * @param strideX - `x` stride length
242
+ * @param y - destination array
243
+ * @param strideY - `y` stride length
244
+ * @param fcn - unary function to apply
245
+ * @returns `y`
246
+ *
247
+ * @example
248
+ * var Complex64Array = require( `@stdlib/array/complex64` );
249
+ * var real = require( `@stdlib/complex/real` );
250
+ * var imag = require( `@stdlib/complex/imag` );
251
+ * var Complex64 = require( `@stdlib/complex/float32` );
252
+ *
253
+ * function scale( x ) {
254
+ * var re = real( x );
255
+ * var im = imag( x );
256
+ * return new Complex64( re*10.0, im*10.0 );
257
+ * }
258
+ *
259
+ * var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0 ] );
260
+ * var y = new Complex64Array( x.length );
261
+ *
262
+ * ns.cmap( x.length, x, 1, y, 1, scale );
263
+ *
264
+ * var v = y.get( 0 );
265
+ * // returns <Complex64>
266
+ *
267
+ * var re = real( v );
268
+ * // returns 10.0
269
+ *
270
+ * var im = imag( v );
271
+ * // returns 10.0
272
+ *
273
+ * @example
274
+ * var Complex64Array = require( `@stdlib/array/complex64` );
275
+ * var real = require( `@stdlib/complex/real` );
276
+ * var imag = require( `@stdlib/complex/imag` );
277
+ * var Complex64 = require( `@stdlib/complex/float32` );
278
+ *
279
+ * function scale( x ) {
280
+ * var re = real( x );
281
+ * var im = imag( x );
282
+ * return new Complex64( re*10.0, im*10.0 );
283
+ * }
284
+ *
285
+ * var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0 ] );
286
+ * var y = new Complex64Array( x.length );
287
+ *
288
+ * ns.cmap.ndarray( x.length, x, 1, 0, y, 1, 0, scale );
289
+ *
290
+ * var v = y.get( 0 );
291
+ * // returns <Complex64>
292
+ *
293
+ * var re = real( v );
294
+ * // returns 10.0
295
+ *
296
+ * var im = imag( v );
297
+ * // returns 10.0
298
+ */
299
+ cmap: typeof cmap;
300
+
144
301
  /**
145
302
  * Applies a unary function to a double-precision floating-point strided input array and assigns results to a double-precision floating-point strided output array.
146
303
  *
@@ -338,6 +495,20 @@ interface Namespace {
338
495
  */
339
496
  dtypeResolveEnum: typeof dtypeResolveEnum;
340
497
 
498
+ /**
499
+ * Returns the data type string associated with a strided array data type value.
500
+ *
501
+ * @param dtype - data type value
502
+ * @returns data type string
503
+ *
504
+ * @example
505
+ * var str2enum = require( `@stdlib/strided/base/dtype-str2enum` );
506
+ *
507
+ * var v = ns.dtypeResolveStr( str2enum( 'float64' ) );
508
+ * // returns 'float64'
509
+ */
510
+ dtypeResolveStr: typeof dtypeResolveStr;
511
+
341
512
  /**
342
513
  * Returns the enumeration constant associated with a strided array data type string.
343
514
  *
@@ -413,8 +584,9 @@ interface Namespace {
413
584
  * @example
414
585
  * var add = require( `@stdlib/math/base/ops/add` );
415
586
  *
416
- * function accessor( v1, v2 ) {
417
- * return [ v1*2.0, v2*2.0 ];
587
+ * function accessor( values ) {
588
+ * values[ 0 ] *= 2.0;
589
+ * values[ 1 ] *= 2.0;
418
590
  * }
419
591
  *
420
592
  * var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];
@@ -427,8 +599,9 @@ interface Namespace {
427
599
  * @example
428
600
  * var add = require( `@stdlib/math/base/ops/add` );
429
601
  *
430
- * function accessor( v1, v2 ) {
431
- * return [ v1*2.0, v2*2.0 ];
602
+ * function accessor( values ) {
603
+ * values[ 0 ] *= 2.0;
604
+ * values[ 1 ] *= 2.0;
432
605
  * }
433
606
  *
434
607
  * var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];
@@ -440,6 +613,20 @@ interface Namespace {
440
613
  */
441
614
  mapBy2: typeof mapBy2;
442
615
 
616
+ /**
617
+ * Returns the maximum accessible index based on a set of provided strided array parameters.
618
+ *
619
+ * @param N - number of indexed elements
620
+ * @param stride - stride length
621
+ * @param offset - starting index
622
+ * @returns maximum accessible index
623
+ *
624
+ * @example
625
+ * var idx = ns.maxViewBufferIndex( 3, 2, 10 );
626
+ * // returns 14
627
+ */
628
+ maxViewBufferIndex: typeof maxViewBufferIndex;
629
+
443
630
  /**
444
631
  * Defines non-enumerable read-only properties which expose strided array function meta data.
445
632
  *
@@ -475,6 +662,20 @@ interface Namespace {
475
662
  */
476
663
  metaDataProps: typeof metaDataProps;
477
664
 
665
+ /**
666
+ * Returns the minimum accessible index based on a set of provided strided array parameters.
667
+ *
668
+ * @param N - number of indexed elements
669
+ * @param stride - stride length
670
+ * @param offset - starting index
671
+ * @returns minimum accessible index
672
+ *
673
+ * @example
674
+ * var idx = ns.minViewBufferIndex( 3, -2, 10 );
675
+ * // returns 6
676
+ */
677
+ minViewBufferIndex: typeof minViewBufferIndex;
678
+
478
679
  /**
479
680
  * Applies a unary callback to elements in a strided input array according to elements in a strided mask array and assigns results to elements in a strided output array.
480
681
  *
@@ -526,6 +727,124 @@ interface Namespace {
526
727
  */
527
728
  mskunary: typeof mskunary;
528
729
 
730
+ /**
731
+ * Returns a function which dispatches to a native add-on applying a unary function to an input strided array according to a mask strided array.
732
+ *
733
+ * @param addon - add-on function
734
+ * @param fallback - fallback function
735
+ * @returns dispatch function
736
+ *
737
+ * @example
738
+ * function addon( N, dtypeX, x, strideX, dtypeMask, mask, strideMask, dtypeY, y, strideY ) {
739
+ * // Call into native add-on...
740
+ * }
741
+ *
742
+ * function fallback( N, dtypeX, x, strideX, dtypeMask, mask, strideMask, dtypeY, y, strideY ) {
743
+ * // Fallback JavaScript implementation...
744
+ * }
745
+ *
746
+ * // Create a ns.mskunaryAddonDispatch function:
747
+ * var f = ns.mskunaryAddonDispatch( addon, fallback );
748
+ *
749
+ * // ...
750
+ *
751
+ * // Invoke the ns.mskunaryAddonDispatch function with strided array arguments:
752
+ * f( 2, 'generic', [ 1, 2 ], 1, 'generic', [ 0, 0 ], 1, 'generic', [ 0, 0 ], 1 );
753
+ *
754
+ * @example
755
+ * function addon( N, dtypeX, x, strideX, dtypeMask, mask, strideMask, dtypeY, y, strideY ) {
756
+ * // Call into native add-on...
757
+ * }
758
+ *
759
+ * function fallback( N, dtypeX, x, strideX, offsetX, dtypeMask, mask, strideMask, offsetMask, dtypeY, y, strideY, offsetY ) {
760
+ * // Fallback JavaScript implementation...
761
+ * }
762
+ *
763
+ * // Create a ns.mskunaryAddonDispatch function:
764
+ * var f = ns.mskunaryAddonDispatch.ndarray( addon, fallback );
765
+ *
766
+ * // ...
767
+ *
768
+ * // Invoke the ns.mskunaryAddonDispatch function with strided array arguments:
769
+ * f( 2, 'generic', [ 1, 2 ], 1, 0, 'generic', [ 0, 0 ], 1, 0, 'generic', [ 0, 0 ], 1, 0 );
770
+ */
771
+ mskunaryAddonDispatch: typeof mskunaryAddonDispatch;
772
+
773
+ /**
774
+ * Generates a list of masked unary interface signatures from strided array data types.
775
+ *
776
+ * ## Notes
777
+ *
778
+ * - The function returns a strided array having a stride length of `3` (i.e., every `3` elements define a masked unary interface signature).
779
+ * - For each signature (i.e., set of three consecutive non-overlapping strided array elements), the first element is the input data type, the second element is the mask data type, and the last element is the return data type.
780
+ * - All signatures follow type promotion rules.
781
+ * - The mask array data type is always `uint8`.
782
+ *
783
+ * @param dtypes1 - list of supported data types for the first argument
784
+ * @param dtypes2 - list of supported data types for the output argument
785
+ * @param options - options
786
+ * @param options.enums - boolean flag indicating whether to return signatures as a list of enumeration constants
787
+ * @throws must provide recognized data types
788
+ * @returns strided array containing masked unary interface signatures
789
+ *
790
+ * @example
791
+ * var dtypes = [
792
+ * 'float64',
793
+ * 'float32',
794
+ * 'int32',
795
+ * 'uint8'
796
+ * ];
797
+ *
798
+ * var sigs = ns.mskunaryDtypeSignatures( dtypes, dtypes );
799
+ * // e.g., returns [ 'float32', 'uint8', 'float32', ... ]
800
+ */
801
+ mskunaryDtypeSignatures: typeof mskunaryDtypeSignatures;
802
+
803
+ /**
804
+ * Assigns callbacks to masked unary interfaces according to type promotion rules.
805
+ *
806
+ * ## Notes
807
+ *
808
+ * - The function assumes that the provided signature array has the following properties:
809
+ *
810
+ * - a strided array having a stride length of `3` (i.e., every `3` elements define a masked unary interface signature).
811
+ * - for each signature (i.e., set of three consecutive non-overlapping strided array elements), the first element is the input data type, the second element is the mask data type, and the last element is the return data type.
812
+ * - all signatures (excluding the mask data type) follow type promotion rules.
813
+ *
814
+ * @param table - callback table
815
+ * @param table.default - default callback
816
+ * @param table.complex64 - callback for single-precision complex floating-point numbers
817
+ * @param table.complex128 - callback for double-precision complex floating-point numbers
818
+ * @param signatures - strided array containing masked unary interface signatures
819
+ * @returns list of callbacks
820
+ *
821
+ * @example
822
+ * var signatures = require( `@stdlib/strided/base/mskunary-dtype-signatures` );
823
+ * var identity = require( `@stdlib/math/base/special/identity` );
824
+ * var cidentity = require( `@stdlib/math/base/special/cidentity` );
825
+ * var cidentityf = require( `@stdlib/math/base/special/cidentityf` );
826
+ *
827
+ * var dtypes = [
828
+ * 'float64',
829
+ * 'float32',
830
+ * 'int32',
831
+ * 'uint8'
832
+ * ];
833
+ *
834
+ * var sigs = signatures( dtypes, dtypes );
835
+ * // returns [...]
836
+ *
837
+ * var table = {
838
+ * 'default': identity,
839
+ * 'complex64': cidentityf,
840
+ * 'complex128': cidentity
841
+ * };
842
+ *
843
+ * var list = ns.mskunarySignatureCallbacks( table, sigs );
844
+ * // returns [...]
845
+ */
846
+ mskunarySignatureCallbacks: typeof mskunarySignatureCallbacks;
847
+
529
848
  /**
530
849
  * Applies a nullary callback and assigns results to elements in a strided output array.
531
850
  *
@@ -571,6 +890,68 @@ interface Namespace {
571
890
  */
572
891
  nullary: typeof nullary;
573
892
 
893
+ /**
894
+ * Returns a function which dispatches to a native add-on applying a nullary function.
895
+ *
896
+ * @param addon - add-on function
897
+ * @param fallback - fallback function
898
+ * @returns dispatch function
899
+ *
900
+ * @example
901
+ * function addon( N, dtypeX, x, strideX ) {
902
+ * // Call into native add-on...
903
+ * }
904
+ *
905
+ * function fallback( N, dtypeX, x, strideX ) {
906
+ * // Fallback JavaScript implementation...
907
+ * }
908
+ *
909
+ * // Create a ns.nullaryAddonDispatch function:
910
+ * var f = ns.nullaryAddonDispatch( addon, fallback );
911
+ *
912
+ * // ...
913
+ *
914
+ * // Invoke the ns.nullaryAddonDispatch function with strided array arguments:
915
+ * f( 2, 'generic', [ 1, 2 ], 1 );
916
+ *
917
+ * @example
918
+ * function addon( N, dtypeX, x, strideX ) {
919
+ * // Call into native add-on...
920
+ * }
921
+ *
922
+ * function fallback( N, dtypeX, x, strideX, offsetX ) {
923
+ * // Fallback JavaScript implementation...
924
+ * }
925
+ *
926
+ * // Create a ns.nullaryAddonDispatch function:
927
+ * var f = ns.nullaryAddonDispatch.ndarray( addon, fallback );
928
+ *
929
+ * // ...
930
+ *
931
+ * // Invoke the ns.nullaryAddonDispatch function with strided array arguments:
932
+ * f( 2, 'generic', [ 1, 2 ], 1, 0 );
933
+ */
934
+ nullaryAddonDispatch: typeof nullaryAddonDispatch;
935
+
936
+ /**
937
+ * Returns a typed array view having the same data type as a provided input typed array and starting at a specified index offset.
938
+ *
939
+ * @param x - input array
940
+ * @param offset - starting index
941
+ * @returns typed array view
942
+ *
943
+ * @example
944
+ * var Float64Array = require( `@stdlib/array/float64` );
945
+ *
946
+ * var x = new Float64Array( 10 );
947
+ *
948
+ * var out = ns.offsetView( x, 0 );
949
+ * // returns <Float64Array>
950
+ *
951
+ * var bool = ( out.buffer === x.buffer );
952
+ */
953
+ offsetView: typeof offsetView;
954
+
574
955
  /**
575
956
  * Applies a quaternary callback to strided input array elements and assigns results to elements in a strided output array.
576
957
  *
@@ -679,6 +1060,44 @@ interface Namespace {
679
1060
  */
680
1061
  quinary: typeof quinary;
681
1062
 
1063
+ /**
1064
+ * Reinterprets a `Complex64Array` as a `Float32Array`.
1065
+ *
1066
+ * @param x - input array
1067
+ * @param offset - starting index
1068
+ * @returns `Float32Array` view
1069
+ *
1070
+ * @example
1071
+ * var Complex64Array = require( `@stdlib/array/complex64` );
1072
+ *
1073
+ * var x = new Complex64Array( 10 );
1074
+ *
1075
+ * var out = ns.reinterpretComplex64( x, 0 );
1076
+ * // returns <Float32Array>
1077
+ *
1078
+ * var bool = ( out.buffer === x.buffer );
1079
+ */
1080
+ reinterpretComplex64: typeof reinterpretComplex64;
1081
+
1082
+ /**
1083
+ * Reinterprets a `Complex128Array` as a `Float64Array`.
1084
+ *
1085
+ * @param x - input array
1086
+ * @param offset - starting index
1087
+ * @returns `Float64Array` view
1088
+ *
1089
+ * @example
1090
+ * var Complex128Array = require( `@stdlib/array/complex128` );
1091
+ *
1092
+ * var x = new Complex128Array( 10 );
1093
+ *
1094
+ * var out = ns.reinterpretComplex128( x, 0 );
1095
+ * // returns <Float64Array>
1096
+ *
1097
+ * var bool = ( out.buffer === x.buffer );
1098
+ */
1099
+ reinterpretComplex128: typeof reinterpretComplex128;
1100
+
682
1101
  /**
683
1102
  * Applies a unary function to a single-precision floating-point strided input array and assigns results to a single-precision floating-point strided output array.
684
1103
  *
@@ -983,6 +1402,190 @@ interface Namespace {
983
1402
  * f( 2, 'generic', [ 1, 2 ], 1, 0, 'generic', [ 0, 0 ], 1, 0 );
984
1403
  */
985
1404
  unaryAddonDispatch: typeof unaryAddonDispatch;
1405
+
1406
+ /**
1407
+ * Applies a unary function to each element retrieved from a strided input array according to a callback function and assigns results to a strided output array.
1408
+ *
1409
+ * @param arrays - array-like object containing one input array and one output array
1410
+ * @param shape - array-like object containing a single element, the number of indexed elements
1411
+ * @param strides - array-like object containing the stride lengths for the input and output arrays
1412
+ * @param fcn - unary function to apply to callback return values
1413
+ * @param clbk - callback function
1414
+ * @param thisArg - callback execution context
1415
+ *
1416
+ * @example
1417
+ * var abs = require( `@stdlib/math/base/special/abs` );
1418
+ *
1419
+ * function accessor( v ) {
1420
+ * return v * 2.0;
1421
+ * }
1422
+ *
1423
+ * var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];
1424
+ * var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
1425
+ *
1426
+ * var shape = [ x.length ];
1427
+ * var strides = [ 1, 1 ];
1428
+ *
1429
+ * ns.unaryBy( [ x, y ], shape, strides, abs, accessor );
1430
+ * // y => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]
1431
+ *
1432
+ * @example
1433
+ * var abs = require( `@stdlib/math/base/special/abs` );
1434
+ *
1435
+ * function accessor( v ) {
1436
+ * return v * 2.0;
1437
+ * }
1438
+ *
1439
+ * var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];
1440
+ * var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
1441
+ *
1442
+ * var shape = [ x.length ];
1443
+ * var strides = [ 1, 1 ];
1444
+ * var offsets = [ 0, 0 ];
1445
+ *
1446
+ * ns.unaryBy.ndarray( [ x, y ], shape, strides, offsets, abs, accessor );
1447
+ * // y => [ 2.0, 4.0, 6.0, 8.0, 10.0 ]
1448
+ */
1449
+ unaryBy: typeof unaryBy;
1450
+
1451
+ /**
1452
+ * Generates a list of unary interface signatures from strided array data types.
1453
+ *
1454
+ * ## Notes
1455
+ *
1456
+ * - The function returns a strided array having a stride length of `2` (i.e., every `2` elements define a unary interface signature).
1457
+ * - For each signature (i.e., set of two consecutive non-overlapping strided array elements), the first element is the input data type and the second element is the return data type.
1458
+ * - All signatures follow type promotion rules.
1459
+ *
1460
+ * @param dtypes1 - list of supported data types for the first argument
1461
+ * @param dtypes2 - list of supported data types for the output argument
1462
+ * @param options - options
1463
+ * @param options.enums - boolean flag indicating whether to return signatures as a list of enumeration constants
1464
+ * @throws must provide recognized data types
1465
+ * @returns strided array containing unary interface signatures
1466
+ *
1467
+ * @example
1468
+ * var dtypes = [
1469
+ * 'float64',
1470
+ * 'float32',
1471
+ * 'int32',
1472
+ * 'uint8'
1473
+ * ];
1474
+ *
1475
+ * var sigs = ns.unaryDtypeSignatures( dtypes, dtypes );
1476
+ * // e.g., returns [ 'float32', 'float32', ... ]
1477
+ */
1478
+ unaryDtypeSignatures: typeof unaryDtypeSignatures;
1479
+
1480
+ /**
1481
+ * Assigns callbacks to unary interfaces according to type promotion rules.
1482
+ *
1483
+ * ## Notes
1484
+ *
1485
+ * - The function assumes that the provided signature array has the following properties:
1486
+ *
1487
+ * - a strided array having a stride length of `2` (i.e., every `2` elements define a unary interface signature).
1488
+ * - for each signature (i.e., set of two consecutive non-overlapping strided array elements), the first element is the input data type and the second element is the return data type.
1489
+ * - all signatures follow type promotion rules.
1490
+ *
1491
+ * @param table - callback table
1492
+ * @param table.default - default callback
1493
+ * @param table.complex64 - callback for single-precision complex floating-point numbers
1494
+ * @param table.complex128 - callback for double-precision complex floating-point numbers
1495
+ * @param signatures - strided array containing unary interface signatures
1496
+ * @returns list of callbacks
1497
+ *
1498
+ * @example
1499
+ * var signatures = require( `@stdlib/strided/base/unary-dtype-signatures` );
1500
+ * var identity = require( `@stdlib/math/base/special/identity` );
1501
+ * var cidentity = require( `@stdlib/math/base/special/cidentity` );
1502
+ * var cidentityf = require( `@stdlib/math/base/special/cidentityf` );
1503
+ *
1504
+ * var dtypes = [
1505
+ * 'float64',
1506
+ * 'float32',
1507
+ * 'int32',
1508
+ * 'uint8'
1509
+ * ];
1510
+ *
1511
+ * var sigs = signatures( dtypes, dtypes );
1512
+ * // returns [...]
1513
+ *
1514
+ * var table = {
1515
+ * 'default': identity,
1516
+ * 'complex64': cidentityf,
1517
+ * 'complex128': cidentity
1518
+ * };
1519
+ *
1520
+ * var list = ns.unarySignatureCallbacks( table, sigs );
1521
+ * // returns [...]
1522
+ */
1523
+ unarySignatureCallbacks: typeof unarySignatureCallbacks;
1524
+
1525
+ /**
1526
+ * Applies a unary function to a double-precision complex floating-point strided input array and assigns results to a double-precision complex floating-point strided output array.
1527
+ *
1528
+ * @param N - number of indexed elements
1529
+ * @param x - input array
1530
+ * @param strideX - `x` stride length
1531
+ * @param y - destination array
1532
+ * @param strideY - `y` stride length
1533
+ * @param fcn - unary function to apply
1534
+ * @returns `y`
1535
+ *
1536
+ * @example
1537
+ * var Complex128Array = require( `@stdlib/array/complex128` );
1538
+ * var real = require( `@stdlib/complex/real` );
1539
+ * var imag = require( `@stdlib/complex/imag` );
1540
+ * var Complex128 = require( `@stdlib/complex/float64` );
1541
+ *
1542
+ * function scale( x ) {
1543
+ * var re = real( x );
1544
+ * var im = imag( x );
1545
+ * return new Complex128( re*10.0, im*10.0 );
1546
+ * }
1547
+ *
1548
+ * var x = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0 ] );
1549
+ * var y = new Complex128Array( x.length );
1550
+ *
1551
+ * ns.zmap( x.length, x, 1, y, 1, scale );
1552
+ *
1553
+ * var v = y.get( 0 );
1554
+ * // returns <Complex128>
1555
+ *
1556
+ * var re = real( v );
1557
+ * // returns 10.0
1558
+ *
1559
+ * var im = imag( v );
1560
+ * // returns 10.0
1561
+ *
1562
+ * @example
1563
+ * var Complex128Array = require( `@stdlib/array/complex128` );
1564
+ * var real = require( `@stdlib/complex/real` );
1565
+ * var imag = require( `@stdlib/complex/imag` );
1566
+ * var Complex128 = require( `@stdlib/complex/float64` );
1567
+ *
1568
+ * function scale( x ) {
1569
+ * var re = real( x );
1570
+ * var im = imag( x );
1571
+ * return new Complex128( re*10.0, im*10.0 );
1572
+ * }
1573
+ *
1574
+ * var x = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0 ] );
1575
+ * var y = new Complex128Array( x.length );
1576
+ *
1577
+ * ns.zmap.ndarray( x.length, x, 1, 0, y, 1, 0, scale );
1578
+ *
1579
+ * var v = y.get( 0 );
1580
+ * // returns <Complex128>
1581
+ *
1582
+ * var re = real( v );
1583
+ * // returns 10.0
1584
+ *
1585
+ * var im = imag( v );
1586
+ * // returns 10.0
1587
+ */
1588
+ zmap: typeof zmap;
986
1589
  }
987
1590
 
988
1591
  /**