(cRank: number, shape: number[], rank: number)
| 24 | userCode: string; |
| 25 | |
| 26 | constructor(cRank: number, shape: number[], rank: number) { |
| 27 | this.outputShape = shape; |
| 28 | |
| 29 | let cCoords; |
| 30 | let abCoords; |
| 31 | if (rank > 4) { |
| 32 | throw Error(`Where for rank ${rank} is not yet supported`); |
| 33 | } |
| 34 | |
| 35 | if (rank === 1) { |
| 36 | abCoords = `resRC`; |
| 37 | cCoords = `resRC`; |
| 38 | } else { |
| 39 | const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w']; |
| 40 | const cCoordVars = []; |
| 41 | const abCoordVars = []; |
| 42 | for (let i = 0; i < shape.length; i++) { |
| 43 | abCoordVars.push(`${currentCoords[i]}`); |
| 44 | if (i < cRank) { |
| 45 | cCoordVars.push(`${currentCoords[i]}`); |
| 46 | } |
| 47 | } |
| 48 | cCoords = cCoordVars.join(); |
| 49 | abCoords = abCoordVars.join(); |
| 50 | } |
| 51 | |
| 52 | const dtype = getCoordsDataType(rank); |
| 53 | |
| 54 | this.userCode = ` |
| 55 | void main() { |
| 56 | ${dtype} resRC = getOutputCoords(); |
| 57 | float cVal = getC(${cCoords}); |
| 58 | if (cVal >= 1.0) { |
| 59 | setOutput(getA(${abCoords})); |
| 60 | } else { |
| 61 | setOutput(getB(${abCoords})); |
| 62 | } |
| 63 | } |
| 64 | `; |
| 65 | } |
| 66 | } |
nothing calls this directly
no test coverage detected