@stdlib/strided-base 0.0.6 → 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,23 +16,51 @@
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
+ 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' );
25
29
  import dmap = require( '@stdlib/strided-base-dmap' );
30
+ import dmap2 = require( '@stdlib/strided-base-dmap2' );
26
31
  import dmskmap = require( '@stdlib/strided-base-dmskmap' );
32
+ import dmskmap2 = require( '@stdlib/strided-base-dmskmap2' );
33
+ import dtypeEnum2Str = require( '@stdlib/strided-base-dtype-enum2str' );
34
+ import dtypeResolveEnum = require( '@stdlib/strided-base-dtype-resolve-enum' );
35
+ import dtypeResolveStr = require( '@stdlib/strided-base-dtype-resolve-str' );
36
+ import dtypeStr2Enum = require( '@stdlib/strided-base-dtype-str2enum' );
27
37
  import mapBy = require( '@stdlib/strided-base-map-by' );
38
+ import mapBy2 = require( '@stdlib/strided-base-map-by2' );
39
+ import maxViewBufferIndex = require( '@stdlib/strided-base-max-view-buffer-index' );
40
+ import metaDataProps = require( '@stdlib/strided-base-meta-data-props' );
41
+ import minViewBufferIndex = require( '@stdlib/strided-base-min-view-buffer-index' );
28
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' );
29
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' );
30
49
  import quaternary = require( '@stdlib/strided-base-quaternary' );
31
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' );
32
53
  import smap = require( '@stdlib/strided-base-smap' );
54
+ import smap2 = require( '@stdlib/strided-base-smap2' );
33
55
  import smskmap = require( '@stdlib/strided-base-smskmap' );
56
+ import smskmap2 = require( '@stdlib/strided-base-smskmap2' );
34
57
  import ternary = require( '@stdlib/strided-base-ternary' );
35
58
  import unary = require( '@stdlib/strided-base-unary' );
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' );
36
64
 
