From 3e21e9836b6810eee6b52efa9f3a353a41f9ab15 Mon Sep 17 00:00:00 2001 From: Rufus Buschart Date: Sat, 10 Sep 2022 22:41:05 +0200 Subject: [PATCH 1/2] Added example how to use PrepareArbitraryStateCP --- Standard/src/Preparation/Arbitrary.qs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Standard/src/Preparation/Arbitrary.qs b/Standard/src/Preparation/Arbitrary.qs index 35ec4a3576a..3232cf78147 100644 --- a/Standard/src/Preparation/Arbitrary.qs +++ b/Standard/src/Preparation/Arbitrary.qs @@ -51,6 +51,15 @@ namespace Microsoft.Quantum.Preparation { /// elements $(r_j, t_j) = (0.0, 0.0)$ if fewer than $2^n$ are /// specified. /// + /// # Example + /// The following snippet prepares the quantum state $\ket{\psi}=\sqrt{1/8}\ket{0}+\sqrt{7/8}\ket{2}$ + /// in the qubit register `qubitsLE`. + /// ```qsharp + /// use qubits = Qubit[1]; + /// let qubitsLE = LittleEndian(qubits); + /// PrepareArbitraryStateCP([ComplexPolar(1.0/Sqrt(2.0),0.0),ComplexPolar(1.0/Sqrt(2.0),PI()/2.0)],qubitsLE); // = |i> + /// ``` + /// /// # References /// - Synthesis of Quantum Logic Circuits /// Vivek V. Shende, Stephen S. Bullock, Igor L. Markov From e0282cf6d4a4960ec8c681e3e019bf0e8fb35629 Mon Sep 17 00:00:00 2001 From: Rufus Buschart Date: Mon, 12 Sep 2022 11:44:19 +0200 Subject: [PATCH 2/2] Update Standard/src/Preparation/Arbitrary.qs Co-authored-by: Mathias Soeken --- Standard/src/Preparation/Arbitrary.qs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Standard/src/Preparation/Arbitrary.qs b/Standard/src/Preparation/Arbitrary.qs index 3232cf78147..8343a1c4e6b 100644 --- a/Standard/src/Preparation/Arbitrary.qs +++ b/Standard/src/Preparation/Arbitrary.qs @@ -55,8 +55,8 @@ namespace Microsoft.Quantum.Preparation { /// The following snippet prepares the quantum state $\ket{\psi}=\sqrt{1/8}\ket{0}+\sqrt{7/8}\ket{2}$ /// in the qubit register `qubitsLE`. /// ```qsharp - /// use qubits = Qubit[1]; - /// let qubitsLE = LittleEndian(qubits); + /// use qubits = Qubit(); + /// let qubitsLE = LittleEndian([qubits]); /// PrepareArbitraryStateCP([ComplexPolar(1.0/Sqrt(2.0),0.0),ComplexPolar(1.0/Sqrt(2.0),PI()/2.0)],qubitsLE); // = |i> /// ``` ///