ApplyCNOTChainWithTarget operation

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Canon

Package: Microsoft.Quantum.Standard

Computes the parity of an array of qubits into a target qubit.

operation ApplyCNOTChainWithTarget (qubits : Qubit[], targetQubit : Qubit) : Unit is Adj + Ctl

Description

If the array is initially in the state $\ket{q_0} \ket{q_1} \cdots \ket{q_{\text{target}}}$, the final state is given by $\ket{q_0} \ket{q_1 \oplus q_0} \cdots \ket{q_{n - 1} \oplus \cdots \oplus q_0 \oplus q_{\text{target}}}$.

Input

qubits : Qubit[]

Array of qubits on which the parity is computed.

targetQubit : Qubit

Final qubit into which the parity of 'qubits' is XORed.

Output : Unit

Remarks

The following are equivalent:

ApplyCNOTChainWithTarget(Most(qs), Tail(qs));

and

ApplyCNOTChain(qs);