qml.apply_controlled_Q

apply_controlled_Q(tape, wires, target_wire, control_wire, work_wires)[source]

Applies the transform that performs a controlled version of the \(\mathcal{Q}\) unitary defined in this paper.

The input tape should be the quantum circuit corresponding to the \(\mathcal{F}\) unitary in the paper above. This function transforms this circuit into a controlled version of the \(\mathcal{Q}\) unitary, which forms part of the quantum Monte Carlo algorithm. The \(\mathcal{Q}\) unitary encodes the target expectation value as a phase in one of its eigenvalues. This phase can be estimated using quantum phase estimation (see QuantumPhaseEstimation for more details).

Parameters
  • tape (QNode or QuantumTape or Callable) – the quantum circuit that applies quantum operations according to the \(\mathcal{F}\) unitary used as part of quantum Monte Carlo estimation

  • wires (Union[Wires or Sequence[int]]) – the wires acted upon by the fn circuit

  • target_wire (Union[Wires, int]) – The wire in which the expectation value is encoded. Must be contained within wires.

  • control_wire (Union[Wires, int]) – the control wire from the register of phase estimation qubits

  • work_wires (Union[Wires, Sequence[int], or int]) – additional work wires used when decomposing \(\mathcal{Q}\)

Returns

The transformed circuit as described in qml.transform. Executing this circuit will perform control on \(\mathcal{Q}\) unitary.

Return type

qnode (QNode) or quantum function (Callable) or tuple[List[QuantumTape], function]

Raises

ValueError – if target_wire is not in wires