Utility function for adding a single target controlled quantum operation to the MLIR representation for the PyKernel.
(self, opName, control, target, isAdj=False)
| 99 | |
| 100 | |
| 101 | def __singleTargetControlOperation(self, opName, control, target, isAdj=False): |
| 102 | """ |
| 103 | Utility function for adding a single target controlled quantum operation to |
| 104 | the MLIR representation for the PyKernel. |
| 105 | """ |
| 106 | with self.insertPoint, self.loc: |
| 107 | fwdControls = None |
| 108 | if isinstance(control, list): |
| 109 | fwdControls = [c.mlirValue for c in control] |
| 110 | elif quake.RefType.isinstance( |
| 111 | control.mlirValue.type) or quake.VeqType.isinstance( |
| 112 | control.mlirValue.type): |
| 113 | fwdControls = [control.mlirValue] |
| 114 | else: |
| 115 | emitFatalError(f"invalid control type for {opName}.") |
| 116 | |
| 117 | __generalOperation(self, |
| 118 | opName, [], |
| 119 | fwdControls, |
| 120 | target, |
| 121 | isAdj=isAdj, |
| 122 | context=self.ctx) |
| 123 | |
| 124 | |
| 125 | def __singleTargetSingleParameterOperation(self, |
nothing calls this directly
no test coverage detected