@stdlib/strided-base-binary-addon-dispatch 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CITATION.cff +30 -0
- package/LICENSE +0 -304
- package/NOTICE +1 -1
- package/README.md +23 -11
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +9 -9
- package/lib/index.js +7 -0
- package/lib/main.js +172 -6
- package/lib/ndarray.js +7 -6
- package/package.json +24 -22
- package/docs/repl.txt +0 -179
- package/docs/types/test.ts +0 -475
- package/lib/binary.js +0 -200
package/docs/types/test.ts
DELETED
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/// <reference types="@stdlib/types"/>
|
|
20
|
-
|
|
21
|
-
import { Collection } from '@stdlib/types/object';
|
|
22
|
-
import dispatch = require( './index' );
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// FUNCTIONS //
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Add-on function.
|
|
29
|
-
*
|
|
30
|
-
* @param N - number of indexed elements
|
|
31
|
-
* @param dtypeX - `x` data type (enumeration constant)
|
|
32
|
-
* @param x - input array
|
|
33
|
-
* @param strideX - `x` stride length
|
|
34
|
-
* @param dtypeY - `y` data type (enumeration constant)
|
|
35
|
-
* @param y - input array
|
|
36
|
-
* @param strideY - `y` stride length
|
|
37
|
-
* @param dtypeZ - `z` data type (enumeration constant)
|
|
38
|
-
* @param z - output array
|
|
39
|
-
* @param strideZ - `z` stride length
|
|
40
|
-
*/
|
|
41
|
-
function addon( N: number, dtypeX: number, x: Collection, strideX: number, dtypeY: number, y: Collection, strideY: number, dtypeZ: number, z: Collection, strideZ: number ): void { // tslint:disable-line:max-line-length
|
|
42
|
-
let i;
|
|
43
|
-
if ( dtypeX !== dtypeY || dtypeY !== dtypeZ ) {
|
|
44
|
-
throw new Error( 'beep' );
|
|
45
|
-
}
|
|
46
|
-
for ( i = 0; i < N; i += 1 ) {
|
|
47
|
-
z[ i * strideZ ] = x[ i * strideX ] + y[ i * strideY ]; // tslint:disable-line:restrict-plus-operands no-unsafe-any
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Fallback function.
|
|
53
|
-
*
|
|
54
|
-
* @param N - number of indexed elements
|
|
55
|
-
* @param dtypeX - `x` data type
|
|
56
|
-
* @param x - input array
|
|
57
|
-
* @param strideX - `x` stride length
|
|
58
|
-
* @param dtypeY - `y` data type
|
|
59
|
-
* @param y - input array
|
|
60
|
-
* @param strideY - `y` stride length
|
|
61
|
-
* @param dtypeZ - `z` data type
|
|
62
|
-
* @param z - output array
|
|
63
|
-
* @param strideZ - `z` stride length
|
|
64
|
-
*/
|
|
65
|
-
function fallback( N: number, dtypeX: any, x: Collection, strideX: number, dtypeY: any, y: Collection, strideY: number, dtypeZ: number, z: Collection, strideZ: number ): void { // tslint:disable-line:max-line-length
|
|
66
|
-
let i;
|
|
67
|
-
if ( dtypeX !== dtypeY || dtypeY !== dtypeZ ) {
|
|
68
|
-
throw new Error( 'beep' );
|
|
69
|
-
}
|
|
70
|
-
for ( i = 0; i < N; i += 1 ) {
|
|
71
|
-
z[ i * strideZ ] = x[ i * strideX ] + y[ i * strideY ]; // tslint:disable-line:restrict-plus-operands no-unsafe-any
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Fallback function with alternative indexing semantics.
|
|
77
|
-
*
|
|
78
|
-
* @param N - number of indexed elements
|
|
79
|
-
* @param dtypeX - `x` data type
|
|
80
|
-
* @param x - input array
|
|
81
|
-
* @param strideX - `x` stride length
|
|
82
|
-
* @param offsetX - starting `x` index
|
|
83
|
-
* @param dtypeY - `y` data type
|
|
84
|
-
* @param y - input array
|
|
85
|
-
* @param strideY - `y` stride length
|
|
86
|
-
* @param offsetY - starting `y` index
|
|
87
|
-
* @param dtypeZ - `z` data type
|
|
88
|
-
* @param z - output array
|
|
89
|
-
* @param strideZ - `z` stride length
|
|
90
|
-
* @param offsetZ - starting `z` index
|
|
91
|
-
*/
|
|
92
|
-
function fallbackWithOffsets( N: number, dtypeX: any, x: Collection, strideX: number, offsetX: number, dtypeY: any, y: Collection, strideY: number, offsetY: number, dtypeZ: any, z: Collection, strideZ: number, offsetZ: number ): void { // tslint:disable-line:max-line-length
|
|
93
|
-
let i;
|
|
94
|
-
if ( dtypeX !== dtypeY || dtypeY !== dtypeZ ) {
|
|
95
|
-
throw new Error( 'beep' );
|
|
96
|
-
}
|
|
97
|
-
for ( i = 0; i < N; i += 1 ) {
|
|
98
|
-
z[ offsetZ + ( i * strideZ ) ] = x[ offsetX + ( i * strideX ) ] + y[ offsetY + ( i * strideY ) ]; // tslint:disable-line:max-line-length restrict-plus-operands no-unsafe-any
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// TESTS //
|
|
104
|
-
|
|
105
|
-
// The function returns a dispatch function...
|
|
106
|
-
{
|
|
107
|
-
dispatch( addon, fallback ); // $ExpectType Dispatcher
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// The compiler throws an error if not provided a first argument which is an add-on function...
|
|
111
|
-
{
|
|
112
|
-
dispatch( '10', fallback ); // $ExpectError
|
|
113
|
-
dispatch( 10, fallback ); // $ExpectError
|
|
114
|
-
dispatch( true, fallback ); // $ExpectError
|
|
115
|
-
dispatch( false, fallback ); // $ExpectError
|
|
116
|
-
dispatch( null, fallback ); // $ExpectError
|
|
117
|
-
dispatch( undefined, fallback ); // $ExpectError
|
|
118
|
-
dispatch( [], fallback ); // $ExpectError
|
|
119
|
-
dispatch( {}, fallback ); // $ExpectError
|
|
120
|
-
dispatch( ( x: string ): string => x, fallback ); // $ExpectError
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// The compiler throws an error if not provided a second argument which is a fallback function...
|
|
124
|
-
{
|
|
125
|
-
dispatch( addon, '10' ); // $ExpectError
|
|
126
|
-
dispatch( addon, 10 ); // $ExpectError
|
|
127
|
-
dispatch( addon, true ); // $ExpectError
|
|
128
|
-
dispatch( addon, false ); // $ExpectError
|
|
129
|
-
dispatch( addon, null ); // $ExpectError
|
|
130
|
-
dispatch( addon, undefined ); // $ExpectError
|
|
131
|
-
dispatch( addon, [] ); // $ExpectError
|
|
132
|
-
dispatch( addon, {} ); // $ExpectError
|
|
133
|
-
dispatch( addon, ( x: string ): string => x ); // $ExpectError
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// The returned function returns a collection...
|
|
137
|
-
{
|
|
138
|
-
const x = new Float64Array( 10 );
|
|
139
|
-
const y = new Float64Array( x.length );
|
|
140
|
-
const z = new Float64Array( x.length );
|
|
141
|
-
|
|
142
|
-
const f = dispatch( addon, fallback );
|
|
143
|
-
|
|
144
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectType Collection
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// The compiler throws an error if the returned function is not provided a first argument which is a number...
|
|
148
|
-
{
|
|
149
|
-
const x = new Float64Array( 10 );
|
|
150
|
-
const y = new Float64Array( x.length );
|
|
151
|
-
const z = new Float64Array( x.length );
|
|
152
|
-
|
|
153
|
-
const f = dispatch( addon, fallback );
|
|
154
|
-
|
|
155
|
-
f( '10', 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
156
|
-
f( true, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
157
|
-
f( false, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
158
|
-
f( null, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
159
|
-
f( undefined, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
160
|
-
f( [], 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
161
|
-
f( {}, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
162
|
-
f( ( x: number ): number => x, 'float64', x, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// The compiler throws an error if the returned function is not provided a third argument which is a collection...
|
|
166
|
-
{
|
|
167
|
-
const x = new Float64Array( 10 );
|
|
168
|
-
const y = new Float64Array( x.length );
|
|
169
|
-
const z = new Float64Array( x.length );
|
|
170
|
-
|
|
171
|
-
const f = dispatch( addon, fallback );
|
|
172
|
-
|
|
173
|
-
f( x.length, 'float64', true, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
174
|
-
f( x.length, 'float64', false, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
175
|
-
f( x.length, 'float64', null, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
176
|
-
f( x.length, 'float64', undefined, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
177
|
-
f( x.length, 'float64', {}, 1, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// The compiler throws an error if the returned function is not provided a fourth argument which is a number...
|
|
181
|
-
{
|
|
182
|
-
const x = new Float64Array( 10 );
|
|
183
|
-
const y = new Float64Array( x.length );
|
|
184
|
-
const z = new Float64Array( x.length );
|
|
185
|
-
|
|
186
|
-
const f = dispatch( addon, fallback );
|
|
187
|
-
|
|
188
|
-
f( x.length, 'float64', x, '10', 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
189
|
-
f( x.length, 'float64', x, true, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
190
|
-
f( x.length, 'float64', x, false, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
191
|
-
f( x.length, 'float64', x, null, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
192
|
-
f( x.length, 'float64', x, undefined, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
193
|
-
f( x.length, 'float64', x, [], 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
194
|
-
f( x.length, 'float64', x, {}, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
195
|
-
f( x.length, 'float64', x, ( x: number ): number => x, 'float64', y, 1, 'float64', z, 1 ); // $ExpectError
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// The compiler throws an error if the returned function is not provided a sixth argument which is a collection...
|
|
199
|
-
{
|
|
200
|
-
const x = new Float64Array( 10 );
|
|
201
|
-
const y = new Float64Array( x.length );
|
|
202
|
-
const z = new Float64Array( x.length );
|
|
203
|
-
|
|
204
|
-
const f = dispatch( addon, fallback );
|
|
205
|
-
|
|
206
|
-
f( y.length, 'float64', x, 1, 'float64', true, 1, 'float64', z, 1 ); // $ExpectError
|
|
207
|
-
f( y.length, 'float64', x, 1, 'float64', false, 1, 'float64', z, 1 ); // $ExpectError
|
|
208
|
-
f( y.length, 'float64', x, 1, 'float64', null, 1, 'float64', z, 1 ); // $ExpectError
|
|
209
|
-
f( y.length, 'float64', x, 1, 'float64', undefined, 1, 'float64', z, 1 ); // $ExpectError
|
|
210
|
-
f( y.length, 'float64', x, 1, 'float64', {}, 1, 'float64', z, 1 ); // $ExpectError
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// The compiler throws an error if the returned function is not provided a seventh argument which is a number...
|
|
214
|
-
{
|
|
215
|
-
const x = new Float64Array( 10 );
|
|
216
|
-
const y = new Float64Array( x.length );
|
|
217
|
-
const z = new Float64Array( x.length );
|
|
218
|
-
|
|
219
|
-
const f = dispatch( addon, fallback );
|
|
220
|
-
|
|
221
|
-
f( x.length, 'float64', x, 1, 'float64', y, '10', 'float64', z, 1 ); // $ExpectError
|
|
222
|
-
f( x.length, 'float64', x, 1, 'float64', y, true, 'float64', z, 1 ); // $ExpectError
|
|
223
|
-
f( x.length, 'float64', x, 1, 'float64', y, false, 'float64', z, 1 ); // $ExpectError
|
|
224
|
-
f( x.length, 'float64', x, 1, 'float64', y, null, 'float64', z, 1 ); // $ExpectError
|
|
225
|
-
f( x.length, 'float64', x, 1, 'float64', y, undefined, 'float64', z, 1 ); // $ExpectError
|
|
226
|
-
f( x.length, 'float64', x, 1, 'float64', y, [], 'float64', z, 1 ); // $ExpectError
|
|
227
|
-
f( x.length, 'float64', x, 1, 'float64', y, {}, 'float64', z, 1 ); // $ExpectError
|
|
228
|
-
f( x.length, 'float64', x, 1, 'float64', y, ( x: number ): number => x, 'float64', z, 1 ); // $ExpectError
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// The compiler throws an error if the returned function is not provided a ninth argument which is a collection...
|
|
232
|
-
{
|
|
233
|
-
const x = new Float64Array( 10 );
|
|
234
|
-
const y = new Float64Array( x.length );
|
|
235
|
-
const z = new Float64Array( x.length );
|
|
236
|
-
|
|
237
|
-
const f = dispatch( addon, fallback );
|
|
238
|
-
|
|
239
|
-
f( z.length, 'float64', x, 1, 'float64', y, 1, 'float64', true, 1 ); // $ExpectError
|
|
240
|
-
f( z.length, 'float64', x, 1, 'float64', y, 1, 'float64', false, 1 ); // $ExpectError
|
|
241
|
-
f( z.length, 'float64', x, 1, 'float64', y, 1, 'float64', null, 1 ); // $ExpectError
|
|
242
|
-
f( z.length, 'float64', x, 1, 'float64', y, 1, 'float64', undefined, 1 ); // $ExpectError
|
|
243
|
-
f( z.length, 'float64', x, 1, 'float64', y, 1, 'float64', {}, 1 ); // $ExpectError
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// The compiler throws an error if the returned function is not provided a tenth argument which is a number...
|
|
247
|
-
{
|
|
248
|
-
const x = new Float64Array( 10 );
|
|
249
|
-
const y = new Float64Array( x.length );
|
|
250
|
-
const z = new Float64Array( x.length );
|
|
251
|
-
|
|
252
|
-
const f = dispatch( addon, fallback );
|
|
253
|
-
|
|
254
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, '10' ); // $ExpectError
|
|
255
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, true ); // $ExpectError
|
|
256
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, false ); // $ExpectError
|
|
257
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, null ); // $ExpectError
|
|
258
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, undefined ); // $ExpectError
|
|
259
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, [] ); // $ExpectError
|
|
260
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, {} ); // $ExpectError
|
|
261
|
-
f( x.length, 'float64', x, 1, 'float64', y, 1, 'float64', z, ( x: number ): number => x ); // $ExpectError
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Attached to the main export is an `ndarray` method which returns a dispatch function...
|
|
265
|
-
{
|
|
266
|
-
dispatch.ndarray( addon, fallbackWithOffsets ); // $ExpectType DispatcherWithOffsets
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// The compiler throws an error if the `ndarray` method is not provided a first argument which is an add-on function...
|
|
270
|
-
{
|
|
271
|
-
dispatch.ndarray( '10', fallbackWithOffsets ); // $ExpectError
|
|
272
|
-
dispatch.ndarray( 10, fallbackWithOffsets ); // $ExpectError
|
|
273
|
-
dispatch.ndarray( true, fallbackWithOffsets ); // $ExpectError
|
|
274
|
-
dispatch.ndarray( false, fallbackWithOffsets ); // $ExpectError
|
|
275
|
-
dispatch.ndarray( null, fallbackWithOffsets ); // $ExpectError
|
|
276
|
-
dispatch.ndarray( undefined, fallbackWithOffsets ); // $ExpectError
|
|
277
|
-
dispatch.ndarray( [], fallbackWithOffsets ); // $ExpectError
|
|
278
|
-
dispatch.ndarray( {}, fallbackWithOffsets ); // $ExpectError
|
|
279
|
-
dispatch.ndarray( ( x: string ): string => x, fallbackWithOffsets ); // $ExpectError
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// The compiler throws an error if the `ndarray` method is not provided a second argument which is a fallback function...
|
|
283
|
-
{
|
|
284
|
-
dispatch.ndarray( addon, '10' ); // $ExpectError
|
|
285
|
-
dispatch.ndarray( addon, 10 ); // $ExpectError
|
|
286
|
-
dispatch.ndarray( addon, true ); // $ExpectError
|
|
287
|
-
dispatch.ndarray( addon, false ); // $ExpectError
|
|
288
|
-
dispatch.ndarray( addon, null ); // $ExpectError
|
|
289
|
-
dispatch.ndarray( addon, undefined ); // $ExpectError
|
|
290
|
-
dispatch.ndarray( addon, [] ); // $ExpectError
|
|
291
|
-
dispatch.ndarray( addon, {} ); // $ExpectError
|
|
292
|
-
dispatch.ndarray( addon, ( x: string ): string => x ); // $ExpectError
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// The `ndarray` method returns a function which returns a collection...
|
|
296
|
-
{
|
|
297
|
-
const x = new Float64Array( 10 );
|
|
298
|
-
const y = new Float64Array( x.length );
|
|
299
|
-
const z = new Float64Array( x.length );
|
|
300
|
-
|
|
301
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
302
|
-
|
|
303
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectType Collection
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// The compiler throws an error if the returned function is not provided a first argument which is a number...
|
|
307
|
-
{
|
|
308
|
-
const x = new Float64Array( 10 );
|
|
309
|
-
const y = new Float64Array( x.length );
|
|
310
|
-
const z = new Float64Array( x.length );
|
|
311
|
-
|
|
312
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
313
|
-
|
|
314
|
-
f( '10', 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
315
|
-
f( true, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
316
|
-
f( false, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
317
|
-
f( null, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
318
|
-
f( undefined, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
319
|
-
f( [], 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
320
|
-
f( {}, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
321
|
-
f( ( x: number ): number => x, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// The compiler throws an error if the returned function is not provided a third argument which is a collection...
|
|
325
|
-
{
|
|
326
|
-
const x = new Float64Array( 10 );
|
|
327
|
-
const y = new Float64Array( x.length );
|
|
328
|
-
const z = new Float64Array( x.length );
|
|
329
|
-
|
|
330
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
331
|
-
|
|
332
|
-
f( x.length, 'float64', true, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
333
|
-
f( x.length, 'float64', false, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
334
|
-
f( x.length, 'float64', null, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
335
|
-
f( x.length, 'float64', undefined, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
336
|
-
f( x.length, 'float64', {}, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// The compiler throws an error if the returned function is not provided a fourth argument which is a number...
|
|
340
|
-
{
|
|
341
|
-
const x = new Float64Array( 10 );
|
|
342
|
-
const y = new Float64Array( x.length );
|
|
343
|
-
const z = new Float64Array( x.length );
|
|
344
|
-
|
|
345
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
346
|
-
|
|
347
|
-
f( x.length, 'float64', x, '10', 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
348
|
-
f( x.length, 'float64', x, true, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
349
|
-
f( x.length, 'float64', x, false, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
350
|
-
f( x.length, 'float64', x, null, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
351
|
-
f( x.length, 'float64', x, undefined, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
352
|
-
f( x.length, 'float64', x, [], 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
353
|
-
f( x.length, 'float64', x, {}, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
354
|
-
f( x.length, 'float64', x, ( x: number ): number => x, 0, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// The compiler throws an error if the returned function is not provided a fifth argument which is a number...
|
|
358
|
-
{
|
|
359
|
-
const x = new Float64Array( 10 );
|
|
360
|
-
const y = new Float64Array( x.length );
|
|
361
|
-
const z = new Float64Array( x.length );
|
|
362
|
-
|
|
363
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
364
|
-
|
|
365
|
-
f( x.length, 'float64', x, 1, '10', 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
366
|
-
f( x.length, 'float64', x, 1, true, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
367
|
-
f( x.length, 'float64', x, 1, false, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
368
|
-
f( x.length, 'float64', x, 1, null, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
369
|
-
f( x.length, 'float64', x, 1, undefined, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
370
|
-
f( x.length, 'float64', x, 1, [], 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
371
|
-
f( x.length, 'float64', x, 1, {}, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
372
|
-
f( x.length, 'float64', x, 1, ( x: number ): number => x, 'float64', y, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// The compiler throws an error if the returned function is not provided a seventh argument which is a collection...
|
|
376
|
-
{
|
|
377
|
-
const x = new Float64Array( 10 );
|
|
378
|
-
const y = new Float64Array( x.length );
|
|
379
|
-
const z = new Float64Array( x.length );
|
|
380
|
-
|
|
381
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
382
|
-
|
|
383
|
-
f( y.length, 'float64', x, 1, 0, 'float64', true, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
384
|
-
f( y.length, 'float64', x, 1, 0, 'float64', false, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
385
|
-
f( y.length, 'float64', x, 1, 0, 'float64', null, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
386
|
-
f( y.length, 'float64', x, 1, 0, 'float64', undefined, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
387
|
-
f( y.length, 'float64', x, 1, 0, 'float64', {}, 1, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// The compiler throws an error if the returned function is not provided an eighth argument which is a number...
|
|
391
|
-
{
|
|
392
|
-
const x = new Float64Array( 10 );
|
|
393
|
-
const y = new Float64Array( x.length );
|
|
394
|
-
const z = new Float64Array( x.length );
|
|
395
|
-
|
|
396
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
397
|
-
|
|
398
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, '10', 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
399
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, true, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
400
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, false, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
401
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, null, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
402
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, undefined, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
403
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, [], 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
404
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, {}, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
405
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, ( x: number ): number => x, 0, 'float64', z, 1, 0 ); // $ExpectError
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// The compiler throws an error if the returned function is not provided a ninth argument which is a number...
|
|
409
|
-
{
|
|
410
|
-
const x = new Float64Array( 10 );
|
|
411
|
-
const y = new Float64Array( x.length );
|
|
412
|
-
const z = new Float64Array( x.length );
|
|
413
|
-
|
|
414
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
415
|
-
|
|
416
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, '10', 'float64', z, 1, 0 ); // $ExpectError
|
|
417
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, true, 'float64', z, 1, 0 ); // $ExpectError
|
|
418
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, false, 'float64', z, 1, 0 ); // $ExpectError
|
|
419
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, null, 'float64', z, 1, 0 ); // $ExpectError
|
|
420
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, undefined, 'float64', z, 1, 0 ); // $ExpectError
|
|
421
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, [], 'float64', z, 1, 0 ); // $ExpectError
|
|
422
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, {}, 'float64', z, 1, 0 ); // $ExpectError
|
|
423
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, ( x: number ): number => x, 'float64', z, 1, 0 ); // $ExpectError
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// The compiler throws an error if the returned function is not provided an eleventh argument which is a collection...
|
|
427
|
-
{
|
|
428
|
-
const x = new Float64Array( 10 );
|
|
429
|
-
const y = new Float64Array( x.length );
|
|
430
|
-
const z = new Float64Array( x.length );
|
|
431
|
-
|
|
432
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
433
|
-
|
|
434
|
-
f( z.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', true, 1, 0 ); // $ExpectError
|
|
435
|
-
f( z.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', false, 1, 0 ); // $ExpectError
|
|
436
|
-
f( z.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', null, 1, 0 ); // $ExpectError
|
|
437
|
-
f( z.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', undefined, 1, 0 ); // $ExpectError
|
|
438
|
-
f( z.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', {}, 1, 0 ); // $ExpectError
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
// The compiler throws an error if the returned function is not provided a twelfth argument which is a number...
|
|
442
|
-
{
|
|
443
|
-
const x = new Float64Array( 10 );
|
|
444
|
-
const y = new Float64Array( x.length );
|
|
445
|
-
const z = new Float64Array( x.length );
|
|
446
|
-
|
|
447
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
448
|
-
|
|
449
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, '10', 0 ); // $ExpectError
|
|
450
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, true, 0 ); // $ExpectError
|
|
451
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, false, 0 ); // $ExpectError
|
|
452
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, null, 0 ); // $ExpectError
|
|
453
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, undefined, 0 ); // $ExpectError
|
|
454
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, [], 0 ); // $ExpectError
|
|
455
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, {}, 0 ); // $ExpectError
|
|
456
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, ( x: number ): number => x, 0 ); // $ExpectError
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// The compiler throws an error if the returned function is not provided a thirteenth argument which is a number...
|
|
460
|
-
{
|
|
461
|
-
const x = new Float64Array( 10 );
|
|
462
|
-
const y = new Float64Array( x.length );
|
|
463
|
-
const z = new Float64Array( x.length );
|
|
464
|
-
|
|
465
|
-
const f = dispatch.ndarray( addon, fallbackWithOffsets );
|
|
466
|
-
|
|
467
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, '10' ); // $ExpectError
|
|
468
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, true ); // $ExpectError
|
|
469
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, false ); // $ExpectError
|
|
470
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, null ); // $ExpectError
|
|
471
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, undefined ); // $ExpectError
|
|
472
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, [] ); // $ExpectError
|
|
473
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, {} ); // $ExpectError
|
|
474
|
-
f( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0, 'float64', z, 1, ( x: number ): number => x ); // $ExpectError
|
|
475
|
-
}
|
package/lib/binary.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/* eslint-disable max-len */
|
|
20
|
-
|
|
21
|
-
'use strict';
|
|
22
|
-
|
|
23
|
-
// MODULES //
|
|
24
|
-
|
|
25
|
-
var isFunction = require( '@stdlib/assert-is-function' );
|
|
26
|
-
var isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );
|
|
27
|
-
var resolve = require( '@stdlib/strided-base-dtype-resolve-enum' );
|
|
28
|
-
var reinterpretComplex64 = require( '@stdlib/strided-base-reinterpret-complex64' );
|
|
29
|
-
var reinterpretComplex128 = require( '@stdlib/strided-base-reinterpret-complex128' );
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// VARIABLES //
|
|
33
|
-
|
|
34
|
-
var COMPLEX64 = resolve( 'complex64' );
|
|
35
|
-
var COMPLEX128 = resolve( 'complex128' );
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// MAIN //
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns a function which dispatches to a native add-on applying a binary function to two input strided arrays.
|
|
42
|
-
*
|
|
43
|
-
* ## Notes
|
|
44
|
-
*
|
|
45
|
-
* - The returned function has the following signature:
|
|
46
|
-
*
|
|
47
|
-
* ```text
|
|
48
|
-
* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* where
|
|
52
|
-
*
|
|
53
|
-
* - **N**: number of indexed elements.
|
|
54
|
-
* - **dtypeX**: `x` data type.
|
|
55
|
-
* - **x**: input array.
|
|
56
|
-
* - **strideX**: `x` stride length.
|
|
57
|
-
* - **dtypeY**: `y` data type.
|
|
58
|
-
* - **y**: input array.
|
|
59
|
-
* - **strideY**: `y` stride length.
|
|
60
|
-
* - **dtypeZ**: `z` data type.
|
|
61
|
-
* - **z**: output array.
|
|
62
|
-
* - **strideY**: `z` stride length.
|
|
63
|
-
*
|
|
64
|
-
* - The add-on function should have the following signature:
|
|
65
|
-
*
|
|
66
|
-
* ```text
|
|
67
|
-
* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
* where
|
|
71
|
-
*
|
|
72
|
-
* - **N**: number of indexed elements.
|
|
73
|
-
* - **dtypeX**: `x` data type (enumeration constant).
|
|
74
|
-
* - **x**: input array.
|
|
75
|
-
* - **strideX**: `x` stride length.
|
|
76
|
-
* - **dtypeY**: `y` data type (enumeration constant).
|
|
77
|
-
* - **y**: input array.
|
|
78
|
-
* - **strideY**: `y` stride length.
|
|
79
|
-
* - **dtypeZ**: `z` data type (enumeration constant).
|
|
80
|
-
* - **z**: output array.
|
|
81
|
-
* - **strideZ**: `z` stride length.
|
|
82
|
-
*
|
|
83
|
-
* - The fallback function should have the following signature:
|
|
84
|
-
*
|
|
85
|
-
* ```text
|
|
86
|
-
* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* where
|
|
90
|
-
*
|
|
91
|
-
* - **N**: number of indexed elements.
|
|
92
|
-
* - **dtypeX**: `x` data type.
|
|
93
|
-
* - **x**: input array.
|
|
94
|
-
* - **strideX**: `x` stride length.
|
|
95
|
-
* - **dtypeY**: `y` data type.
|
|
96
|
-
* - **y**: input array.
|
|
97
|
-
* - **strideY**: `y` stride length.
|
|
98
|
-
* - **dtypeZ**: `z` data type.
|
|
99
|
-
* - **z**: output array.
|
|
100
|
-
* - **strideZ**: `z` stride length.
|
|
101
|
-
*
|
|
102
|
-
* @param {Function} addon - add-on interface
|
|
103
|
-
* @param {Function} fallback - fallback function
|
|
104
|
-
* @throws {TypeError} first argument must be a function
|
|
105
|
-
* @throws {TypeError} second argument must be a function
|
|
106
|
-
* @returns {Function} dispatch function
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {
|
|
110
|
-
* // Call into native add-on...
|
|
111
|
-
* }
|
|
112
|
-
*
|
|
113
|
-
* function fallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {
|
|
114
|
-
* // Fallback JavaScript implementation...
|
|
115
|
-
* }
|
|
116
|
-
*
|
|
117
|
-
* // Create a dispatch function:
|
|
118
|
-
* var f = dispatch( addon, fallback );
|
|
119
|
-
*
|
|
120
|
-
* // ...
|
|
121
|
-
*
|
|
122
|
-
* // Invoke the dispatch function with strided array arguments:
|
|
123
|
-
* f( 2, 'generic', [ 1, 2 ], 1, 'generic', [ 3, 4 ], 1, 'generic', [ 0, 0 ], 1 );
|
|
124
|
-
*/
|
|
125
|
-
function dispatch( addon, fallback ) {
|
|
126
|
-
if ( !isFunction( addon ) ) {
|
|
127
|
-
throw new TypeError( 'invalid argument. First argument must be a function. Value: `' + addon + '`.' );
|
|
128
|
-
}
|
|
129
|
-
if ( !isFunction( fallback ) ) {
|
|
130
|
-
throw new TypeError( 'invalid argument. Second argument must be a function. Value: `' + fallback + '`.' );
|
|
131
|
-
}
|
|
132
|
-
return dispatcher;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Dispatches to a native add-on.
|
|
136
|
-
*
|
|
137
|
-
* @private
|
|
138
|
-
* @param {integer} N - number of indexed elements
|
|
139
|
-
* @param {*} dtypeX - `x` data type
|
|
140
|
-
* @param {Collection} x - input array
|
|
141
|
-
* @param {integer} strideX - `x` stride length
|
|
142
|
-
* @param {*} dtypeY - `y` data type
|
|
143
|
-
* @param {Collection} y - input array
|
|
144
|
-
* @param {integer} strideY - `y` stride length
|
|
145
|
-
* @param {*} dtypeZ - `z` data type
|
|
146
|
-
* @param {Collection} z - destination array
|
|
147
|
-
* @param {integer} strideZ - `z` stride length
|
|
148
|
-
* @throws {TypeError} unable to resolve a strided array function supporting the provided array argument data types
|
|
149
|
-
* @returns {Collection} `z`
|
|
150
|
-
*/
|
|
151
|
-
function dispatcher( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {
|
|
152
|
-
var viewX;
|
|
153
|
-
var viewY;
|
|
154
|
-
var viewZ;
|
|
155
|
-
|
|
156
|
-
// WARNING: we assume that, if we're provided something resembling a typed array, we're provided a typed array; however, this can lead to potential unintended errors as the native add-on may not work with non-typed array objects (e.g., generic arrays)...
|
|
157
|
-
if (
|
|
158
|
-
!isTypedArrayLike( x ) ||
|
|
159
|
-
!isTypedArrayLike( y ) ||
|
|
160
|
-
!isTypedArrayLike( z )
|
|
161
|
-
) {
|
|
162
|
-
fallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ );
|
|
163
|
-
return z;
|
|
164
|
-
}
|
|
165
|
-
dtypeX = resolve( dtypeX );
|
|
166
|
-
dtypeY = resolve( dtypeY );
|
|
167
|
-
dtypeZ = resolve( dtypeZ );
|
|
168
|
-
if ( dtypeX === null || dtypeY === null || dtypeZ === null ) {
|
|
169
|
-
throw new TypeError( 'invalid arguments. Unable to resolve a strided array function supporting the provided array argument data types.' );
|
|
170
|
-
}
|
|
171
|
-
if ( dtypeX === COMPLEX64 ) {
|
|
172
|
-
viewX = reinterpretComplex64( x, 0 );
|
|
173
|
-
} else if ( dtypeX === COMPLEX128 ) {
|
|
174
|
-
viewX = reinterpretComplex128( x, 0 );
|
|
175
|
-
} else {
|
|
176
|
-
viewX = x;
|
|
177
|
-
}
|
|
178
|
-
if ( dtypeY === COMPLEX64 ) {
|
|
179
|
-
viewY = reinterpretComplex64( y, 0 );
|
|
180
|
-
} else if ( dtypeY === COMPLEX128 ) {
|
|
181
|
-
viewY = reinterpretComplex128( y, 0 );
|
|
182
|
-
} else {
|
|
183
|
-
viewY = y;
|
|
184
|
-
}
|
|
185
|
-
if ( dtypeZ === COMPLEX64 ) {
|
|
186
|
-
viewZ = reinterpretComplex64( z, 0 );
|
|
187
|
-
} else if ( dtypeZ === COMPLEX128 ) {
|
|
188
|
-
viewZ = reinterpretComplex128( z, 0 );
|
|
189
|
-
} else {
|
|
190
|
-
viewZ = z;
|
|
191
|
-
}
|
|
192
|
-
addon( N, dtypeX, viewX, strideX, dtypeY, viewY, strideY, dtypeZ, viewZ, strideZ );
|
|
193
|
-
return z;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// EXPORTS //
|
|
199
|
-
|
|
200
|
-
module.exports = dispatch;
|