使用 TikZ 測量計量子電路

使用 TikZ 測量計量子電路

我正在嘗試使用 TikZ 編寫量子電路。我知道想要添加一個測量儀,如右側所示: 如有任何幫助,我們將不勝感激。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\draw[thick,decorate,decoration={brace},xshift=-4pt,yshift=0pt]
(0,0) -- (0,1) node [black,midway,xshift=-1cm] {Input $\rho^{(i)}$};
    \draw[thick,->] (0,1)--node[midway,above]{\footnotesize System $A$}(2,1);
    \draw[thick,->] (0,0)--node[midway,above]{\footnotesize System $B$}(2,0);
    \draw[thick] (2,-0.5) rectangle (3,1.5) node [pos=.5]{$U_\varepsilon$};
    \draw[thick,->] (3,1)--(6,1);
    \draw[thick,->] (3,0)--(4,0);
    \draw[thick] (4,-0.5) rectangle (5,0.5) node[pos=.5]{$T$};
    \draw[thick,->] (5,0)--(6,0);
    \draw[thick,decorate,decoration={brace,mirror},xshift=4pt,yshift=0pt]
    (6,0) -- (6,1) node [black,midway,xshift=1.35cm] {Output $\rho^{(i+1)}$};
    \draw[thick,->,dashed,rounded corners] (7,0.2)--(7,-1)--node[midway,below]    
    {as long as $i+1<n$}(-1.5,-1)--(-1.5,0.2);
\end{tikzpicture}
\end{document}

答案1

起初,我假設您正在使用 Maybe circuitikz,您可能應該研究一下這個包,但後來您發布了程式碼。儘管如此,這裡有一個可以與這兩種方法一起使用的解決方案:

(因為我不知道你想把儀表放在哪裡,所以我替換了你圖片中的T節點。)

\documentclass[border=5mm,tikz]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{arrows,decorations.pathreplacing}

\begin{document}

\tikzset{meter/.append style={draw, inner sep=10, rectangle, font=\vphantom{A}, minimum width=30, line width=.8,
 path picture={\draw[black] ([shift={(.1,.3)}]path picture bounding box.south west) to[bend left=50] ([shift={(-.1,.3)}]path picture bounding box.south east);\draw[black,-latex] ([shift={(0,.1)}]path picture bounding box.south) -- ([shift={(.3,-.1)}]path picture bounding box.north);}}}

\begin{circuitikz}

\node[meter] (meter) at (0,0) {};

\draw (-4,0) to[twoport,t=$H$] (meter.west);
\draw(meter.10)  -- ++(1,0);
\draw(meter.-10) -- ++(1,0);

\end{circuitikz}

\begin{tikzpicture}
\draw[thick,decorate,decoration={brace},xshift=-4pt,yshift=0pt]
(0,0) -- (0,1) node [black,midway,xshift=-1cm] {Input $\rho^{(i)}$};
    \draw[thick,->] (0,1)--node[midway,above]{\footnotesize System $A$}(2,1);
    \draw[thick,->] (0,0)--node[midway,above]{\footnotesize System $B$}(2,0);
    \draw[thick] (2,-0.5) rectangle (3,1.5) node [pos=.5]{$U_\varepsilon$};
    \draw[thick,->] (3,1)--(6,1);
    \node[meter] (meter) at (4.5,0) {};
    \draw[thick,->] (3,0)--(meter);
    \draw[thick,->] (meter)--(6,0);
    \draw[thick,decorate,decoration={brace,mirror},xshift=4pt,yshift=0pt]
    (6,0) -- (6,1) node [black,midway,xshift=1.35cm] {Output $\rho^{(i+1)}$};
    \draw[thick,->,dashed,rounded corners] (7,0.2)--(7,-1)--node[midway,below]    
    {as long as $i+1<n$}(-1.5,-1)--(-1.5,0.2);
\end{tikzpicture}

\end{document}

產量:

在此輸入影像描述

在此輸入影像描述

相關內容