PreparePureStateD operation
Fully qualified name: Microsoft.Quantum.Unstable.StatePreparation.PreparePureStateD
operation PreparePureStateD(coefficients : Double[], qubits : Qubit[]) : Unit is Adj + Ctl
Summary
Given a set of coefficients and a big-endian quantum register, prepares a state on that register described by the given coefficients.
Description
This operation prepares an arbitrary quantum state |šā© with coefficients šā±¼ from the n-qubit computational basis state |0...0ā©.
The action of U on the all-zeros state is given by $$ \begin{align} U \ket{0\cdots 0} = \ket{\psi} = \frac{\sum_{j=0}^{2^n-1}\alpha_j \ket{j}}{\sqrt{\sum_{j=0}^{2^n-1}|\alpha_j|^2}}. \end{align} $$
Input
coefficients
Array of up to 2āæ real coefficients. The j-th coefficient indexes the number state |jā© encoded in big-endian format.
qubits
Qubit register encoding number states in a big-endian format. This is expected to be initialized in the computational basis state |0...0ā©.
Remarks
coefficients
will be normalized and padded with
elements šā±¼ = 0.0 if fewer than 2āæ are specified.
Example
The following snippet prepares the quantum state |šā©=ā(1/8)|0ā©+ā(7/8)|2ā©=ā(1/8)|00ā©+ā(7/8)|10ā©
in the qubit register qubits
.
let amplitudes = [Sqrt(0.125), 0.0, Sqrt(0.875), 0.0];
use qubits = Qubit[2];
PreparePureStateD(amplitudes, qubits);
References
- arXiv:quant-ph/0406176 "Synthesis of Quantum Logic Circuits", Vivek V. Shende, Stephen S. Bullock, Igor L. Markov
See Also
- Microsoft.Quantum.Unstable.StatePreparation.ApproximatelyPreparePureStateCP