PrepareArbitraryState operation

Returns an operation that prepares a given quantum state.

The returned operation $U$ prepares an arbitrary quantum state $\ket{\psi}$ with complex coefficients $r_j e^{i t_j}$ from the $n$-qubit computational basis state $\ket{0...0}$.

$$ \begin{align} U\ket{0...0}=\ket{\psi}=\frac{\sum_{j=0}^{2^n-1}r_j e^{i t_j}\ket{j}}{\sqrt{\sum_{j=0}^{2^n-1}|r_j|^2}}. \end{align} $$

operation PrepareArbitraryState (coefficients : Microsoft.Quantum.Math.ComplexPolar[], qubits : Microsoft.Quantum.Arithmetic.LittleEndian) : Unit
Functors
Adjoint Controlled

Input

coefficients
ComplexPolar[]

Array of up to $2^n$ complex coefficients represented by their absolute value and phase $(r_j, t_j)$. The $j$th coefficient indexes the number state $\ket{j}$ encoded in little-endian format.

qubits
LittleEndian

Qubit register encoding number states in little-endian format. This is expected to be initialized in the computational basis state $\ket{0...0}$.

Output

Unit

Remarks

Negative input coefficients $r_j < 0$ will be treated as though positive with value $|r_j|$. coefficients will be padded with elements $(r_j, t_j) = (0.0, 0.0)$ if fewer than $2^n$ are specified.

References