Function multiControlledMultiRotateZ

Source
pub unsafe extern "C" fn multiControlledMultiRotateZ(
    qureg: Qureg,
    controlQubits: *mut c_int,
    numControls: c_int,
    targetQubits: *mut c_int,
    numTargets: c_int,
    angle: f64,
)
Expand description

Apply a multi-controlled multi-target Z rotation, also known as a controlled phase gadget. This is the unitary \f[ |1\rangle\langle 1|^{\otimes, \text{numControls}} ; \otimes , \exp \left( - i , \frac{\theta}{2} ; \bigotimes_{j}^{\text{numTargets}} Z_j\right) ;;+;; \sum\limits_{k=0}^{2^{,\text{numControls}} - 2} |k\rangle\langle k| \otimes \text{I} \f] where the Pauli Z gates operate upon the qubits in targetQubits, and cause rotations of \f$\theta =\f$ \p angle.

@htmlonly

@endhtmlonly

All qubits not appearing in \p targetQubits and \p controlQubits are assumed to receive the identity operator.

This has the effect of premultiplying all amplitudes (for which the control qubits are 1) with \f$\exp(\pm i \theta/2)\f$, where the sign is determined by the parity of the target qubits for that amplitude.

@see

  • multiControlledMultiRotatePauli()
  • multiRotatePauli()
  • multiRotateZ()
  • controlledRotateZ()
  • rotateZ()

@ingroup unitary @param[in,out] qureg object representing the set of all qubits @param[in] controlQubits list of the indices of qubits to control upon @param[in] numControls length of length controlQubits @param[in] targetQubits a list of the indices of the target qubits @param[in] numTargets length of list targetQubits @param[in] angle the angle by which the multi-qubit state is rotated around the Z axis @throws invalidQuESTInputError()

  • if any qubit in \p controlQubits and \p targetQubits is invalid, i.e. outside [0, qureg.numQubitsRepresented)
  • if \p controlQubits or \p targetQubits contain any repetitions
  • if any qubit in \p controlQubits is also in \p targetQubits (and vice versa)
  • if \p numTargets < 1
  • if \p numControls < 1 (use multiRotateZ() for no controls) @throws segmentation-fault
  • if \p controlQubits contains fewer elements than \p numControls
  • if \p targetQubits contains fewer elements than \p numTargets @author Tyson Jones