py_alqorithms.convert_circuit_to_controlled

py_alqorithms.convert_circuit_to_controlled(circuit, config=None)

Loop over the original circuit and return a version with controlled gates.

Parameters:
  • original_circuit (Circuit) -- The original quantum circuit.

  • config (Optional[str]) -- Beginning to have the control qubit at the beginning of the circuit or End to have the control qubit at the end of the circuit. Beginning by default.

Returns:

The controlled version of the original circuit.

Return type:

Circuit

Raises:

PyValueError -- If the circuit contains operations that cannot be controlled.