CQuIC / qcircuit

A quantum circuit drawing application
GNU General Public License v2.0
164 stars 42 forks source link

Create command for dual of measureD objects #24

Open Travis-S opened 7 years ago

Travis-S commented 7 years ago

Recently, I received an email in which the author asked whether there was support for providing the dual object for the \measureD command. This object would be for state preparation.

It turns out that there is some use for such a command, particularly within what appear to be tensor-network type things; see this paper, Equation 1 for an example.

Upon downloading the source file, I saw the authors of the paper defined two new commands:

% Inserts a reverse-D-shaped preparation gate with user defined text.
\newcommand{\prepareC}[1]{*{\xy*+=+<.5em>{\vphantom{#1\rule{0em}{.1em}}}*\cir{l^r};p\save*!L{#1} 
\restore\save+UC;+UC+<.5em,0em>*!L{\hphantom{#1}}+R **\dir{-} \restore\save+DC;+DC+
<.5em,0em>*!L{\hphantom{#1}}+R **\dir{-} \restore\POS+UC+<.5em,0em>*!L{\hphantom{#1}}+R;+DC+
<.5em,0em>*!L{\hphantom{#1}}+R **\dir{-} \endxy}} 
% Draws a multiple qubit reverse-D-shaped preparation 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 \pureghost for 
% the wires to connect properly on the lower lines.

\newcommand{\multiprepareC}[2]{*+<1em,.9em>{\hphantom{#2}}\save[0,0].[#1,0];p\save !C
  *{#2},p+RU+<0em,0em>;+LU+<+.8em,0em> **\dir{-}\restore\save +RD;+RU **\dir{-}\restore\save
  +RD;+LD+<.8em,0em> **\dir{-} \restore\save +LD+<0em,.8em>;+LU-<0em,.8em> **\dir{-} \restore \POS
  !UL*!UL{\cir<.9em>{u_r}};!DL*!DL{\cir<.9em>{l_u}}\restore}

These two draw the dual of the \measureD and \multimeasureD commands, respectively.

Are we OK with folding these commands into qcircuit and releasing a new version?