Skip to content

Commit 1c8caa2

Browse files
committed
Refactor to allow non-string dtype values
1 parent 0fa1ffc commit 1c8caa2

18 files changed

+55
-2334
lines changed

lib/node_modules/@stdlib/strided/dispatch/docs/types/index.d.ts

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ interface Dispatcher {
119119
* @param x - strided array
120120
* @param strideX - index increment for `x`
121121
* @throws first argument must be an integer
122-
* @throws input array data types must be strings
123-
* @throws output array data types must be strings
124122
* @throws input array arguments must be array-like objects
125123
* @throws output array arguments must be array-like objects
126124
* @throws input array strides must be integers
@@ -150,7 +148,7 @@ interface Dispatcher {
150148
* strided( x.length, 'float64', x, 1 );
151149
* // x => <Float64Array>[ 3.14, 3.14, 3.14, 3.14, 3.14 ]
152150
*/
153-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
151+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
154152

155153
/**
156154
* Invokes a strided array function based on the provided array data type(s) using alternative indexing semantics.
@@ -161,8 +159,6 @@ interface Dispatcher {
161159
* @param strideX - index increment for `x`
162160
* @param offsetX - starting index for `x`
163161
* @throws first argument must be an integer
164-
* @throws input array data types must be strings
165-
* @throws output array data types must be strings
166162
* @throws input array arguments must be array-like objects
167163
* @throws output array arguments must be array-like objects
168164
* @throws input array strides must be integers
@@ -194,7 +190,7 @@ interface Dispatcher {
194190
* strided( x.length, 'float64', x, 1, 0 );
195191
* // x => <Float64Array>[ 3.14, 3.14, 3.14, 3.14, 3.14 ]
196192
*/
197-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, offsetX: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length unified-signatures
193+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, offsetX: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length unified-signatures
198194

199195
/**
200196
* Invokes a strided array function based on the provided array data types.
@@ -207,8 +203,6 @@ interface Dispatcher {
207203
* @param y - strided array
208204
* @param strideY - index increment for `y`
209205
* @throws first argument must be an integer
210-
* @throws input array data types must be strings
211-
* @throws output array data types must be strings
212206
* @throws input array arguments must be array-like objects
213207
* @throws output array arguments must be array-like objects
214208
* @throws input array strides must be integers
@@ -236,7 +230,7 @@ interface Dispatcher {
236230
* strided( x.length, 'float64', x, 1, 'float64', y, 1 );
237231
* // y => <Float64Array>[ 1.0, 2.0, 3.0 ]
238232
*/
239-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, dtypeY: string, y: ArrayLike<any>, strideY: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
233+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, dtypeY: any, y: ArrayLike<any>, strideY: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
240234

241235
/**
242236
* Invokes a strided array function based on the provided array data types using alternative indexing semantics.
@@ -251,8 +245,6 @@ interface Dispatcher {
251245
* @param strideY - index increment for `y`
252246
* @param offsetY - starting index for `y`
253247
* @throws first argument must be an integer
254-
* @throws input array data types must be strings
255-
* @throws output array data types must be strings
256248
* @throws input array arguments must be array-like objects
257249
* @throws output array arguments must be array-like objects
258250
* @throws input array strides must be integers
@@ -282,7 +274,7 @@ interface Dispatcher {
282274
* strided( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0 );
283275
* // y => <Float64Array>[ 1.0, 2.0, 3.0 ]
284276
*/
285-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, offsetX: number, dtypeY: string, y: ArrayLike<any>, strideY: number, offsetY: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
277+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, offsetX: number, dtypeY: any, y: ArrayLike<any>, strideY: number, offsetY: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
286278

287279
/**
288280
* Invokes a strided array function based on the provided array data types.
@@ -298,8 +290,6 @@ interface Dispatcher {
298290
* @param z - strided array
299291
* @param strideZ - index increment for `z`
300292
* @throws first argument must be an integer
301-
* @throws input array data types must be strings
302-
* @throws output array data types must be strings
303293
* @throws input array arguments must be array-like objects
304294
* @throws output array arguments must be array-like objects
305295
* @throws input array strides must be integers
@@ -331,7 +321,7 @@ interface Dispatcher {
331321
* strided( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 );
332322
* // z => <Float64Array>[ 2.0, 4.0, 6.0 ]
333323
*/
334-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, dtypeY: string, y: ArrayLike<any>, strideY: number, dtypeZ: string, z: ArrayLike<any>, strideZ: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
324+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, dtypeY: any, y: ArrayLike<any>, strideY: number, dtypeZ: any, z: ArrayLike<any>, strideZ: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
335325

336326
/**
337327
* Invokes a strided array function based on the provided array data types using alternative indexing semantics.
@@ -350,8 +340,6 @@ interface Dispatcher {
350340
* @param strideZ - index increment for `z`
351341
* @param offsetZ - starting index for `z`
352342
* @throws first argument must be an integer
353-
* @throws input array data types must be strings
354-
* @throws output array data types must be strings
355343
* @throws input array arguments must be array-like objects
356344
* @throws output array arguments must be array-like objects
357345
* @throws input array strides must be integers
@@ -385,7 +373,7 @@ interface Dispatcher {
385373
* strided( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 );
386374
* // z => <Float64Array>[ 2.0, 4.0, 6.0 ]
387375
*/
388-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, offsetX: number, dtypeY: string, y: ArrayLike<any>, strideY: number, offsetY: number, dtypeZ: string, z: ArrayLike<any>, strideZ: number, offsetZ: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
376+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, offsetX: number, dtypeY: any, y: ArrayLike<any>, strideY: number, offsetY: number, dtypeZ: any, z: ArrayLike<any>, strideZ: number, offsetZ: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
389377

390378
/**
391379
* Invokes a strided array function based on the provided array data types.
@@ -404,8 +392,6 @@ interface Dispatcher {
404392
* @param w - strided array
405393
* @param strideW - index increment for `w`
406394
* @throws first argument must be an integer
407-
* @throws input array data types must be strings
408-
* @throws output array data types must be strings
409395
* @throws input array arguments must be array-like objects
410396
* @throws output array arguments must be array-like objects
411397
* @throws input array strides must be integers
@@ -438,7 +424,7 @@ interface Dispatcher {
438424
* strided( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1, 'float64', w, 1 );
439425
* // w => <Float64Array>[ 3.0, 6.0, 9.0 ]
440426
*/
441-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, dtypeY: string, y: ArrayLike<any>, strideY: number, dtypeZ: string, z: ArrayLike<any>, strideZ: number, dtypeW: string, w: ArrayLike<any>, strideW: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
427+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, dtypeY: any, y: ArrayLike<any>, strideY: number, dtypeZ: any, z: ArrayLike<any>, strideZ: number, dtypeW: any, w: ArrayLike<any>, strideW: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
442428

443429
/**
444430
* Invokes a strided array function based on the provided array data types using alternative indexing semantics.
@@ -461,8 +447,6 @@ interface Dispatcher {
461447
* @param strideW - index increment for `w`
462448
* @param offsetW - starting index for `w`
463449
* @throws first argument must be an integer
464-
* @throws input array data types must be strings
465-
* @throws output array data types must be strings
466450
* @throws input array arguments must be array-like objects
467451
* @throws output array arguments must be array-like objects
468452
* @throws input array strides must be integers
@@ -497,7 +481,7 @@ interface Dispatcher {
497481
* strided( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0, 'float64', w, 1, 0 );
498482
* // w => <Float64Array>[ 3.0, 6.0, 9.0 ]
499483
*/
500-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, offsetX: number, dtypeY: string, y: ArrayLike<any>, strideY: number, offsetY: number, dtypeZ: string, z: ArrayLike<any>, strideZ: number, offsetZ: number, dtypeW: string, w: ArrayLike<any>, strideW: number, offsetW: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
484+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, offsetX: number, dtypeY: any, y: ArrayLike<any>, strideY: number, offsetY: number, dtypeZ: any, z: ArrayLike<any>, strideZ: number, offsetZ: number, dtypeW: any, w: ArrayLike<any>, strideW: number, offsetW: number ): ArrayLike<any> | void; // tslint:disable-line:max-line-length
501485

502486
/**
503487
* Invokes a strided array function based on the provided array data types.
@@ -517,8 +501,6 @@ interface Dispatcher {
517501
* @param strideW - index increment for `w`
518502
* @param args - array arguments (arrays, strides, and offsets)
519503
* @throws first argument must be an integer
520-
* @throws input array data types must be strings
521-
* @throws output array data types must be strings
522504
* @throws input array arguments must be array-like objects
523505
* @throws output array arguments must be array-like objects
524506
* @throws input array strides must be integers
@@ -552,7 +534,7 @@ interface Dispatcher {
552534
* strided( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1, 'float64', w, 1, 'float64', u, 1 );
553535
* // u => <Float64Array>[ 4.0, 8.0, 12.0 ]
554536
*/
555-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, dtypeY: string, y: ArrayLike<any>, strideY: number, dtypeZ: string, z: ArrayLike<any>, strideZ: number, dtypeW: string, w: ArrayLike<any>, strideW: number, ...args: Array<ArrayLike<any> | number | string> ): ArrayLike<any> | void; // tslint:disable-line:max-line-length unified-signatures
537+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, dtypeY: any, y: ArrayLike<any>, strideY: number, dtypeZ: any, z: ArrayLike<any>, strideZ: number, dtypeW: any, w: ArrayLike<any>, strideW: number, ...args: Array<ArrayLike<any> | number | string> ): ArrayLike<any> | void; // tslint:disable-line:max-line-length unified-signatures
556538

