File size: 1,351 Bytes
f25167e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | {
"name": "loop_110",
"op_type": "loop_110",
"description": "Compute complex dot product of two arrays of uint32 complex numbers",
"tags": [
"simd-loop"
],
"axes": {
"size": {
"type": "var",
"description": "axis size"
},
"size2": {
"type": "var",
"description": "axis size2"
},
"cdim": {
"type": "const",
"value": 2,
"description": "const cdim"
}
},
"inputs": {
"a0": {
"shape": [
"size2",
"cdim"
],
"dtype": "int8"
},
"b0": {
"shape": [
"size2",
"cdim"
],
"dtype": "int8"
}
},
"outputs": {
"c0": {
"shape": [
"size",
"cdim"
],
"dtype": "int32",
"description": "Output array"
}
},
"reference": "import numpy as np\n\ndef run(a0, b0):\n a = a0.astype(np.int64); b = b0.astype(np.int64)\n ae, ao = a[0::2], a[1::2]; be, bo = b[0::2], b[1::2]\n cr = (ae[:, 0]*be[:, 0] - ae[:, 1]*be[:, 1]) + (ao[:, 0]*bo[:, 0] - ao[:, 1]*bo[:, 1])\n ci = (ae[:, 1]*be[:, 0] + ae[:, 0]*be[:, 1]) + (ao[:, 1]*bo[:, 0] + ao[:, 0]*bo[:, 1])\n return np.stack([cr, ci], axis=1).astype(np.int32)\n",
"simd_loop_meta": {
"output_inplace": false,
"array_pad": 0,
"scratch": [],
"axes_order": [
"size"
]
}
}
|