-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build infrastructure for katas (#160)
This change creates the build infrastructure to compose and expose katas. --------- Co-authored-by: Cesar Zaragoza Cortes <cesarzc@ntdev.microsoft.com> Co-authored-by: Mine Starks <16928427+minestarks@users.noreply.github.com>
- Loading branch information
1 parent
627b35b
commit 0e349e1
Showing
31 changed files
with
546 additions
and
55 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//@ts-check | ||
|
||
/** | ||
* Katas Taxonomy | ||
* | ||
* A Kata is a top-level container of educational items (exercises and examples) which are used to explain a particular | ||
* topic. | ||
* | ||
* This file contains the information needed to build the content for all the Katas, and its main purpose is to convey | ||
* ordering. Each Kata and each item within a Kata is listed in the order it is meant to be presented to students. | ||
* | ||
* Each Kata is organized in a directory where a content.md file is present, and multiple sub-directories. Each | ||
* sub-directory represents an item within the Kata and its specific content depends on the type of item it represents. | ||
*/ | ||
|
||
/** | ||
* @type {Array< | ||
* { | ||
* directory: string, | ||
* items: Array<{ | ||
* type: string, | ||
* directory: string | ||
* }> | ||
* }>} | ||
*/ | ||
exports.katas = [ | ||
{ | ||
directory: "single_qubit_gates", | ||
items: [ | ||
{ | ||
type: "exercise", | ||
directory: "y_gate" | ||
}, | ||
{ | ||
type: "exercise", | ||
directory: "global_phase_i" | ||
} | ||
] | ||
}, | ||
{ | ||
directory: "multi_qubit_gates", | ||
items: [ | ||
{ | ||
type: "exercise", | ||
directory: "preparing_bell_state" | ||
} | ||
] | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Multi-Qubit Gates | ||
|
||
This tutorial continues the introduction to quantum gates, focusing on applying quantum gates to multi-qubit systems. | ||
|
||
This tutorial covers the following topics: | ||
|
||
- Applying quantum gates to a part of the system | ||
- $\\text{CNOT}$ and $\\text{SWAP}$ gates | ||
- Controlled gates |
5 changes: 5 additions & 0 deletions
5
katas/content/multi_qubit_gates/preparing_bell_state/content.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### Preparing a Bell state | ||
|
||
**Input:** Two qubits in state $|00\\rangle$, stored in an array of length 2. | ||
|
||
**Goal:** Transform the system into the Bell state $\\Phi^+ = \\frac{1}{\\sqrt{2}}\\big(|00\\rangle + |11\\rangle\\big)$. |
5 changes: 5 additions & 0 deletions
5
katas/content/multi_qubit_gates/preparing_bell_state/placeholder.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Kata { | ||
operation BellState (qs : Qubit[]) : Unit is Adj { | ||
// ... | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
katas/content/multi_qubit_gates/preparing_bell_state/reference.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Kata { | ||
operation BellState (qs : Qubit[]) : Unit is Adj { | ||
H(qs[0]); | ||
CNOT(qs[0], qs[1]); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
katas/content/multi_qubit_gates/preparing_bell_state/verify.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace Kata { | ||
open Microsoft.Quantum.Diagnostics; | ||
open Microsoft.Quantum.Intrinsic; | ||
|
||
operation BellStateReference (qs : Qubit[]) : Unit is Adj { | ||
body ... { | ||
H(qs[0]); | ||
CNOT(qs[0], qs[1]); | ||
} | ||
adjoint ... { | ||
CNOT(qs[0], qs[1]); | ||
H(qs[0]); | ||
} | ||
} | ||
|
||
operation Verify() : Bool { | ||
let task = BellState; | ||
let taskRef = BellStateReference; | ||
|
||
use targetRegister = Qubit[2]; | ||
|
||
task(targetRegister); | ||
Adjoint taskRef(targetRegister); | ||
|
||
if CheckAllZero(targetRegister) { | ||
task(targetRegister); | ||
DumpMachine(); | ||
return true; | ||
} | ||
|
||
ResetAll(targetRegister); | ||
|
||
// Use DumpMachine to display actual vs desired state. | ||
task(targetRegister); | ||
DumpMachine(); | ||
ResetAll(targetRegister); | ||
taskRef(targetRegister); | ||
DumpMachine(); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Single-Qubit Gates | ||
|
||
This tutorial introduces you to single-qubit gates. Quantum gates are the quantum counterpart to classical logic gates, acting as the building blocks of quantum algorithms. Quantum gates transform qubit states in various ways, and can be applied sequentially to perform complex quantum calculations. Single-qubit gates, as their name implies, act on individual qubits. You can learn more at [Wikipedia](https://en.wikipedia.org/wiki/Quantum_logic_gate). | ||
|
||
This tutorial covers the following topics: | ||
* Matrix representation | ||
* Ket-bra representation | ||
* The most important single-qubit gates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### Applying a global phase $i$ | ||
|
||
**Input:** A qubit in an arbitrary state $|\\psi\\rangle = \\alpha|0\\rangle + \\beta|1\\rangle$. | ||
|
||
**Goal:** Use several Pauli gates to change the qubit state to $i|\\psi\\rangle = i\\alpha|0\\rangle + i\\beta|1\\rangle$. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### The $Y$ gate | ||
|
||
**Input:** A qubit in an arbitrary state $|\\psi\\rangle = \\alpha|0\\rangle + \\beta|1\\rangle$. | ||
|
||
**Goal:** Apply the Y gate to the qubit, i.e., transform the given state into $i\\alpha|1\\rangle - i\\beta|0\\rangle$. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dist/ | ||
lib/ | ||
src/*.generated.* |
Oops, something went wrong.