Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

task 1.7 global phase change was added #177

Merged
merged 15 commits into from
Oct 5, 2019
Prev Previous commit
Next Next commit
Synced global phase task in jupyter notebook.
  • Loading branch information
adutchengineer committed Oct 2, 2019
commit 38e93029e62e763b5f7cbb586772bb2e2cb9e5a0
42 changes: 36 additions & 6 deletions BasicGates/BasicGates.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,37 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Task 1.7. Bell state change - 1\n",
"### Task 1.7. Global Phase Change",
"\n",
"**Input:** \n",
"\n",
"1) Pauli operator (μ) represented as Pauli.\n",
"\n",
"2) Angle alpha, in radians, represented as Double.\n",
"\n",
"3) A qubit in state β|0⟩ + γ|1⟩.\n",
adutchengineer marked this conversation as resolved.
Show resolved Hide resolved
"\n",
"**Goal**: Change the state of the qubit to - β|0⟩ - γ|1⟩.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%kata T17_GlobalPhaseChange_Test\n",
"\n",
"operation GlobalPhaseChange (pauli: Pauli, alpha: Double, qs : Qubit[]) : Unit is Adj+Ctl {\n",
" // ...\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Task 1.8. Bell state change - 1\n",
"\n",
"**Input:** Two entangled qubits in Bell state $|\\Phi^{+}\\rangle = \\frac{1}{\\sqrt{2}} \\big(|00\\rangle + |11\\rangle\\big)$.\n",
"\n",
Expand All @@ -277,7 +307,7 @@
"metadata": {},
"outputs": [],
"source": [
"%kata T17_BellStateChange1_Test\n",
"%kata T18_BellStateChange1_Test\n",
"\n",
"operation BellStateChange1 (qs : Qubit[]) : Unit is Adj+Ctl {\n",
" // ...\n",
Expand All @@ -288,7 +318,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Task 1.8. Bell state change - 2\n",
"### Task 1.9. Bell state change - 2\n",
"\n",
"**Input:** Two entangled qubits in Bell state $|\\Phi^{+}\\rangle = \\frac{1}{\\sqrt{2}} \\big(|00\\rangle + |11\\rangle\\big)$.\n",
"\n",
Expand All @@ -301,7 +331,7 @@
"metadata": {},
"outputs": [],
"source": [
"%kata T18_BellStateChange2_Test\n",
"%kata T19_BellStateChange2_Test\n",
"\n",
"operation BellStateChange2 (qs : Qubit[]) : Unit is Adj+Ctl {\n",
" // ...\n",
Expand All @@ -312,7 +342,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Task 1.9. Bell state change - 3\n",
"### Task 1.10. Bell state change - 3\n",
"\n",
"**Input:** Two entangled qubits in Bell state $|\\Phi^{+}\\rangle = \\frac{1}{\\sqrt{2}} \\big(|00\\rangle + |11\\rangle\\big)$.\n",
"\n",
Expand All @@ -325,7 +355,7 @@
"metadata": {},
"outputs": [],
"source": [
"%kata T19_BellStateChange3_Test\n",
"%kata T110_BellStateChange3_Test\n",
"\n",
"operation BellStateChange3 (qs : Qubit[]) : Unit is Adj+Ctl {\n",
" // ...\n",
Expand Down
5 changes: 3 additions & 2 deletions BasicGates/ReferenceImplementation.qs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ namespace Quantum.Kata.BasicGates {

// Task 1.7. Global Phase Change
// Inputs:
// 1) Angle alpha, in radians, represented as Double.
// 2) A qubit in state β|0⟩ + γ|1⟩.
// 1) Pauli operator (μ) represented as Pauli.
// 2) Angle alpha, in radians, represented as Double.
// 3) A qubit in state β|0⟩ + γ|1⟩.
// Goal: Change the state of the qubit to - β|0⟩ - γ|1⟩.
operation GlobalPhaseChange_Reference(pauli: Pauli, alpha: Double, q: Qubit) : Unit is Adj+Ctl{
R(PauliI,alpha,q);
Expand Down
6 changes: 3 additions & 3 deletions BasicGates/Tasks.qs
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ namespace Quantum.Kata.BasicGates {

// Task 1.7. Global Phase Change
// Inputs:
// 1) Angle alpha, in radians, represented as Double.
// 2) A qubit in state β|0⟩ + γ|1⟩.
// 1) Pauli operator (μ) represented as Pauli.
// 2) Angle alpha, in radians, represented as Double.
// 3) A qubit in state β|0⟩ + γ|1⟩.
// Goal: Change the state of the qubit to - β|0⟩ - γ|1⟩.
operation GlobalPhaseChange(pauli: Pauli, alpha: Double, q: Qubit) : Unit is Adj+Ctl{
adutchengineer marked this conversation as resolved.
Show resolved Hide resolved
// ...
}



// Task 1.8. Bell state change - 1
// Input: Two entangled qubits in Bell state |Φ⁺⟩ = (|00⟩ + |11⟩) / sqrt(2).
// Goal: Change the two-qubit state to |Φ⁻⟩ = (|00⟩ - |11⟩) / sqrt(2).
Expand Down
1 change: 1 addition & 0 deletions BasicGates/Tests.qs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ namespace Quantum.Kata.BasicGates {
let alpha = ((2.0 * PI()) * IntAsDouble(i)) / 36.0;
AssertOperationsEqualReferenced(2, ArrayWrapperOperation(AmplitudeChange(alpha, _), _), ArrayWrapperOperation(AmplitudeChange_Reference(alpha, _), _));
}
}
adutchengineer marked this conversation as resolved.
Show resolved Hide resolved


// ------------------------------------------------------
Expand Down