0

enter image description here

I have been trying to write code for the following figure using the qcircuit environment. But did not succeed. Kindly help me in writing its code.

  • 1
    Welcome to TeX.SE! Please show us the code you have tried so far! – Kurt Oct 24 '17 at 23:48
  • You will find that people are much more likely to help if you make a real attempt at solving the problem yourself. You should provide a Minimal Working Example (MWE), which should compile on its own, even if it doesn't produce the result you want. In this case, there should be an attempt at using the \targ and \ctrl commands in the Qcircuit package. – Sandy G Oct 25 '17 at 1:25
1

The qcircuit code to produce the gate is

\Qcircuit @C=2.5em @R=2.5em{& \ctrl{1} & \qw \\& \targ & \qw}

You can adjust the 2.5em lengths to change the size of the gate. To vertically center the gate in an array or table, you must enclose the above code in an array or table of its own. Here is the code:

\documentclass{article}
\usepackage{qcircuit}
\usepackage{amsmath}

\begin{document}
\[
\begin{tabular}{ccc}
 & Gate notation & Matrix representation\\[2ex]
\begin{tabular}{c}\emph{Controlled-NOT}\\gate\end{tabular} & 
\begin{tabular}{c}\Qcircuit @C=2.5em @R=2.5em{& \ctrl{1} & \qw \\& \targ & \qw} \end{tabular} &
$\begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{bmatrix}$
\end{tabular}
\]
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.