37
65
  /**
38
66
  * Interface describing the `base` namespace.
@@ -88,7 +116,190 @@ interface Namespace {
88
116
  binary: typeof binary;
89
117
 
90
118
  /**
91
- * Applies a unary function accepting and returning double-precision floating-point numbers to each element in a double-precision floating-point strided input array and assigns each result to an element in a double-precision floating-point strided output array.
119
+ * Returns a function which dispatches to a native add-on applying a unary function to two input strided arrays.
120
+ *
121
+ * @param addon - add-on function
122
+ * @param fallback - fallback function
123
+ * @returns dispatch function
124
+ *
125
+ * @example
126
+ * function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {
127
+ * // Call into native add-on...
128
+ * }
129
+ *
130
+ * function fallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {
131
+ * // Fallback JavaScript implementation...
132
+ * }
133
+ *
134
+ * // Create a ns.binaryAddonDispatch function:
135
+ * var f = ns.binaryAddonDispatch( addon, fallback );
136
+ *
137
+ * // ...
138
+ *
139
+ * // Invoke the ns.binaryAddonDispatch function with strided array arguments:
140
+ * f( 2, 'generic', [ 1, 2 ], 1, 'generic', [ 3, 4 ], 1, 'generic', [ 0, 0 ], 1 );
141
+ *
142
+ * @example
143
+ * function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {
144
+ * // Call into native add-on...
145
+ * }
146
+ *
147
+ * function fallback( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ ) {
148
+ * // Fallback JavaScript implementation...
149
+ * }
150
+ *
151
+ * // Create a ns.binaryAddonDispatch function:
152
+ * var f = ns.binaryAddonDispatch.ndarray( addon, fallback );
153
+ *
154
+ * // ...
155
+ *
156
+ * // Invoke the ns.binaryAddonDispatch function with strided array arguments:
157
+ * f( 2, 'generic', [ 1, 2 ], 1, 0, 'generic', [ 3, 4 ], 1, 0, 'generic', [ 0, 0 ], 1, 0 );
158
+ */
159
+ binaryAddonDispatch: typeof binaryAddonDispatch;
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
+
301
+ /**
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.
92
303
  *
93
304
  * @param N - number of indexed elements
94
305
  * @param x - input array
@@ -127,7 +338,44 @@ interface Namespace {
127
338
  dmap: typeof dmap;
128
339
 
129
340
  /**
130
- * Applies a unary function accepting and returning double-precision floating-point numbers to each element in a double-precision floating-point strided input array according to a corresponding element in a strided mask array and assigns each result to an element in a double-precision floating-point strided output array.
341
+ * Applies a binary function to double-precision floating-point strided input arrays and assigns results to a double-precision floating-point strided output array.
342
+ *
343
+ * @param N - number of indexed elements
344
+ * @param x - input array
345
+ * @param strideX - `x` stride length
346
+ * @param y - input array
347
+ * @param strideY - `y` stride length
348
+ * @param z - destination array
349
+ * @param strideZ - `z` stride length
350
+ * @param fcn - binary function to apply
351
+ * @returns `z`
352
+ *
353
+ * @example
354
+ * var Float64Array = require( `@stdlib/array/float64` );
355
+ * var add = require( `@stdlib/math/base/ops/add` );
356
+ *
357
+ * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
358
+ * var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
359
+ * var z = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
360
+ *
361
+ * ns.dmap2( x.length, x, 1, y, 1, z, 1, add );
362
+ * // z => <Float64Array>[ 2.0, 4.0, 6.0, 8.0, 10.0 ]
363
+ *
364
+ * @example
365
+ * var Float64Array = require( `@stdlib/array/float64` );
366
+ * var add = require( `@stdlib/math/base/ops/add` );
367
+ *
368
+ * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
369
+ * var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
370
+ * var z = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
371
+ *
372
+ * ns.dmap2.ndarray( x.length, x, 1, 0, y, 1, 0, z, 1, 0, add );
373
+ * // z => <Float64Array>[ 2.0, 4.0, 6.0, 8.0, 10.0 ]
374
+ */
375
+ dmap2: typeof dmap2;
376
+
377
+ /**
378
+ * Applies a unary function to a double-precision floating-point strided input array according to a strided mask array and assigns results to a double-precision floating-point strided output array.
131
379
  *
132
380
  * @param N - number of indexed elements
133
381
  * @param x - input array
@@ -172,7 +420,113 @@ interface Namespace {
172
420
  dmskmap: typeof dmskmap;
173
421
 
174
422
  /**
175
- * Applies a unary function to each element retrieved from a strided input array according to a callback function and assigns each result to an element in a strided output array.
423
+ * Applies a binary function to double-precision floating-point strided input arrays according to a strided mask array and assigns results to a double-precision floating-point strided output array
424
+ *
425
+ * @param N - number of indexed elements
426
+ * @param x - input array
427
+ * @param strideX - `x` stride length
428
+ * @param y - input array
429
+ * @param strideY - `y` stride length
430
+ * @param mask - mask array
431
+ * @param strideMask - `mask` stride length
432
+ * @param z - destination array
433
+ * @param strideZ - `z` stride length
434
+ * @param fcn - binary function to apply
435
+ * @returns `z`
436
+ *
437
+ * @example
438
+ * var Float64Array = require( `@stdlib/array/float64` );
439
+ * var Uint8Array = require( `@stdlib/array/uint8` );
440
+ * var add = require( `@stdlib/math/base/ops/add` );
441
+ *
442
+ * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
443
+ * var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
444
+ * var z = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
445
+ * var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );
446
+ *
447
+ * ns.dmskmap2( x.length, x, 1, m, 1, y, 1, add );
448
+ * // z => <Float64Array>[ 2.0, 4.0, 0.0, 8.0, 10.0 ]
449
+ *
450
+ * @example
451
+ * var Float64Array = require( `@stdlib/array/float64` );
452
+ * var Uint8Array = require( `@stdlib/array/uint8` );
453
+ * var add = require( `@stdlib/math/base/ops/add` );
454
+ *
455
+ * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
456
+ * var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
457
+ * var z = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
458
+ * var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );
459
+ *
460
+ * ns.dmskmap2.ndarray( x.length, x, 1, 0, y, 1, 0, m, 1, 0, z, 1, 0, add );
461
+ * // z => <Float64Array>[ 2.0, 4.0, 0.0, 8.0, 10.0 ]
462
+ */
463
+ dmskmap2: typeof dmskmap2;
464
+
465
+ /**
466
+ * Returns the data type string associated with a strided array data type enumeration constant.
467
+ *
468
+ * @param dtype - data type enumeration constant
469
+ * @returns data type string
470
+ *
471
+ * @example
472
+ * var str2enum = require( `@stdlib/strided/base/dtype-str2enum` );
473
+ *
474
+ * var v = str2enum( 'float64' );
475
+ * // returns <number>
476
+ *
477
+ * var dt = ns.dtypeEnum2Str( v );
478
+ * // returns 'float64'
479
+ */
480
+ dtypeEnum2Str: typeof dtypeEnum2Str;
481
+
482
+ /**
483
+ * Returns the enumeration constant associated with a strided array data type value.
484
+ *
485
+ * ## Notes
486
+ *
487
+ * - Downstream consumers of this function should **not** rely on specific integer values (e.g., `INT8 == 0`). Instead, the function should be used in an opaque manner.
488
+ *
489
+ * @param dtype - data type value
490
+ * @returns enumeration constant
491
+ *
492
+ * @example
493
+ * var v = ns.dtypeResolveEnum( 'float64' );
494
+ * // returns <number>
495
+ */
496
+ dtypeResolveEnum: typeof dtypeResolveEnum;
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
+
512
+ /**
513
+ * Returns the enumeration constant associated with a strided array data type string.
514
+ *
515
+ * ## Notes
516
+ *
517
+ * - Downstream consumers of this function should **not** rely on specific integer values (e.g., `INT8 == 0`). Instead, the function should be used in an opaque manner.
518
+ *
519
+ * @param dtype - data type string
520
+ * @returns enumeration constant
521
+ *
522
+ * @example
523
+ * var v = ns.dtypeStr2Enum( 'float64' );
524
+ * // returns <number>
525
+ */
526
+ dtypeStr2Enum: typeof dtypeStr2Enum;
527
+
528
+ /**
529
+ * 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.
176
530
  *
177
531
  * @param N - number of indexed elements
178
532
  * @param x - input array
@@ -212,6 +566,116 @@ interface Namespace {
212
566
  */
