Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 76dd668

Browse files
RufusJWBmsoeken
andauthored
Added example how to use PrepareArbitraryStateCP (#627)
* Added example how to use PrepareArbitraryStateCP * Update Standard/src/Preparation/Arbitrary.qs Co-authored-by: Mathias Soeken <mathias.soeken@gmail.com> Co-authored-by: Mathias Soeken <mathias.soeken@gmail.com>
1 parent f29e03e commit 76dd668

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Standard/src/Preparation/Arbitrary.qs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ namespace Microsoft.Quantum.Preparation {
5151
/// elements $(r_j, t_j) = (0.0, 0.0)$ if fewer than $2^n$ are
5252
/// specified.
5353
///
54+
/// # Example
55+
/// The following snippet prepares the quantum state $\ket{\psi}=\sqrt{1/8}\ket{0}+\sqrt{7/8}\ket{2}$
56+
/// in the qubit register `qubitsLE`.
57+
/// ```qsharp
58+
/// use qubits = Qubit();
59+
/// let qubitsLE = LittleEndian([qubits]);
60+
/// PrepareArbitraryStateCP([ComplexPolar(1.0/Sqrt(2.0),0.0),ComplexPolar(1.0/Sqrt(2.0),PI()/2.0)],qubitsLE); // = |i>
61+
/// ```
62+
///
5463
/// # References
5564
/// - Synthesis of Quantum Logic Circuits
5665
/// Vivek V. Shende, Stephen S. Bullock, Igor L. Markov

0 commit comments

Comments
 (0)