557539
/**
558540
* Invokes a strided array function based on the provided array data types using alternative indexing semantics.
@@ -576,8 +558,6 @@ interface Dispatcher {
576558
* @param offsetW - starting index for `w`
577559
* @param args - array arguments (arrays, strides, and offsets)
578560
* @throws first argument must be an integer
579-
* @throws input array data types must be strings
580-
* @throws output array data types must be strings
581561
* @throws input array arguments must be array-like objects
582562
* @throws output array arguments must be array-like objects
583563
* @throws input array strides must be integers
@@ -611,7 +591,7 @@ interface Dispatcher {
611591
* strided( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0, 'float64', w, 1, 0, 'float64', u, 1, 0 );
612592
* // u => <Float64Array>[ 4.0, 8.0, 12.0 ]
613593
*/
614-
( N: number, dtypeX: string, x: ArrayLike<any>, strideX: number, offsetX: number, dtypeY: string, y: ArrayLike<any>, strideY: number, offsetY: number, dtypeZ: string, z: ArrayLike<any>, strideZ: number, offsetZ: number, dtypeW: string, w: ArrayLike<any>, strideW: number, offsetW: number, ...args: Array<ArrayLike<any> | number> ): ArrayLike<any> | void; // tslint:disable-line:max-line-length unified-signatures
594+
( N: number, dtypeX: any, x: ArrayLike<any>, strideX: number, offsetX: number, dtypeY: any, y: ArrayLike<any>, strideY: number, offsetY: number, dtypeZ: any, z: ArrayLike<any>, strideZ: number, offsetZ: number, dtypeW: any, w: ArrayLike<any>, strideW: number, offsetW: number, ...args: Array<ArrayLike<any> | number> ): ArrayLike<any> | void; // tslint:disable-line:max-line-length unified-signatures
615595
}
616596

