summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r--Master/texmf-dist/doc/latex/qcircuit/Qtutorial.pdfbin261254 -> 307261 bytes
-rw-r--r--Master/texmf-dist/doc/latex/qcircuit/Qtutorial.tex133
-rw-r--r--Master/texmf-dist/doc/latex/qcircuit/README49
-rw-r--r--Master/texmf-dist/doc/latex/qcircuit/README.md56
4 files changed, 175 insertions, 63 deletions
diff --git a/Master/texmf-dist/doc/latex/qcircuit/Qtutorial.pdf b/Master/texmf-dist/doc/latex/qcircuit/Qtutorial.pdf
index 1d236ea01f5..9c9f56b5958 100644
--- a/Master/texmf-dist/doc/latex/qcircuit/Qtutorial.pdf
+++ b/Master/texmf-dist/doc/latex/qcircuit/Qtutorial.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/qcircuit/Qtutorial.tex b/Master/texmf-dist/doc/latex/qcircuit/Qtutorial.tex
index 446b6407f71..69e8bcd4206 100644
--- a/Master/texmf-dist/doc/latex/qcircuit/Qtutorial.tex
+++ b/Master/texmf-dist/doc/latex/qcircuit/Qtutorial.tex
@@ -8,16 +8,16 @@
\begin{document}
\lstset{language=TeX}
-\title{qcircuit 2.0 Tutorial}
+\title{qcircuit 2.5.2 Tutorial}
-\author{Original Authors: Bryan Eastin, Steven T. Flammia\\Edits: Travis L Scholten}
+\author{Original authors: Bryan Eastin, Steve T Flammia\\ Edits: Travis L Scholten}
\affiliation{Department of Physics and Astronomy, University of New
Mexico, Albuquerque, New Mexico 87131-0001, USA}
\begin{abstract}qcircuit is a list of macros that greatly simplifies the construction of
quantum circuit diagrams (QCDs) in \LaTeX \ with the help of the \Xy-pic
package. This tutorial should help the reader acquire
-the skill to render arbitrary QCDs in a matter of minutes. The source code for qcircuit is available for free\footnote{The qcircuit package is distributed under the GNU public license.} at \href{https://github.com/CQuIC-GitHub/qcircuit/tree/master}{https://github.com/CQuIC-GitHub/qcircuit/tree/master}.
+the skill to render arbitrary QCDs in a matter of minutes. The source code for qcircuit is available for free\footnote{The qcircuit package is distributed under the GNU public license.} on the \href{CQuIC GitHub page}{https://github.com/CQuIC/qcircuit}.
\end{abstract}
\maketitle
@@ -105,7 +105,6 @@ We demonstrate the commands below along with their respective outputs:
\end{tabular}
\end{center}
-To enable bras and kets, call qcircuit using the \verb=braket= option. To enable quantum mechanics commands, call the option \verb=qm=.
\section{Simple Quantum Circuits\label{S:basics}}
To begin, suppose the reader would like to typeset the following
@@ -175,7 +174,19 @@ wires at the beginning by inserting the \verb=&= character at the start of each
& \gate{U^\dag} & \qw
} \]\end{verbatim}}
-The only difference between these two codes is that the correct code has an ampersand (\verb=&=) at the start of each new line.
+The only difference between these two codes is that the correct code has an ampersand (\verb=&=) at the start of each new line.\\
+
+To indicate the end of a circuit simply use the \verb=\qwa= command as the last wire.
+
+\[ \Qcircuit @C=1em @R=.7em {
+ & \gate{U} & \qwa \\
+ & \gate{U^\dag} & \qwa
+} \]
+
+{\small \begin{verbatim}\[ \Qcircuit @C=1em @R=.7em {
+ & \gate{U} & \qwa \\
+ & \gate{U^\dag} & \qwa
+} \]\end{verbatim}}
\subsection{CNOT and other controlled single qubit gates \label{S:CNOT}}
@@ -265,6 +276,29 @@ typeset with
\lstick{\ket{1}} & \ctrl{-1} & \rstick{\ket{1}} \qw
}\end{verbatim}}
+There are a few options for labelling multi-qubit input states, as well.
+
+
+\[ \Qcircuit @C=1em @R=1.6em {
+ \lstick{} & \qw & \qw \\
+ \lstick{} & \qw & \qw \inputgroup{1}{2}{.75em}{\ket{0^k}}\\
+ \lstick{} & \qw & \qw \\
+ \lstick{} & \qw & \qw \inputgroupv{3}{4}{.8em}{.8em}{\ket{\psi}}\\
+ \lstick{A} & \qw & \qw \\
+ \lstick{B} & \qw & \qw \inputgrouph{5}{6}{.75em}{\ket{\psi}}{2.2em}
+ }\]
+typeset with
+{\small \begin{verbatim}\Qcircuit @C=1em @R=1.6em {
+ \lstick{} & \qw & \qw \\
+ \lstick{} & \qw & \qw
+ \inputgroup{1}{2}{.75em}{\ket{0^k}}\\
+ \lstick{} & \qw & \qw \\
+ \lstick{} & \qw & \qw
+ \inputgroupv{3}{4}{.8em}{.8em}{\ket{\psi}}\\
+ \lstick{A} & \qw & \qw \\
+ \lstick{B} & \qw & \qw
+ \inputgrouph{5}{6}{.75em}{\ket{\psi}}{2.2em}
+ }\end{verbatim}}
\section{More Complicated Circuits: Multiple Qubit Gates and Beyond}
@@ -316,6 +350,22 @@ with the label for the gate is needed. Strictly speaking, the name of the gate
Note that controls to multiple qubit gates work the same as for single
qubit gates, using \verb=\ctrl= and \verb=\qwx=.
+Sometimes a multi-qubit gate must be applied to qubits which are \emph{not} on adjacent rows (and as such, the \verb=\multigate= command is not suitable). To account for this, the \verb=\sgate= command can be used to ``hook together'' the application of a multi-qubit gate on non-adjacent qubits:
+
+{\scriptsize \begin{verbatim}\\Qcircuit @C=1em @R=.7em {
+ & \multigate{1}{\mathcal{F}} & \sgate{\mathcal{G}}{2} & \qw \\
+ & \ghost{\mathcal{F}} & \qw & \qw\\
+ & \qw & \gate{\mathcal{G}} & \qw \\
+}\end{verbatim}}
+\noindent which yields
+\[ \Qcircuit @C=1em @R=.7em {
+ & \multigate{1}{\mathcal{F}} & \sgate{\mathcal{G}}{2} & \qw \\
+ & \ghost{\mathcal{F}} & \qw & \qw\\
+ & \qw & \gate{\mathcal{G}} & \qw \\
+}\]
+
+Such notation may be a bit confusing, admittedly. An alternative circuit which does use the \verb=\multigate= command would have a step where qubits 2 and 3 above were swapped, then the two-qubit gate $\mathcal{G}$ was applied, and finally the qubits were swapped back.
+
\subsection{Measurements and classical bits}
Measurement gates are typeset just like ordinary gates, but they typically have some sort of decoration to indicate that measurement has occurred. At present, Q-circuit supports the following single qubit measurement gates.
@@ -329,7 +379,11 @@ Measurement gates are typeset just like ordinary gates, but they typically have
\Qcircuit @C=1em @R=.7em {& \measuretab{M_{ijk}}} \hspace{.5em}
& \verb=\measuretab= & \verb=\measuretab{M_{ijk}}=\\
\Qcircuit @C=1em @R=.7em {& \measureD{\chi}}
- & \verb=\measureD= & \verb=\measureD{\chi}=
+ & \verb=\measureD= & \verb=\measureD{\chi}=\\\\
+ \Qcircuit @C=1em @R=1.5em{ &\meterB{\ket{\xi_\pm}}}
+ & \verb=\meterB= & \verb=\meterB{\ket{\xi_\pm}}=\\
+ \Qcircuit @C=1em @R=1.5em{ &\metersymb}
+ & \verb=\metersymb= & \verb=\metersymb=
\end{tabular}
\end{center}}
@@ -346,6 +400,14 @@ Here is an example using measurement gates and classical wires and the correspon
\rstick{\cdots} \cw
}\end{verbatim}}
+If you are using a special basis for your measurements the \verb=\meterB= command allows you to indicate the basis.
+\[\Qcircuit @C=1em @R=1.5em {
+ \lstick{\ket{\psi}} & \meterB{\ket{\xi_\pm}} & \cw
+}\]
+{\small \begin{verbatim}\Qcircuit @C=1em @R=1.5em {
+ \lstick{\ket{\psi}} & \meterB{\ket{\xi_\pm}} & \cw
+}\end{verbatim}}
+
Q-circuit also includes the commands \verb=\multimeasure= and \verb=\multimeasureD= for typesetting measurements on multiple qubits. The syntax for these commands exactly parallels that of the \verb=\multigate= command (see \S\ref{S:multigate}). An example is shown below.
\[\Qcircuit @C=1em @R=.7em {
& \multimeasureD{1}{\text{Bell}} \\
@@ -356,6 +418,19 @@ Q-circuit also includes the commands \verb=\multimeasure= and \verb=\multimeasur
& \ghost{\text{Bell}}
}\end{verbatim}}
+ In addition, if the measurement must be done on qubits which are \emph{not} adjacent, Q-circuit provides for the \verb=\smeterB= command, which, similar to the \verb=\sgate= command, allows one to split the measurement:
+
+ \[ \Qcircuit @C=1em @R=.7em {
+ & \smeterB{\ket{\xi_{\pm}}}{2} & \qw \\
+ & \qw & \qw\\
+ & \gate{\ket{\xi_{\pm}}} & \qw \\
+}\]
+{\small \begin{verbatim} \Qcircuit @C=1em @R=.7em {
+ & \smeterB{\ket{\xi_{\pm}}}{2} & \qw \\
+ & \qw & \qw\\
+ & \gate{\ket{\xi_{\pm}}} & \qw \\
+}\end{verbatim}}
+
\subsection{Non-gate inserts, forcing space, and swap \label{S:inserts}}
In addition to the gates defined by Q-circuit, standard \LaTeX\ can function as a gate if enclosed in curly brackets. By default, inputs are assumed to have zero size, so no space will be made for the resulting object and any wires connecting to it will run straight to the object's middle. Standard \LaTeX\ entries can serve as labels or wire decorations.
@@ -378,20 +453,38 @@ Here is a circuit that shows how to construct swap, decorate wires, and use \ver
& {/} \qw & \gate{H^{\otimes n}} & \qw
}\end{verbatim}}
+To indicate a generalized circuit with $n$ iterations of something, you could use the \verb=\cds= command.
+\[\Qcircuit @C=1em @R=.7em {
+ & \targ & \targ & \cds{4}{\cdots} & \targ & \qw\\
+ & \ctrl{-1} & \qw &\qw & \qw & \qw \\
+ & \qw & \ctrl{-2} & \qw & \qw & \qw \\
+ & & & & & \\
+ & \qw & \qw & \qw & \ctrl{-4} & \qw \\
+}\]
+{\small \begin{verbatim}\Qcircuit @C=1em @R=.3em {
+ & \targ & \targ & \cds{4}{\cdots} & \targ & \qw\\
+ & \ctrl{-1} & \qw &\qw & \qw & \qw \\
+ & \qw & \ctrl{-2} & \qw & \qw & \qw \\
+ & & & & & \\
+ & \qw & \qw & \qw & \ctrl{-4} & \qw \\
+}\end{verbatim}}
+
\subsection{How to control anything}
-Controlled-Z gates, wires with bends, and gates that control-on-zero can all be made using the extended family of control commands. The complete family of control commands is \verb=\ctrl=, \verb=\crtlo=, \verb=\control=, and \verb=\controlo=.
+Controlled-Z gates, wires with bends, and gates that control-on-zero can all be made using the extended family of control commands. The complete family of control commands is \verb=\ctrl=, \verb=\cctrl=, \verb=\ctrlo=, \verb=\cctrlo=, \verb=\control=, and \verb=\controlo=.
\verb=\ctrlo= is identical to the \verb=\ctrl= command (see \S\ref{S:CNOT}) except that it draws an open bullet (indicating control-on-zero). Both commands place a wire to the left and take one argument indicating which wire to connect to.
+The commands \verb=\cctrl= and \verb=\cctrlo= are identical to the \verb=\ctrl= and \verb=\ctrlo= commands, respectively, except they use \emph{classical wires} instead of quantum ones to do the controlling. These commands may be useful for writing circuits where the gates are conditioned on classical outputs.
+
The commands \verb=\control= and \verb=\controlo= are isolated controls; they don't automatically connect to anything. Isolated controls allow you to decide exactly what connections are made to your control operator, which makes them very useful for working with classical wires and rendering things like the controlled-Z.
Here is an example circuit using various controls.
\[ \Qcircuit @C=1em @R=.7em {
& \ctrl{2} & \ctrlo{1} & \ctrl{1} & \qw & \multigate{1}{U} & \qw \\
& \qw & \targ & \ctrlo{2} \qw & \ctrl{1} & \ghost{U} & \qw\\
- & \control \qw & \ctrl{1} & \qw & \meter & \controlo \cw \cwx &\\
- & \qw & \control \qw & \gate{H} & \meter & \control \cw \cwx
+ & \control \qw & \ctrl{1} & \qw & \meter & \cctrlo{-1} &\\
+ & \qw & \control \qw & \gate{H} & \meter & \cctrl{-1}
}\]
{\small \begin{verbatim}\Qcircuit @C=1em @R=.7em {
@@ -400,9 +493,9 @@ Here is an example circuit using various controls.
& \qw & \targ & \ctrlo{2} \qw
& \ctrl{1} & \ghost{U} & \qw \\
& \control \qw & \ctrl{1} & \qw
- & \meter & \controlo \cw \cwx \\
+ & \meter & \cctrlo{-1} \\
& \qw & \control \qw & \gate{H}
- & \meter & \control \cw \cwx
+ & \meter & \cctrl{-1}
}\end{verbatim}}
Note that we, the authors, have used a pair of controls connected by a wire to denote the controlled-Z gate. This isn't standard notation, but we feel it is a logically consistent and concise notation, and it illustrates nicely the symmetry of the controlled-Z gate. We hope to encourage the readers to adopt this notation in their own QCDs.
@@ -579,25 +672,33 @@ The following table is grouped according to the effect of each command.\\
@!R \\
@!C \\
@! \\
- \char92 push\{\#1\}} \\
+ \char92 push\{\#1\} \\
+ \char92 cds\{\#1\}\{\#2\}}\\
Wires & \parbox[t]{6cm}{\tt
\char92 qw[\#1] \\
\char92 qwx[\#1] \\
+ \char92 qwa[\#1] \\
\char92 cw[\#1] \\
+ \char92 cwa[\#1] \\
\char92 cwx[\#1] }\\
Gates & \parbox[t]{6cm}{\tt
\char92 gate\{\#1\} \\
\char92 targ \\
\char92 qswap \\
\char92 multigate\{\#1\}\{\#2\} \\
+ \char92 sgate\{\#1\}\{\#2\}\\
\char92 ghost\{\#1\} }\\
Controls & \parbox[t]{6cm}{\tt
\char92 ctrl\{\#1\} \\
\char92 ctrlo\{\#1\} \\
+ \char92 cctrl\{\#1\} \\
+ \char92 cctrlo\{\#1\} \\
\char92 control \\
\char92 controlo } \\
Measurements & \parbox[t]{6cm}{\tt
\char92 meter \\
+ \char92 meterB\{\#1\} \\
+ \char92 smeterB\{\#1\}\{\#2\} \\
\char92 measure\{\#1\} \\
\char92 measureD\{\#1\} \\
\char92 measuretab\{\#1\} \\
@@ -610,8 +711,12 @@ The following table is grouped according to the effect of each command.\\
\char92 dstick\{\#1\} \\
\char92 bra\{\#1\} \\
\char92 ket\{\#1\} \\
- \char92 gategroup\{\#1\}\{\#2\}\{\#3\}\{\#4\}\{\#5\}\{\#6\} }
+ \char92 gategroup\{\#1\}\{\#2\}\{\#3\}\{\#4\}\{\#5\}\{\#6\}\\
+ \char92 inputgroup\{\#1\}\{\#2\}\{\#3\}\{\#4\}\\
+ \char92 inputgroupv\{\#1\}\{\#2\}\{\#3\}\{\#4\}\{\#5\}\\
+ \char92 inputgrouph\{\#1\}\{\#2\}\{\#3\}\{\#4\}\{\#5\}\\
+ }
\end{tabular}
\end{center}}
-\end{document} \ No newline at end of file
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/qcircuit/README b/Master/texmf-dist/doc/latex/qcircuit/README
deleted file mode 100644
index 7d18a25f94d..00000000000
--- a/Master/texmf-dist/doc/latex/qcircuit/README
+++ /dev/null
@@ -1,49 +0,0 @@
-qcircuit 2.0
-============
-qcircuit is a list of macros that greatly simplifies the construction of quantum circuit diagrams (QCDs) in LaTeX with the help of the Xy-pic package.
-
-The original website for this project may be found at http://physics.unm.edu/CQuIC/Qcircuit/ through the Center for Quantum Information and Control.
-A newer page is available through https://github.com/CQuIC-GitHub/qcircuit/tree/master.
-
-Installation
-========
-**Dependencies**
-
-qcircuit depends on the xy-pic (http://www.tug.org/applications/Xy-pic/) and ifpdf (http://www.ctan.org/pkg/ifpdf) packages.
-
-**Simple Install**
-
-The simplest way to use qcircuit is to download the file qcircuit.sty and put that file in the same folder as the tex document you are compiling. Within the document preamble, use \usepackage[options]{qcircuit} to enable TeX to compile the circuit. See the Use section of this README file for more information.
-
-**More Complicated (but more helpful) Way**
-
-A slightly more complicated way involves putting qcircuit in your TeX tree so that every time you compile your file TeX sees the qcircuit.sty file. This avoids the hassle of copying the file all over the place.
-
-To do so, first locate the tex/latex subdirectory of your TeX tree. For Mac OS X users, this is located at users/user_name/Library/texmf/tex/latex/Qcircuit, where user_name is the user name you use for your login. For Windows users, this folder is located at C:\Program Files\texmf\tex\latex\Qcircuit. To update the tree, run initexmf --update-fndb from your command line.
-
-For Linux users, one needs to locate the root TeX directory. Use the command locate:texmf to find all directories with a texmf folder. Then, after finding an appropriate folder into which qcircuit.sty can be put, execute the texhash command to update the tree.
-
-Use
-======
-Upon successful installation, one simply calls \usepackage[options]{qcircuit} to enable circuit-drawing functionality. Currently, we have support for two options:
-
-* `braket`: This option provides the standard Dirac bras `\bra{A}` and kets `\ket{A}`
-* `qm`: This options provides an inner product `\ip{A}{B}`, an outer product `\op{A}{B}`, a matrix element `{j}{M}{k}`, and an expectation value `\expval{M}`.
-
-By default, none of these options are enabled, meaning if you want access to these commands, you must explicity provide them in your package call. This way, we avoid clashes with user-defined commands.
-
-Tutorial
-=========
-A simple way to check you successfully installed qcircuit is to download the Qtutorial.tex file and run it in your favorite TeX compiler. Should the document compile correctly, you are ready to use qcircuit in your own documents! (Note: By default, we enabled our predefined commands within the document preamble for this file.) By inspecting the figures produced and comparing with the source code, you should obtain an understanding of how to typset your own circuits.
-
-Help
-=======
-
-As the installation instructions indicate, qcircuit must be manually inserted into a users' TeX tree. This presents complications insofar as trees may vary in structure and location across different operating systems. We will be working on making qcircuit a LaTeX package hosted on CTAN such that one simply downloads the package with their favorite package manager, and calls `\usepackage[options]{qcircuit}` to enable functionality. In the meantime, one is simply forced to hack one's way into having this functionality.
-
-A general FAQ can be found at http://physics.unm.edu/CQuIC/Qcircuit/QcircuitFAQ.html.
-
-License
-========
-This software is licensed under a GPLv2 license, available at https://www.gnu.org/licenses/gpl-2.0.html. See the corresponding documentation for a description your rights and obligations.
-
diff --git a/Master/texmf-dist/doc/latex/qcircuit/README.md b/Master/texmf-dist/doc/latex/qcircuit/README.md
new file mode 100644
index 00000000000..7599f6fdaac
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/qcircuit/README.md
@@ -0,0 +1,56 @@
+qcircuit
+==========
+
+A quantum circuit drawing application.
+
+The original website for this project may be found on the [qcircuit page](http://physics.unm.edu/CQuIC/Qcircuit/) through the Center for Quantum Information and Control. We use the GitHub [wiki](https://github.com/CQuIC/qcircuit/wiki) pages to make more information about qcircuit available.
+
+We welcome others to fork our project and include enhancements. See the [Issues list](https://github.com/CQuIC/qcircuit/issues?q=is%3Aopen) for requested updates and features.
+
+Installation
+========
+**Dependencies**
+
+qcircuit depends on the [xy-pic](http://www.tug.org/applications/Xy-pic/) and [ifpdf](http://www.ctan.org/pkg/ifpdf) packages.
+
+**Through a TeX package manager**
+
+qcircuit has been added to the Comprehensive Tex Archive Network (CTAN), and so can be accessed through a package manager for your TeX distribution. The package name is `qcircuit`. Should you be inclined to do so, the source files may be downloaded from [this page](http://ctan.org/pkg/qcircuit), though they contain all the same files available through GitHub.
+
+How to use this manager varies from distribution to distribution; there is a [Wikipedia page](https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages) which describes some of the more common ways to do so.
+
+**Simple Install**
+
+The simplest way to use qcircuit is to download the file `qcircuit.sty` and put that file in the same folder as the tex document you are compiling. Within the document preamble, use `\usepackage[options]{qcircuit}` to enable TeX to compile the circuit. See the Use section of this README for more information.
+
+**More Complicated (but more helpful) Way**
+
+*Note*: Using a TeX package manager takes care of putting the files in the right places in your TeX tree; we recommend users no longer use the approach below, and instead use the manager.
+
+A slightly more complicated way involves putting qcircuit in your TeX tree so that every time you compile your file TeX sees the `qcircuit.sty` file. This avoids the hassle of copying the file all over the place.
+
+To do so, first locate the `tex/latex` subdirectory of your TeX tree. For Mac OS X users, this is located at `users/user_name/Library/texmf/tex/latex/Qcircuit`, where `user_name` is the user name you use for your login. For Windows users, this folder is located at `C:\Program Files\texmf\tex\latex\Qcircuit`. To update the tree, run `initexmf --update-fndb` from your command line.
+
+For Linux users, one needs to locate the root TeX directory. Use the command `locate:texmf` to find all directories with a `texmf` folder. Then, after finding an appropriate folder into which `qcircuit.sty` can be put, execute the `texhash` command to update the tree.
+
+Use
+======
+Upon successful installation, one simply calls `\usepackage[options]{qcircuit}` to enable circuit-drawing functionality. Currently, we provide support for two options:
+
+* `braket`: This option provides the standard Dirac bras `\bra{A}` and kets `\ket{A}`
+* `qm`: This options provides an inner product `\ip{A}{B}`, an outer product `\op{A}{B}`, a matrix element `{j}{M}{k}`, and an expectation value `\expval{M}`.
+
+By default, none of these options are enabled, meaning if you want access to these commands, you must explicity provide them in your package call. In this way we avoid clashes with user-defined commands. For users who have defined their own commands, we welcome any feedback you may have regarding how ours are defined. Simply submit an issue and we will take a look at it.
+
+Tutorial
+=========
+A simple way to check you successfully installed qcircuit is to download the `Qtutorial.tex` file and run it in your favorite TeX compiler. Should the document compile correctly, you are ready to use qcircuit in your own documents! By inspecting the figures produced and comparing with the source code, you should obtain an understanding of how to typset your own circuits.
+
+Help
+=======
+A general FAQ can be found [on the wiki](https://github.com/CQuIC-GitHub/qcircuit/wiki/FAQ). Questions can be emailed to user Travis-S.
+
+License
+========
+This software is licensed under a [GPLv2 license](https://www.gnu.org/licenses/gpl-2.0.html). See the corresponding documentation for a description of your rights and obligations.
+