Closed tigerjack closed 2 years ago
Ok, a couple of comments, since you also wanted to shorten your code:
dots seln;
instead of dots {} seln;
).discard x; dots x;
for the gates x
, y
, and z
, you can of course write it in this way in six lines, but you can easily combine all the stuff: discard x, y, z; dots x, y, z;
. Bonus: This immediately solves your alignment problem, since if you specify a gate in this way, it is ensured that the horizontal position of this gate is the same for all gates. No align
gate even necessary!align -;
, this will align all registers horziontally, so that the next gate on any register will start at the position where the rightmost among all registers had its last gate. Therefore, you must first discard all the gates discard seln; discard hn; discard synn;
(and here I do it separately just to avoid the automatic alignment), then you can say align -;
, and after this you can put your dots seln; dots hn; dots synn;
.sels-sele
instead of sels, seln, sele
, or -
instead of enumerating all possible registers....n
registers a second time? They did not change their type, so this is really unnecessary.Put all together, this is how I would write the circuit:
\begin{yquant}[register/default name=]
qubit sel[3];
qubit h[3];
qubit syn[3];
init {$\qreg{sel}$} (sel);
init {$\qreg{h}$} (h);
init {$\qreg{syn}$} (syn);
discard sel[1], h[1], syn[1];
dots sel[1], h[1], syn[1];
box {A} (sel);
box {B} (-);
box {C} (sel);
dots sel[1], h[1], syn[1];
output {$n$} (sel);
output {$rn$} (h);
output {$r$} (syn);
\end{yquant}
And by the way, I feel that the \vdots
are a bit off vertically. This is a rather common problem whenever you use \vdots
outside of a matrix environment (and even then I'm not totally satisfied with TeX's results). Have a look at \rvdots
, which I think is better, though I must admit that I still think it is not perfectly centered. You may need to adjust the \rvdots
definition a bit (or just be comfortable with how it is...).
Thanks for spending your time on such a precious and detailed answer @projekter I am just starting to use the tool and I still have a lot to learn :)
I would like to align the output of the last barrier of
vdots
in the document, but I am not sure how. I tried thealign
command, but it doesn't seem to work. What is the recommended way in this situation?As a side note, I am still not sure if my code is to "optimal" way to achieve my result or there is a more compact version.