* @desc Setup the parameter types for the parameters * supplied to the Kernel function * * @param {IArguments} args - The actual parameters sent to the Kernel
(args)
| 358 | * @param {IArguments} args - The actual parameters sent to the Kernel |
| 359 | */ |
| 360 | setupArguments(args) { |
| 361 | this.kernelArguments = []; |
| 362 | if (!this.argumentTypes) { |
| 363 | if (!this.argumentTypes) { |
| 364 | this.argumentTypes = []; |
| 365 | for (let i = 0; i < args.length; i++) { |
| 366 | const argType = utils.getVariableType(args[i], this.strictIntegers); |
| 367 | const type = argType === 'Integer' ? 'Number' : argType; |
| 368 | this.argumentTypes.push(type); |
| 369 | this.kernelArguments.push({ |
| 370 | type |
| 371 | }); |
| 372 | } |
| 373 | } |
| 374 | } else { |
| 375 | for (let i = 0; i < this.argumentTypes.length; i++) { |
| 376 | this.kernelArguments.push({ |
| 377 | type: this.argumentTypes[i] |
| 378 | }); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | // setup sizes |
| 383 | this.argumentSizes = new Array(args.length); |
| 384 | this.argumentBitRatios = new Int32Array(args.length); |
| 385 | |
| 386 | for (let i = 0; i < args.length; i++) { |
| 387 | const arg = args[i]; |
| 388 | this.argumentSizes[i] = arg.constructor === Input ? arg.size : null; |
| 389 | this.argumentBitRatios[i] = this.getBitRatio(arg); |
| 390 | } |
| 391 | |
| 392 | if (this.argumentNames.length !== args.length) { |
| 393 | throw new Error(`arguments are miss-aligned`); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | /** |
| 398 | * Setup constants |
no test coverage detected