617597
/**
@@ -624,7 +604,7 @@ interface Dispatcher {
624604
* @param nin - number of input strided arrays
625605
* @param nout - number of output strided arrays
626606
* @throws first argument must be either a function or an array of functions
627-
* @throws second argument must be an array of strings
607+
* @throws second argument must be an an array-like object
628608
* @throws third argument must be an array-like object or `null`
629609
* @throws third and first arguments must have the same number of elements
630610
* @throws fourth argument must be a positive integer
@@ -658,7 +638,7 @@ interface Dispatcher {
658638
* strided( x.length, 'float64', x, 1, 'float64', y, 1 );
659639
* // y => <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
660640
*/
661-
declare function dispatch( fcns: StridedArrayFcn | ArrayLike<StridedArrayFcn>, types: ArrayLike<string>, data: ArrayLike<any> | null, nargs: number, nin: number, nout: number ): Dispatcher; // tslint:disable-line:max-line-length
641+
declare function dispatch( fcns: StridedArrayFcn | ArrayLike<StridedArrayFcn>, types: ArrayLike<any>, data: ArrayLike<any> | null, nargs: number, nin: number, nout: number ): Dispatcher; // tslint:disable-line:max-line-length
662642

663643
/**
664644
* Returns a strided array function interface which performs multiple dispatch and supports alternative indexing semantics.
@@ -670,7 +650,7 @@ declare function dispatch( fcns: StridedArrayFcn | ArrayLike<StridedArrayFcn>, t
670650
* @param nin - number of input strided arrays
671651
* @param nout - number of output strided arrays
672652
* @throws first argument must be either a function or an array of functions
673-
* @throws second argument must be an array of strings
653+
* @throws second argument must be an array-like object
674654
* @throws third argument must be an array-like object or `null`
675655
* @throws third and first arguments must have the same number of elements
676656
* @throws fourth argument must be a positive integer
@@ -704,7 +684,7 @@ declare function dispatch( fcns: StridedArrayFcn | ArrayLike<StridedArrayFcn>, t
704684
* strided( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0 );
705685
* // y => <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
706686
*/
707-
declare function dispatch( fcns: StridedArrayFcnWithOffsets | ArrayLike<StridedArrayFcnWithOffsets>, types: ArrayLike<string>, data: ArrayLike<any> | null, nargs: number, nin: number, nout: number ): Dispatcher; // tslint:disable-line:max-line-length unified-signatures
687+
declare function dispatch( fcns: StridedArrayFcnWithOffsets | ArrayLike<StridedArrayFcnWithOffsets>, types: ArrayLike<any>, data: ArrayLike<any> | null, nargs: number, nin: number, nout: number ): Dispatcher; // tslint:disable-line:max-line-length unified-signatures
708688

709689

710690
// EXPORTS //

0 commit comments

Comments
 (0)