Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Qtutorial.tex
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,21 @@ \subsection{Multiple qubit gates \label{S:multigate}}
& \qw & \ghost{U} & \qw & \qw
}\end{verbatim}}

Finally, the command \verb=\cmultigate= creates a multigate with a classical first input (for which \verb=\cghost= is not an option).

\[ \Qcircuit @C=1em @R=0em {
& \cw & \cmultigate{3}{U} & \cw & \cw \\
& \qw & \ghost{U} & \qw & \qw \\
& \cdots & \nghost{U} & \cdots & \\
& \qw & \ghost{U} & \qw & \qw
}\]
{\small \begin{verbatim}\Qcircuit @C=1em @R=0em {
& \cw & \cmultigate{3}{U} & \cw & \cw \\
& \qw & \ghost{U} & \qw & \qw \\
& \cdots & \nghost{U} & \cdots & \\
& \qw & \ghost{U} & \qw & \qw
}\end{verbatim}}

Note that controls to multiple qubit gates work the same as for single
qubit gates, using \verb=\ctrl= and \verb=\qwx=.

Expand Down Expand Up @@ -766,6 +781,7 @@ \section{Table of Commands}
\char92 targ \\
\char92 qswap \\
\char92 multigate\{\#1\}\{\#2\} \\
\char92 cmultigate\{\#1\}\{\#2\} \\
\char92 sgate\{\#1\}\{\#2\}\\
\char92 ghost\{\#1\} \\
\char92 cghost\{\#1\} \\
Expand Down
4 changes: 3 additions & 1 deletion qcircuit.sty
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@
% Inserts half a swap gate.
% Must be connected to the other swap with \qwx.
\newcommand{\multigate}[2]{*+<1em,.9em>{\hphantom{#2}} \POS [0,0]="i",[0,0].[#1,0]="e",!C *{#2},"e"+UR;"e"+UL **\dir{-};"e"+DL **\dir{-};"e"+DR **\dir{-};"e"+UR **\dir{-},"i" \qw}
% Draws a multiple qubit gate starting at the current position and spanning #1 additional gates below.
\newcommand{\cmultigate}[2]{*+<1em,.9em>{\hphantom{#2}} \POS [0,0]="i",[0,0].[#1,0]="e",!C *{#2},"e"+UR;"e"+UL **\dir{-};"e"+DL **\dir{-};"e"+DR **\dir{-};"e"+UR **\dir{-},"i" \cw}
% Same as multigate but with a classical incoming wire
% Draws a multiple qubit gate starting at the current position and spanning #1 additional gates below.
% #2 gives the label for the gate.
% You must use an argument of the same width as #2 in \ghost for the wires to connect properly on the lower lines.
\newcommand{\ghost}[1]{*+<1em,.9em>{\hphantom{#1}} \qw}
Expand Down