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