cunqa.circuit.circuit.ControlContext
- class cunqa.circuit.circuit.ControlContext(control_circuit: CunqaCircuit, target_circuit: CunqaCircuit)
Bases:
objectClass to manage the controlled telegate operations from a circuit/virtual QPU to another.
An object of this class is returned by the
expose()method. Used as a context manager, it can be passed to controlled operations in order to implement telgate operations:>>> with circuit_1.expose(0, circuit_2) as rcontrol: >>> circuit_2.cx(rcontrol, 0)
Then, when the block ends, the
ControlContextadds the propper “rcontrol” instruction to the target circuit.
Methods
- ControlContext.__init__(control_circuit: CunqaCircuit, target_circuit: CunqaCircuit) int
Class constructor.
- Parameters:
control_circuit (
CunqaCircuit) – circuit which qubit is exposed.target_circuit (
CunqaCircuit) – circuit in which the instructions are implemented.