ApplyDiagonalUnitary 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
Applies an array of complex phases to numeric basis states of a register of qubits.
operation ApplyDiagonalUnitary (coefficients : Double[], qubits : Microsoft.Quantum.Arithmetic.LittleEndian) : Unit is Adj + Ctl
Description
This operation implements a diagonal unitary that applies a complex phase $e^{i \theta_j}$ on the $n$-qubit number state $\ket{j}$. In particular, this operation can be represented by the unitary
$$ \begin{align} U = \sum^{2^n-1}_{j=0}e^{i\theta_j}\ket{j}\bra{j}. \end{align} $$
Input
coefficients : Double[]
Array of up to $2^n$ coefficients $\theta_j$. The $j$th coefficient indexes the number state $\ket{j}$ encoded in little-endian format.
qubits : LittleEndian
$n$-qubit control register that encodes number states $\ket{j}$ in little-endian format.
Output : Unit
Remarks
coefficients
will be padded with elements $\theta_j = 0.0$ if
fewer than $2^n$ are specified.
References
- Synthesis of Quantum Logic Circuits Vivek V. Shende, Stephen S. Bullock, Igor L. Markov https://arxiv.org/abs/quant-ph/0406176
See Also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for