diff --git a/Qtutorial.tex b/Qtutorial.tex index 8920fb0..9cde4c7 100644 --- a/Qtutorial.tex +++ b/Qtutorial.tex @@ -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=. @@ -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\} \\ diff --git a/qcircuit.sty b/qcircuit.sty index 1b93638..483f69b 100644 --- a/qcircuit.sty +++ b/qcircuit.sty @@ -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}