213
567
  mapBy: typeof mapBy;
214
568
 
569
+ /**
570
+ * Applies a binary function to each pair of elements retrieved from strided input arrays according to a callback function and assigns results to a strided output array
571
+ *
572
+ * @param N - number of indexed elements
573
+ * @param x - input array
574
+ * @param strideX - `x` stride length
575
+ * @param y - input array
576
+ * @param strideY - `y` stride length
577
+ * @param z - destination array
578
+ * @param strideZ - `z` stride length
579
+ * @param fcn - binary function to apply to callback return values
580
+ * @param clbk - callback function which returns an array-like object containing two values
581
+ * @param thisArg - callback execution context
582
+ * @returns `z`
583
+ *
584
+ * @example
585
+ * var add = require( `@stdlib/math/base/ops/add` );
586
+ *
587
+ * function accessor( values ) {
588
+ * values[ 0 ] *= 2.0;
589
+ * values[ 1 ] *= 2.0;
590
+ * }
591
+ *
592
+ * var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];
593
+ * var y = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
594
+ * var z = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
595
+ *
596
+ * ns.mapBy2( x.length, x, 1, y, 1, z, 1, add, accessor );
597
+ * // z => [ 4.0, 0.0, 12.0, 0.0, 20.0 ]
598
+ *
599
+ * @example
600
+ * var add = require( `@stdlib/math/base/ops/add` );
601
+ *
602
+ * function accessor( values ) {
603
+ * values[ 0 ] *= 2.0;
604
+ * values[ 1 ] *= 2.0;
605
+ * }
606
+ *
607
+ * var x = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];
608
+ * var y = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
609
+ * var z = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];
610
+ *
611
+ * ns.mapBy2.ndarray( x.length, x, 1, 0, y, 1, 0, z, 1, 0, add, accessor );
612
+ * // z => [ 4.0, 0.0, 12.0, 0.0, 20.0 ]
613
+ */
614
+ mapBy2: typeof mapBy2;
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
+
630
+ /**
631
+ * Defines non-enumerable read-only properties which expose strided array function meta data.
632
+ *
633
+ * @param meta - function meta data
634
+ * @param meta.nargs - total number of arguments (excluding offsets)
635
+ * @param meta.nin - total number of input arrays
636
+ * @param meta.nout - total number of output arrays
637
+ * @param dtypes - list of strided array data types
638
+ * @param obj - object on which to define properties
639
+ * @param bool - boolean indicating whether the provided object should describe an "ndarray" function interface
640
+ * @returns object on which properties were defined
641
+ *
642
+ * @example
643
+ * // Define strided array function meta data:
644
+ * var meta = {
645
+ * 'nargs': 7,
646
+ * 'nin': 1,
647
+ * 'nout': 1
648
+ * };
649
+ *
650
+ * // Define the list of strided array data types:
651
+ * var dtypes = [
652
+ * 'float64', 'float64',
653
+ * 'float32', 'float32',
654
+ * 'generic', 'generic'
655
+ * ];
656
+ *
657
+ * // Define an object/function on which to set the properties:
658
+ * var obj = {};
659
+ *
660
+ * // Set the properties:
661
+ * ns.metaDataProps( meta, dtypes, obj, false );
662
+ */
663
+ metaDataProps: typeof metaDataProps;
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
+
215
679
  /**
216
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.
217
681
  *
@@ -263,6 +727,124 @@ interface Namespace {
263
727
  */
