From ae34f484404571c09a61f3bde45d083a51cb0ac5 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 18 Aug 2021 03:00:59 +0000 Subject: CTAN sync 202108180300 --- graphics/pgf/contrib/yquant/README.md | 75 ++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 23 deletions(-) (limited to 'graphics/pgf/contrib/yquant/README.md') diff --git a/graphics/pgf/contrib/yquant/README.md b/graphics/pgf/contrib/yquant/README.md index d8d8e1afaa..e8f39e3df0 100644 --- a/graphics/pgf/contrib/yquant/README.md +++ b/graphics/pgf/contrib/yquant/README.md @@ -7,16 +7,18 @@ It builds on and interacts with TiKZ, which brings an enourmous flexibility for A detailed reference with lots of examples is provided in the PDF version of this Readme. We will sketch some basic usage. -Now yquant also understands circuits written in the qasm language! +Now yquant also understands circuits written in the qasm language and provides a simple interface for circuit equations! -## License -This material is subject to the LaTeX Project Public License 1.3c. +Support the development: +- [![PayPal](https://img.shields.io/badge/donate-via%20PayPal-blue.svg?style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UTR3MRBYJ825A&source=url) +- ![Bitcoin](https://img.shields.io/badge/donate-BTC-blue.svg?style=flat) 3KBFpoJuA4eSPLGXEf3jicqaV1czhK36fH +- ![Ethereum](https://img.shields.io/badge/donate-ETH-blue.svg?style=flat) 0xE0F774221290b1E41ea62c2dd9af5dbD3df7c685 ## Examples -Many more examples and explanations can be found in the [PDF version](https://github.com/projekter/yquant/raw/master/doc/latex/yquant/yquant-doc.pdf) of this Readme. +Many more examples and explanations can be found in the [PDF version](doc/latex/yquant/yquant-doc.pdf) of this Readme. ### Simple teleportation circuit -![ex-01.png](https://github.com/projekter/yquant/raw/master/markdown/ex-01.png) +![ex-01.png](markdown/ex-01.png) ```LaTeX \begin{tikzpicture} \begin{yquant} @@ -35,7 +37,7 @@ Many more examples and explanations can be found in the [PDF version](https://gi ``` ### Three-qubit phase estimation circuit with QFT and controlled-U -![ex-02.png](https://github.com/projekter/yquant/raw/master/markdown/ex-02.png) +![ex-02.png](markdown/ex-02.png) ```LaTeX \begin{tikzpicture} \begin{yquant} @@ -58,7 +60,7 @@ Many more examples and explanations can be found in the [PDF version](https://gi ``` ### Three-qubit FT QEC circuit with syndrome measurement -![ex-03.png](https://github.com/projekter/yquant/raw/master/markdown/ex-03.png) +![ex-03.png](markdown/ex-03.png) ```LaTeX \begin{tikzpicture} \begin{yquant} @@ -93,34 +95,39 @@ Many more examples and explanations can be found in the [PDF version](https://gi ``` ### Error correction -![ex-04.png](https://github.com/projekter/yquant/raw/master/markdown/ex-04.png) +![ex-04.png](markdown/ex-04.png) ```LaTeX -% \usetikzlibrary{fit, quotes} +% \usetikzlibrary{quotes} \begin{tikzpicture} \begin{yquant} qubit {} msg[3]; - [name=inits] - qubit {$\ket0$} syndrome[3]; - - [name=scnot0] - cnot syndrome[0] | msg[0]; - cnot syndrome[0] | msg[1]; - cnot syndrome[1] | msg[1]; - cnot syndrome[1] | msg[2]; - cnot syndrome[2] | msg[0]; - cnot syndrome[2] | msg[2]; - [name=smeas] - dmeter {$M_{\symbol{\numexpr`a+\idx}}$} syndrome; + nobit syndrome[3]; + + [this subcircuit box style={dashed, "Syndrome Measurement"}] + subcircuit { + qubit {} msg[3]; + [out] + qubit {$\ket0$} syndrome[3]; + + cnot syndrome[0] | msg[0]; + cnot syndrome[0] | msg[1]; + cnot syndrome[1] | msg[1]; + cnot syndrome[1] | msg[2]; + cnot syndrome[2] | msg[0]; + cnot syndrome[2] | msg[2]; + + dmeter {$M_{\symbol{\numexpr`a+\idx}}$} syndrome; + } (msg[-2], syndrome[-2]); + ["Recovery"] box {$\mathcal R$} (msg) | syndrome; discard syndrome; \end{yquant} - \node[draw, dashed, fit=(inits-2) (scnot0-p0) (smeas-2), "Syndrome Measurement"] {}; \end{tikzpicture} ``` ### Lots of controls -![ex-05.png](https://github.com/projekter/yquant/raw/master/markdown/ex-05.png) +![ex-05.png](markdown/ex-05.png) ```LaTeX \begin{tikzpicture} \begin{yquant*} @@ -133,4 +140,26 @@ Many more examples and explanations can be found in the [PDF version](https://gi discard a[2, 3]; \end{yquant*} \end{tikzpicture} +``` + +### Circuit equations +![ex-06.png](markdown/ex-06.png) +```LaTeX +% \useyquantlanguage{groups} +\begin{tikzpicture} + \begin{yquantgroup} + \registers{ + qubit {} q[2]; + } + \circuit{ + h -; + cnot q[1] | q[0]; + h -; + } + \equals + \circuit{ + cnot q[0] | q[1]; + } + \end{yquantgroup} +\end{tikzpicture} ``` \ No newline at end of file -- cgit v1.2.3