Skip to content

Commit

Permalink
Add magic state distillation example
Browse files Browse the repository at this point in the history
  • Loading branch information
Strilanc committed Mar 23, 2019
1 parent 631df9b commit ff9f3c3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion html/menu.partial.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</a>
</div>
</div>
<div style="display:inline-block; vertical-align:top; line-height:1.8; padding:15px 15px 15px 5px; background-color:#DDD; border:1px solid gray; margin:10px 0 0 -5px;">
<div style="display:inline-block; vertical-align:top; line-height:1.8; padding:15px 15px 15px 5px; background-color:#DDD; border:1px solid gray; margin:0 0 0 -5px;">
Example Circuits<br>
<a id="example-anchor-grover">Grover Search</a><br>
<a id="example-anchor-shor">Shor Period Finding</a><br>
Expand All @@ -50,6 +50,7 @@
<a id="example-symmetry-break">Symmetry Breaking</a><br>
<a id="example-qft">Quantum Fourier Transform</a><br>
<a id="example-addition">Reversible Addition</a><br>
<a id="example-anchor-distill">Magic State Distillation</a><br>
</div>
</div>
</div>
36 changes: 35 additions & 1 deletion src/ui/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,38 @@ const shorLink = {
{"id":"~out","name":"out:","matrix":"{{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}}"}
]
};
const distillLink = {
"cols":[
["H","H","H","H","H"],
[1,"Z","Z","Z",1,"⊖"],
[1,"Z","Z",1,"Z",1,"⊖"],
[1,"Z",1,"Z","Z",1,1,"⊖"],
[1,1,"Z","Z","Z",1,1,1,"⊖"],
["Z","Z","Z","Z","Z",1,1,1,1,"⊖"],
["Z",1,1,"Z","Z",1,1,1,1,1,"⊖"],
["Z",1,"Z",1,"Z",1,1,1,1,1,1,"⊖"],
["Z","Z",1,1,"Z",1,1,1,1,1,1,1,"⊖"],
["Z",1,"Z","Z",1,1,1,1,1,1,1,1,1,"⊖"],
["Z","Z",1,"Z",1,1,1,1,1,1,1,1,1,1,"⊖"],
["Z","Z","Z",1,1,1,1,1,1,1,1,1,1,1,1,"⊖"],
[1,"Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼","Z^¼"],
[1,"H","H","H","H","H","H","H","H","H","H","H","H","H","H","H"],
[1,"Measure","Measure","Measure","Measure","Measure","Measure","Measure","Measure","Measure","Measure","Measure","Measure","Measure","Measure","Measure"],
[1,"X","X","X",1,"•"],
[1,"X","X",1,"X",1,"•"],
[1,"X",1,"X","X",1,1,"•"],
[1,1,"X","X","X",1,1,1,"•"],
["Z","X","X","X","X",1,1,1,1,"•"],
["Z",1,1,"X","X",1,1,1,1,1,"•"],
["Z",1,"X",1,"X",1,1,1,1,1,1,"•"],
["Z","X",1,1,"X",1,1,1,1,1,1,1,"•"],
["Z",1,"X","X",1,1,1,1,1,1,1,1,1,"•"],
["Z","X",1,"X",1,1,1,1,1,1,1,1,1,1,"•"],
["Z","X","X",1,1,1,1,1,1,1,1,1,1,1,1,"•"],
["X","Chance4"],
["Amps1","|0⟩⟨0|","|0⟩⟨0|","|0⟩⟨0|","|0⟩⟨0|"]
]
};

/**
* @param {!Revision} revision
Expand Down Expand Up @@ -275,6 +307,7 @@ function initMenu(revision, obsIsAnyOverlayShowing) {
const chshTestAnchor = /** @type {!HTMLAnchorElement} */ document.getElementById('example-chsh-test');
const qftAnchor = /** @type {!HTMLAnchorElement} */ document.getElementById('example-qft');
const shorAnchor = /** @type {!HTMLAnchorElement} */ document.getElementById('example-anchor-shor');
const distillAnchor = /** @type {!HTMLAnchorElement} */ document.getElementById('example-anchor-distill');

for (let [a, t] of [[groverAnchor, groverLink],
[shorAnchor, shorLink],
Expand All @@ -284,7 +317,8 @@ function initMenu(revision, obsIsAnyOverlayShowing) {
[superdenseCodeAnchor, superdenseCodingLink],
[symmetryBreakAnchor, symmetryBreakingLink],
[chshTestAnchor, chshTestLink],
[qftAnchor, qftLink]]) {
[qftAnchor, qftLink],
[distillAnchor, distillLink]]) {
let text = JSON.stringify(t);
a.href = "#circuit=" + text;
a.onclick = ev => {
Expand Down

0 comments on commit ff9f3c3

Please sign in to comment.