264
728
  mskunary: typeof mskunary;
265
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
+
266
848
  /**
267
849
  * Applies a nullary callback and assigns results to elements in a strided output array.
268
850
  *
@@ -308,6 +890,68 @@ interface Namespace {
308
890
  */
309
891
  nullary: typeof nullary;
310
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
+
311
955
  /**
312
956
  * Applies a quaternary callback to strided input array elements and assigns results to elements in a strided output array.
313
957
  *
@@ -417,7 +1061,45 @@ interface Namespace {
417
1061
  quinary: typeof quinary;
418
1062
 
419
1063
  /**
420
- * Applies a unary function accepting and returning single-precision floating-point numbers to each element in a single-precision floating-point strided input array and assigns each result to an element in a single-precision floating-point strided output array.
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
+
1101
+ /**
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.
421
1103
  *
422
1104
  * @param N - number of indexed elements
423
1105
  * @param x - input array
@@ -456,7 +1138,44 @@ interface Namespace {
456
1138
  smap: typeof smap;
457
1139
 
458
1140
  /**
459
- * Applies a unary function accepting and returning single-precision floating-point numbers to each element in a single-precision floating-point strided input array according to a corresponding element in a strided mask array and assigns each result to an element in a single-precision floating-point strided output array.
1141
+ * Applies a binary function to single-precision floating-point strided input arrays and assigns results to a single-precision floating-point strided output array.
1142
+ *
1143
+ * @param N - number of indexed elements
1144
+ * @param x - input array
1145
+ * @param strideX - `x` stride length
1146
+ * @param y - input array
1147
+ * @param strideY - `y` stride length
1148
+ * @param z - destination array
1149
+ * @param strideZ - `z` stride length
1150
+ * @param fcn - binary function to apply
1151
+ * @returns `z`
1152
+ *
1153
+ * @example
1154
+ * var Float32Array = require( `@stdlib/array/float32` );
1155
+ * var addf = require( `@stdlib/math/base/ops/addf` );
1156
+ *
1157
+ * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
1158
+ * var y = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
1159
+ * var z = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
1160
+ *
1161
+ * ns.smap2( x.length, x, 1, y, 1, z, 1, addf );
1162
+ * // z => <Float32Array>[ 2.0, 4.0, 6.0, 8.0, 10.0 ]
1163
+ *
1164
+ * @example
1165
+ * var Float32Array = require( `@stdlib/array/float32` );
1166
+ * var addf = require( `@stdlib/math/base/ops/addf` );
1167
+ *
1168
+ * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
1169
+ * var y = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
1170
+ * var z = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
1171
+ *
1172
+ * ns.smap2.ndarray( x.length, x, 1, 0, y, 1, 0, z, 1, 0, addf );
1173
+ * // z => <Float32Array>[ 2.0, 4.0, 6.0, 8.0, 10.0 ]
1174
+ */
1175
+ smap2: typeof smap2;
1176
+
1177
+ /**
1178
+ * Applies a unary function to a single-precision floating-point strided input array according to a strided mask array and assigns results to a single-precision floating-point strided output array.
460
1179
  *
461
1180
  * @param N - number of indexed elements
462
1181
  * @param x - input array
@@ -500,6 +1219,49 @@ interface Namespace {
500
1219
  */
501
1220
  smskmap: typeof smskmap;
502
1221
 
