CQuIC / qcircuit

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

Add `\cghost{}` and `\nghost{}` to have alternative inputs to gates #30

Closed ElieGouzien closed 6 years ago

ElieGouzien commented 7 years ago

Hi,

I've found that having only the standard \qw wire for input to multigates is a little restrictive, so I created \cghost{} and \nghost{} to have a classical input or no input.

Maybe this feature could be inplemented as an option of \ghost{}. Also I thought to use \ghost*{} instead of \nghost{} but didn't want to change too much your code.

I know classical input to a quantum gate can sound strange, but at least in optics it happens.

Here is the exemple I've put in the doc:

\documentclass[border=3pt]{standalone}
\usepackage{qcircuit}

\begin{document}

\Qcircuit @C=1em @R=0em {%
& \qw    & \multigate{3}{U^\dagger} & \qw & \qw \\
& \cw    & \cghost{U^\dagger}       & \cw & \cw \\
& \cdots & \nghost{U^\dagger}       & \cdots \\
& \qw    &  \ghost{U^\dagger}       & \qw & \qw
}

\end{document}

test.pdf

And many thanks for that nice package, Élie

Travis-S commented 7 years ago

Thanks for the PR! I'll take a look at this over the weekend.

Travis-S commented 6 years ago

Closed by 1564668063. Thanks @ElieGouzien for the command.