summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--Master/texmf-dist/tex/latex/qcircuit/qcircuit.sty68
5 files changed, 224 insertions, 82 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.
+
diff --git a/Master/texmf-dist/tex/latex/qcircuit/qcircuit.sty b/Master/texmf-dist/tex/latex/qcircuit/qcircuit.sty
index bf946def860..190683cc9f6 100644
--- a/Master/texmf-dist/tex/latex/qcircuit/qcircuit.sty
+++ b/Master/texmf-dist/tex/latex/qcircuit/qcircuit.sty
@@ -1,4 +1,4 @@
-% Q-circuit version 2.0
+% qcircuit version 2.5.2
% Contributors: Steve Flammia, Bryan Eastin, Travis Scholten
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
@@ -19,20 +19,20 @@
% Thanks also to Dave Clader, Andrew Childs, Rafael Possignolo, Tyson Williams,
% Sergio Boixo, Cris Moore, Jonas Anderson, and Stephan Mertens for helping us test
% and/or develop the new version.
-\ProvidesPackage{qcircuit}[2014/06/29]
+\ProvidesPackage{qcircuit}[2016/04/06]
\RequirePackage{xy}
\DeclareOption{braket}{
- \newcommand{\bra}[1]{\ensuremath{\left\langle{#1}\right\vert}}
- \newcommand{\ket}[1]{\ensuremath{\left\vert{#1}\right\rangle}}
-}
+ \newcommand{\bra}[1]{\ensuremath{\left\langle{#1}\right\vert}}
+ \newcommand{\ket}[1]{\ensuremath{\left\vert{#1}\right\rangle}}
+ }
\DeclareOption{qm}{
- \newcommand{\ip}[2]{\ensuremath{\left\langle{#1}\right\vert{#2}\rangle}}
- \newcommand{\melem}[3]{\ensuremath{\left\langle{#1}\right\vert{#2}\vert{#3}\rangle}}
- \newcommand{\expval}[1]{\ensuremath{\left\langle #1 \right\rangle}}
- \newcommand{\op}[2]{\ensuremath{\vert{#1}\rangle\langle{#2}\vert}}
-}
+ \newcommand{\ip}[2]{\ensuremath{\left\langle{#1}\right\vert{#2}\rangle}}
+ \newcommand{\melem}[3]{\ensuremath{\left\langle{#1}\right\vert{#2}\vert{#3}\rangle}}
+ \newcommand{\expval}[1]{\ensuremath{\left\langle #1 \right\rangle}}
+ \newcommand{\op}[2]{\ensuremath{\vert{#1}\rangle\langle{#2}\vert}}
+ }
\ProcessOptions\relax
@@ -44,13 +44,11 @@
\usepackage{ifpdf}
\ifpdf
\else
-\PackageWarningNoLine{Qcircuit}{qcircuit is loading in Postscript mode. The Xy-pic options ps and dvips will be loaded. If you wish to use other Postscript drivers for Xy-pic, you must modify the code in qcircuit.sty}
-% The following options load the drivers most commonly required to
-% get proper Postscript output from Xy-pic. Should these fail to work,
-% try replacing the following two lines with some of the other options
-% given in the Xy-pic reference manual.
-\xyoption{ps}
-\xyoption{dvips}
+\PackageWarningNoLine{Qcircuit}{qcircuit is not loading in PDF mode. Activating all Xy-pic features to compensate. If you wish to use specific drivers for Xy-pic, you must modify the code in qcircuit.sty}
+% The following option loads all the features in Xy-pic. This
+% this is included as work-around to ensure documents compile
+% images correctly when using XeLaTeX.
+\xyoption{all}
\fi
% The following resets Xy-pic matrix alignment to the pre-3.8 default, as
@@ -63,14 +61,26 @@
\newcommand{\qwx}[1][-1]{\ar @{-} [#1,0]}
% Defines a wire that connects vertically. By default it connects to the object above the current object.
% WARNING: Wire commands must appear after the gate in any given entry.
+\newcommand{\qwa}[1][-1]{\ar @{<-} [0,#1]}
+ % Defines a wire that connects horizontally with an arrow. By default it makes an end wire with an arrow indicating the end of the circuit.
+ % WARNING: Wire commands must appear after the gate in any given entry.
\newcommand{\cw}[1][-1]{\ar @{=} [0,#1]}
% Defines a classical wire that connects horizontally. By default it connects to the object on the left of the current object.
% WARNING: Wire commands must appear after the gate in any given entry.
\newcommand{\cwx}[1][-1]{\ar @{=} [#1,0]}
% Defines a classical wire that connects vertically. By default it connects to the object above the current object.
% WARNING: Wire commands must appear after the gate in any given entry.
+\newcommand{\cwa}[1][-1]{\ar @{<=} [0,#1]}
+ % Defines a classical wire that connects horizontally with an arrow. By default it makes an end wire with an arrow indicating the end of the circuit.
+ % WARNING: Wire commands must appear after the gate in any given entry.
+\newcommand{\cds}[2]{*+<1em,.9em>{\hphantom{#2}} \POS [0,0].[#1,0]="e",!C *{#2};"e"+ R \qw}
+ % Allows the insertion of text without a box and exands circuit around this text.
+ % This is useful for such things as ... to indicate a generalized circuit.
\newcommand{\gate}[1]{*+<.6em>{#1} \POS ="i","i"+UR;"i"+UL **\dir{-};"i"+DL **\dir{-};"i"+DR **\dir{-};"i"+UR **\dir{-},"i" \qw}
% Boxes the argument, making a gate.
+\newcommand{\sgate}[2]{\gate{#1} \qwx[#2]}
+ % Creates a gate and a qwx wire going #2 spots below, for a gate split over
+ % non-adjacent rows
\newcommand{\meter}{*=<1.8em,1.4em>{\xy ="j","j"-<.778em,.322em>;{"j"+<.778em,-.322em> \ellipse ur,_{}},"j"-<0em,.4em>;p+<.5em,.9em> **\dir{-},"j"+<2.2em,2.2em>*{},"j"-<2.2em,2.2em>*{} \endxy} \POS ="i","i"+UR;"i"+UL **\dir{-};"i"+DL **\dir{-};"i"+DR **\dir{-};"i"+UR **\dir{-},"i" \qw}
% Inserts a measurement meter.
% In case you're wondering, the constants .778em and .322em specify
@@ -78,6 +88,17 @@
% The points added at + and - <2.2em,2.2em> are there to strech the
% canvas, ensuring that the size is unaffected by erratic spacing issues
% with the arc.
+\newcommand{\metersymb}{\xy ="j","j"-<.778em,.322em>;{"j"+<.778em,-.322em> \ellipse ur,_{}},"j"-<0em,.4em>;p+<.5em,.9em> **\dir{-},"j"+<2.2em,2.2em>*{},"j"-<2.2em,2.2em>*{} \endxy}
+ % A longer meter
+\newcommand{\meterB}[1]{*=<1.8em,2.6em>{\xy 0;<0em,-.8em>:
+0*{\begingroup
+\everymath{\scriptstyle}
+\tiny #1 \endgroup},<0em,.7em>*{\xy ="j","j"-<.778em,-.322em>;{"j"+<.778em,.322em> \ellipse ur,_{}},"j"-<0em,-.2em>;p+<.5em,.9em> **\dir{-},"j"+<2.2em,2.2em>*{},"j"-<2.2em,2.2em>*{} \endxy}
+\endxy} \POS ="i","i"+UR;"i"+UL **\dir{-};"i"+DL **\dir{-};"i"+DR **\dir{-};"i"+UR **\dir{-},"i" \qw}
+ % A meter that allows for a measurement operator to be added below
+\newcommand{\smeterB}[2]{\meterB{#1} \qwx[#2] \qw}
+ % A split meter that allows for a measurement operator to be split over non-
+ % adjacent rows
\newcommand{\measure}[1]{*+[F-:<.9em>]{#1} \qw}
% Inserts a measurement bubble with user defined text.
\newcommand{\measuretab}[1]{*{\xy*+<.6em>{#1}="e";"e"+UL;"e"+UR **\dir{-};"e"+DR **\dir{-};"e"+DL **\dir{-};"e"+LC-<.5em,0em> **\dir{-};"e"+UL **\dir{-} \endxy} \qw}
@@ -100,6 +121,10 @@
% Inserts a control and connects it to the object #1 wires below.
\newcommand{\ctrlo}[1]{\controlo \qwx[#1] \qw}
% Inserts a control-on-0 and connects it to the object #1 wires below.
+\newcommand{\cctrl}[1]{\control \cwx[#1] \cw}
+ % Inserts a classical control and connects it to the object #1 wires below.
+\newcommand{\cctrlo}[1]{\controlo \cwx[#1] \cw}
+ % Inserts a classical control-on-0 and connects it to the object #1 wires below.
\newcommand{\targ}{*+<.02em,.02em>{\xy ="i","i"-<.39em,0em>;"i"+<.39em,0em> **\dir{-}, "i"-<0em,.39em>;"i"+<0em,.39em> **\dir{-},"i"*\xycircle<.4em>{} \endxy} \qw}
% Inserts a CNOT target.
\newcommand{\qswap}{*=<0em>{\times} \qw}
@@ -125,7 +150,12 @@
% dotted boxes respectively, and the last eight options yield bottom, top, left, and right braces of the curly or normal variety. See the Xy-pic reference manual for more options.
% \gategroup can appear at the end of any gate entry, but it's good form to pick either the last entry or one of the corner gates.
% BUG: \gategroup uses the four corner gates to determine the size of the bounding box. Other gates may stick out of that box. See \prop.
-
+\newcommand{\inputgroupv}[5]{\POS"#1,1"."#2,1"."#1,1"."#2,1"!C*+<#3>\frm{\{}, \POS"#1,1"."#2,1"."#1,1"."#2,1"*!C!<1.7em,#4>=<0em>{#5}}
+ % Constructs an input group with label #5 and a grouping { from rows #1 to #2 with #3 and #4 controlling the spacing
+\newcommand{\inputgroup}[4]{\POS"#1,1"."#2,1"."#1,1"."#2,1", \POS"#1,1"."#2,1"."#1,1"."#2,1"*!C!<1em,#3>=<0em>{#4}}
+ % Constructs an input group with label #4 from rows #1 to #2 with #3 controlling the spacing
+\newcommand{\inputgrouph}[5]{\POS"#1,1"."#2,1"."#1,1"."#2,1", \POS"#1,1"."#2,1"."#1,1"."#2,1"*!C!<#5,#3>=<0em>{#4}}
+ % Constructs an input group with label #4 and a grouping /vdots from rows #1 to #2 with #3 and #5 controlling the spacing
\newcommand{\rstick}[1]{*!L!<-.5em,0em>=<0em>{#1}}
% Centers the left side of #1 in the cell. Intended for lining up wire labels. Note that non-gates have default size zero.
\newcommand{\lstick}[1]{*!R!<.5em,0em>=<0em>{#1}}
@@ -141,4 +171,4 @@
\newcommand{\pureghost}[1]{*+<1em,.9em>{\hphantom{#1}}}
% Same as \ghost except it omits the wire leading to the left.
-\endinput
+\endinput \ No newline at end of file