1222
+ /**
1223
+ * Applies a binary function to single-precision floating-point strided input arrays according to a strided mask array and assigns results to a single-precision floating-point strided output array
1224
+ *
1225
+ * @param N - number of indexed elements
1226
+ * @param x - input array
1227
+ * @param strideX - `x` stride length
1228
+ * @param y - input array
1229
+ * @param strideY - `y` stride length
1230
+ * @param mask - mask array
1231
+ * @param strideMask - `mask` stride length
1232
+ * @param z - destination array
1233
+ * @param strideZ - `z` stride length
1234
+ * @param fcn - binary function to apply
1235
+ * @returns `z`
1236
+ *
1237
+ * @example
1238
+ * var Float32Array = require( `@stdlib/array/float32` );
1239
+ * var Uint8Array = require( `@stdlib/array/uint8` );
1240
+ * var addf = require( `@stdlib/math/base/ops/addf` );
1241
+ *
1242
+ * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
1243
+ * var y = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
1244
+ * var z = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
1245
+ * var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );
1246
+ *
1247
+ * ns.smskmap2( x.length, x, 1, m, 1, y, 1, addf );
1248
+ * // z => <Float32Array>[ 2.0, 4.0, 0.0, 8.0, 10.0 ]
1249
+ *
1250
+ * @example
1251
+ * var Float32Array = require( `@stdlib/array/float32` );
1252
+ * var Uint8Array = require( `@stdlib/array/uint8` );
1253
+ * var addf = require( `@stdlib/math/base/ops/addf` );
1254
+ *
1255
+ * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
1256
+ * var y = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
1257
+ * var z = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
1258
+ * var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );
1259
+ *
1260
+ * ns.smskmap2.ndarray( x.length, x, 1, 0, y, 1, 0, m, 1, 0, z, 1, 0, addf );
1261
+ * // z => <Float32Array>[ 2.0, 4.0, 0.0, 8.0, 10.0 ]
1262
+ */
1263
+ smskmap2: typeof smskmap2;
1264
+
503
1265
  /**
504
1266
  * Applies a ternary callback to strided input array elements and assigns results to elements in a strided output array.
505
1267
  *
@@ -597,6 +1359,233 @@ interface Namespace {
597
1359
  * // => <Float64Array>[ 10.0, 20.0, 30.0, 40.0, 50.0 ]
598
1360
  */
599
1361
  unary: typeof unary;
1362
+
1363
+ /**
1364
+ * Returns a function which dispatches to a native add-on applying a unary function to an input strided array.
1365
+ *
1366
+ * @param addon - add-on function
1367
+ * @param fallback - fallback function
1368
+ * @returns dispatch function
1369
+ *
1370
+ * @example
1371
+ * function addon( N, dtypeX, x, strideX, dtypeY, y, strideY ) {
1372
+ * // Call into native add-on...
1373
+ * }
1374
+ *
1375
+ * function fallback( N, dtypeX, x, strideX, dtypeY, y, strideY ) {
1376
+ * // Fallback JavaScript implementation...
1377
+ * }
1378
+ *
1379
+ * // Create a ns.unaryAddonDispatch function:
1380
+ * var f = ns.unaryAddonDispatch( addon, fallback );
1381
+ *
1382
+ * // ...
1383
+ *
1384
+ * // Invoke the ns.unaryAddonDispatch function with strided array arguments:
1385
+ * f( 2, 'generic', [ 1, 2 ], 1, 'generic', [ 0, 0 ], 1 );
1386
+ *
1387
+ * @example
1388
+ * function addon( N, dtypeX, x, strideX, dtypeY, y, strideY ) {
1389
+ * // Call into native add-on...
1390
+ * }
1391
+ *
1392
+ * function fallback( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY ) {
1393
+ * // Fallback JavaScript implementation...
1394
+ * }
1395
+ *
1396
+ * // Create a ns.unaryAddonDispatch function:
1397
+ * var f = ns.unaryAddonDispatch.ndarray( addon, fallback );
1398
+ *
1399
+ * // ...
1400
+ *
1401
+ * // Invoke the ns.unaryAddonDispatch function with strided array arguments:
1402
+ * f( 2, 'generic', [ 1, 2 ], 1, 0, 'generic', [ 0, 0 ], 1, 0 );
1403
+ */
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;
600
1589
  }
601
1590
 
602
1591
  /**