From ff9f3c39539fea567e28ff1b66221297faab6c54 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Sat, 23 Mar 2019 13:41:10 -0700 Subject: [PATCH] Add magic state distillation example --- html/menu.partial.html | 3 ++- src/ui/menu.js | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/html/menu.partial.html b/html/menu.partial.html index 0ebb87bc..fd1a1db3 100644 --- a/html/menu.partial.html +++ b/html/menu.partial.html @@ -39,7 +39,7 @@ -
+
Example Circuits
Grover Search
Shor Period Finding
@@ -50,6 +50,7 @@ Symmetry Breaking
Quantum Fourier Transform
Reversible Addition
+ Magic State Distillation
diff --git a/src/ui/menu.js b/src/ui/menu.js index a6654855..c3646ccf 100644 --- a/src/ui/menu.js +++ b/src/ui/menu.js @@ -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 @@ -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], @@ -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 => {