MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / __singleTargetControlOperation

Function __singleTargetControlOperation

python/cudaq/kernel/kernel_builder.py:101–122  ·  view source on GitHub ↗

Utility function for adding a single target controlled quantum operation to the MLIR representation for the PyKernel.

(self, opName, control, target, isAdj=False)

Source from the content-addressed store, hash-verified

99
100
101def __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
125def __singleTargetSingleParameterOperation(self,

Callers

nothing calls this directly

Calls 2

__generalOperationFunction · 0.85
emitFatalErrorFunction · 0.70

Tested by

no test coverage detected