라텍스에서 tikz를 사용하여 사이클을 준비하는 문제

라텍스에서 tikz를 사용하여 사이클을 준비하는 문제

내가 현재 사용하고 있는 프로그램은 제공된 이미지와 유사한 순환 표현을 생성하는 것을 목표로 합니다. 그러나 코드를 실행하면 몇 가지 오류가 발생하고 출력이 예상 이미지와 일치하지 않습니다. 이러한 문제를 해결하는 데 도움을 주시면 대단히 감사하겠습니다. 내가 원하는 이미지 =여기에 이미지 설명을 입력하세요

"암호"

 \documentclass[border=0.1cm]{revtex4-2}
%
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{qcircuit}
\usetikzlibrary{positioning, arrows.meta}
% Create style for node rectangles
\tikzstyle{state}=[
    rectangle,
    minimum width=1.5cm,
    minimum height=1cm,
    draw=white,
    thick,
    text=black,
    font=\bfseries,
    align=center,
    fill=Orange!70,
    rounded corners=5pt % Adjust the radius as needed
]

\begin{document}
% \begin{tikzpicture}[>=Stealth, thick, text=black, font=\sffamily]
%%%%
\tikzset{meter/.append style={draw, inner sep=10, rectangle, font=\vphantom{A}, minimum width=30, minimum height=10 line width=.5, 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{tikzpicture}[-stealth, thick, text=black]
\begin{tikzpicture}[>=Stealth, thick, text=black, font=\sffamily]
% State q0
\node[state, minimum width=2.cm, minimum height=0.5cm] (A) at (90:2) {\rm {Optimizer}};

% State q1
\node[state, fill=NavyBlue, minimum width=2.cm, minimum height=0.5cm, left=-1 cm] (B) at (18:2) {\rm R({$\Theta$},{$X$})};
\node[above] at (B.north) {{$\Theta$}};

% Box on the side of q1
\node[state, fill=NavyBlue, minimum width=1.cm, minimum height=0.5cm] (B_side) at (3.8,0.6) {$|0\rangle$};
\node[below=0.7 cm,left=-0.4 cm] at (B_side.east) {Quantum};
\node[below=0.9cm,left=-0.4 cm] at (B_side.east) {pre-processing};
\draw[-stealth] (B_side) -- (B);
% \node[below=0.3cm, align=center, font=\footnotesize] at (B_side.east) {Quantum\\pre-processing};
% Box on top of q1
\node[state, fill=Orange, minimum width=1.5cm, minimum height=0.8cm] (B_top) at (2.2,2.1) {Data: {x}};
\node[above] at (B_top.east) {};
\draw[-stealth] (B_top) -- (B);

% State q2
\node[state, fill=NavyBlue, minimum width=1.cm, minimum height=.5cm, left=-2.2 cm] (C) at (-32:2) { 
    ~\Qcircuit @C=.4em @R=.3em{
      \gate{R_y}&\gate{R_z} &\qw & 
     \gate{R_y}&\gate{R_z}
    \protect\gategroup{1}{1}{1}{2}{0.25em}{--}
    \protect\gategroup{1}{4}{1}{5}{0.25em}{--}
    }};
\node[above=0.4cm, right=-0.0 cm] at (C.north west) {Quantum circuit};
% State q3
\node[meter, state, fill=NavyBlue, minimum width=2.cm, minimum height=0.2cm] (D) at (-147:2) {M};
% \node[meter, state, fill=NavyBlue, minimum width=2.cm, minimum height=0.5cm] (meter) at (-138:2) {M};
\node[above=0.01cm] at (D.north west) {State measurement};

% State q4
\node[state, minimum width=2.cm, minimum height=0.5cm] (E) at (162:2) {$f(|\langle y | \phi \rangle |^2 )$};
\node[above=-0.5] at (E.north) {post-processing};
% Transition q0 to q1
\draw[-stealth] (A) to[bend left=30] node[above]{Parameter} (B);

% Transition q1 to q2
\draw[-stealth] (B) to[bend left=15] node[right]{$e_1$} (C);

% Transition q2 to q3
\draw[-stealth] (C) to[bend left=15] node[right]{$e_2$} (D);

% Transition q3 to q4
\draw[-stealth] (D) to[bend left=15] node[below=-0.4 cm, right=0.1 cm]{Quantum state$ |\phi\rangle$} (E);

% Transition q4 to q0
\draw[-stealth] (E) to[bend left=30] node[left]{Classical} (A);
\end{tikzpicture}
%
\end{document}

추신: 내 수정사항 보기여기, 거기에 설명된 몇 가지 사소한 문제가 남아 있습니다.

답변1

귀하의 답변에추가 질문.

분석

제가 가장 먼저 한 일은 참고용으로 원을 그려 상당히 큰 편차를 확인하는 것이었습니다.

        % ~~~ a circle for reference              ~~~
       \draw (0,0) circle[radius=\rd];

곧 나는 각각의 입력 및 출력 각도를 수동으로 조정할 수 있는 to[bend left]개별 명령문으로 대체하려는 첫 번째 아이디어를 포기했습니다 . to[bend in=, out=]하지만 할 일이 너무 많아요.

그래서 나는 이런 생각을 떠올렸다.

  • 다른 모든 경로 뒤에 원을 배치합니다(즉, 첫 번째 경로로 그립니다).
  • 화살표로 장식하려면 ch를 참조하십시오.50.6.1 화살표 끝 표시pgfmanual에서

솔루션, 위에서 아래로

라이브러리를 로드합니다 \usetikzlibrary{decorations.markings}.

장식 표시를 정의합니다. 여기서 특이한 점은 원이 수학적으로, 즉 시계 반대 방향으로 그려진다는 것입니다. 그래서 화살표가 반전된 화살표로 장식되어 있습니다. 노드와 마찬가지로 스타일을 조정할 수 있습니다. 좀 더 명확하게 보이도록 빨간색으로 표시했습니다. 위치는 시행착오의 결과이며 어느 정도 "중간"에 두는 것도 그리 나쁘지 않을 수 있습니다.

        decoration={% will put arrows along the path (here: a counter clockwise circle)
            markings,
            mark=at position 0   with {\arrowreversed[red]{Stealth}},% (0:\rd) or east, so to say
            mark=at position .15 with {\arrowreversed[red]{Stealth}},
            mark=at position .35 with {\arrowreversed[red]{Stealth}},
            mark=at position .5  with {\arrowreversed[red]{Stealth}},% west
            mark=at position .75 with {\arrowreversed[red]{Stealth}},% south
        },

이제 원을 장식해 봅시다:

        % ~~~ a circle for reference, alter with decoration ~~~
%        \draw (0,0) circle[radius=\rd];
        \draw[postaction={decorate}] (0,0) circle[radius=\rd];

더 이상 필요하지 않은 모든 연결을 제거해 보겠습니다.

        % Connections
%        \draw[->] (OP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QP.70);
%        \draw[->] (QP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QC.65);
%        \draw[->] (QC) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QM);
    %    \draw[->] (QM) to[bend left] node[arrlbl,anchor=west,pos=.8, black] {Quantum state:\\$|\phi\rangle$} (PP);
%        \draw[->] (PP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (OP);

현재 누락된 레이블을 보존합니다. 다른 노드와 마찬가지로 배치하는 방법에는 여러 가지가 있습니다.

        % ~~~ moved label ~~~~~~~~~~~~~~~~~
        \node[arrlbl,anchor=north west]  at (PP.300) {Quantum state:\\$|\phi\rangle$};

이제 조정을 해보세요. 그런데, Quantum 회로의 의 스타일을 덮어써서 state다음과 같이 좀 더 크게 만들 수 있습니다.

 \node[state,minimum height=12mm] (QC) at ( -30:\rd) {
...

결과

%%%%%%%%%%%%%%%%%
%\documentclass{article} % ok to use
\documentclass[10pt,border=3mm,tikz]{standalone} % I find this more useful for development
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
% \usetikzlibrary{quantikz}
\usepackage{qcircuit}
\usepackage[absolute,overlay]{textpos}
\usetikzlibrary{shapes}
\newcommand\rd[0]{32mm} % radius for the circle placement
\usetikzlibrary{decorations.markings}           % <<< new

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define the measurement symbol style
\tikzset{
    meter/.style={
        draw,
        inner sep=10pt,
        rectangle,
        font=\vphantom{A},
        minimum width=30pt,
        minimum height=10pt,
        line width=.5pt,
        path picture={
            \draw[black] ([shift={(2pt,7pt)}]path picture bounding box.south west) to[bend left=50] ([shift={(-2pt,7pt)}]path picture bounding box.south east);
            \node[anchor=center] at (path picture bounding box.center) {$M$};
            \draw[black,-latex] ([shift={(0pt,3pt)}]path picture bounding box.south) -- ([shift={(10pt,-5pt)}]path picture bounding box.north);
        }
    }
}
%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[
        geom/.style={
            rounded corners,
            minimum width=25mm,
            minimum height=9mm,
        },
        state/.style={fill=blue!40!teal!40,geom},
        other/.style={fill=orange!40,geom},
        txt/.style={align=center,font={\small\sffamily}},
        arrlbl/.style={blue,align=center}, % < < < replace blue by black if you prefer
        % ~~~ new ~~~~~~~~~
        decoration={% will put arrows along the path (here: a counter clockwise circle)
            markings,
            mark=at position 0   with {\arrowreversed[red]{Stealth}},% (0:\rd) or east, so to say
            mark=at position .15 with {\arrowreversed[red]{Stealth}},
            mark=at position .35 with {\arrowreversed[red]{Stealth}},
            mark=at position .5  with {\arrowreversed[red]{Stealth}},% west
            mark=at position .75 with {\arrowreversed[red]{Stealth}},% south
        },
    ]
        % ~~~ a circle for reference, later with decoration ~~~
%        \draw (0,0) circle[radius=\rd];
        \draw[postaction={decorate}] (0,0) circle[radius=\rd];
        
        % Blocks
        \node[other] (OP) at (  90:\rd) {\large Optimizer};
        \node[state] (QP) at (  20:\rd) {$R(\{\vec{\Theta}\},\{\vec{X}\})$};
        \node[state] (QC) at ( -30:\rd) {
            \resizebox{.45\linewidth}{!}{
            \hspace{-.58cm}~\Qcircuit @C=.8em @R=.5em{
                \push{\cdots} &\gate{R_y} & \gate{R_z} & \gate{R_y} & \gate{R_z}&\cdots\\
                % & & & & \\ 
                % & & & & & \\
                \protect\gategroup{1}{2}{1}{3}{0.3em}{--}
                \protect\gategroup{1}{4}{1}{5}{0.3em}{--}
            }
            }
    };
        \node[meter, state] (QM) at ( 210:\rd)  {M};
        \node[other] (PP) at ( 160:\rd) {$f(|\langle y | \phi \rangle |^2 )$ };
    % ~~~ (1) relative placement of other blocks
%   \node[state] (QX) at ([xshift=\rd]QP) {QX}; % before step (5)
    \node[rounded corners, fill=blue!40!teal!40] (QX) at ([shift=(0:2)]QP)       {$|0\rangle$};
    \node[rounded corners, fill=orange!40] (DT) at ([shift=(75:2)]QP)     {\large Data: $\{\vec{X\}}$};
        % Connections
%        \draw[->] (OP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QP.70);
%        \draw[->] (QP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QC.65);
%        \draw[->] (QC) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QM);
    %    \draw[->] (QM) to[bend left] node[arrlbl,anchor=west,pos=.8, black] {Quantum state:\\$|\phi\rangle$} (PP);
%        \draw[->] (PP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (OP);
        \draw[->] (DT) -- (QP.35);
        \draw[->] (QX) -- (QP);

        % ~~~ moved label ~~~~~~~~~~~~~~~~~
        \node[arrlbl,anchor=north west]  at (PP.300) {Quantum state:\\$|\phi\rangle$};

        % Extra labels
        \node[txt] at ([shift=(-100:-0.8)]QM) {\large Quantum state measurement};
        \node[txt] at ([shift=(90:0.7)]PP) {\large Classical post-processing};
        \node[txt] at ([shift=( -85:1.0)]QX) {\large Quantum\\pre-processing};
        \node[txt] at ([shift=(-100:1.7)]QP) {\large Quantum circuit};
        \node[txt] at ([shift=(30:-1.2)]QC) {Layer i};
        \node[txt] at ([shift=(150:-1.2)]QC) {Layer i+1};
        \node[txt,font = {\large}, red] at ([shift=(128:1.3)]QP) {Parameters:\\$\{\vec\Theta\}$};
        
    \end{tikzpicture}
    \end{document}

답변2

여기가 당신을 위한 출발점입니다. 다음과 같은 이유로 미완성입니다.

  • 귀하의 코드에서 모든 내용을 검색할 수는 없습니다.
  • 단계별 반복 개선을 보여주려고 합니다.
  • 그래서 그것은 당신에게 새로운 출발점이 될 수 있는 어떤 것에서 멈춥니다.

결과

몇 가지 세부 사항을 살펴보겠습니다.

  • 그 과정을 댓글로 정리했어요
  • (1) 스타일이 지정되지 않은 노드를 원에 배치합니다. 여기서 반경을 변경할 수 있습니다.\newcommand\rd[0]{35mm}
  • (2) 직선 연결은 이제 처음 bend도입된 초기 선을 보여줍니다. 너무 일찍 구부리지 말고, 더 관련 있는 부분에 먼저 집중하세요
  • 연결 레이블의 경우 스타일, 앵커 및 데모의 위치를 ​​보여주었습니다.
  • 예비 스타일(3)은 현재로서는 충분하며 이 모든 항목을 만드는 작업이 끝날 때까지 더 다듬어질 것입니다.
  • 한 곳에서만 변화하는 것이 그들의 패러다임입니다. 예를 들어 스타일의 역할을 참조하십시오.geom

실행 취소하면 미터(코드를 찾을 수 없음)와 "양자 회로" 내부에 무엇이 있는지 알 수 있습니다. 이러한 장소에서는 tikz내부로 전화할 수 있지만 tikz이는 매우 권장되지 않습니다.

대안으로 standalone여기에서 수행한 것처럼 클래스를 사용하고 \includegraphicspackage 를 통해 이러한 그림(예: 해당 .pdf) 을 별도로 생성하는 것이 좋습니다 graphicx. 예를 참조하십시오여기 (PI 컨트롤러)이 접근 방식을 위해.

이제 다음과 같은 혼합 단계를 시작합니다.

  • 더 많은 콘텐츠 소개
  • 배치, 스타일 등을 조정하고 싶거나 조정해야 합니다.

하지만 이제는 더 많은 일을 할 수 있기를 바랍니다.

% ~~~ Procedure of stepwise iterative refinement ~~~~~~~~~
% (1)   place nodes with dummy content, to check general placement
% (2)   draw straight connections; bends can be done later
% (3)   introduce preliminary styles for the blocks
% (4)   introducing extra labels for block descriptions; 
%       add+adjust styles as minimalistic as possible+needed
% (5)   start refining nodes text contents
% (6)   let's have nicer arrow tips
% (7)   first labels at connections


\documentclass[10pt,border=3mm,tikz]{standalone}
\usetikzlibrary{arrows.meta}

\newcommand\rd[0]{35mm} % radius for the circle placement

\begin{document}
 \begin{tikzpicture}[% (3)
    geom/.style={
                    rounded corners,
                    minimum width=25mm,
                    minimum height=8mm,
                },
    state/.style={fill=blue!40!teal!40,geom},
    other/.style={fill=orange!40,geom},
    txt/.style={align=center,font={\small\sffamily}},
    >={Stealth},    % (6)
    arrlbl/.style={blue,align=center},
 ]
 
    % ~~~ (1) placing your "blocks" on circle ~~~~~~~~~~ 
    %\node (OP) at (  90:\rd) {Optimizer};  % for reference: from step (1)
    \node[other] (OP) at (  90:\rd) {Optimizer};
%   \node[state] (QP) at (  20:\rd) {PreProc};
    \node[state] (QP) at (  20:\rd) {$R(\{\vec{\Theta}\},\{\vec{X}\})$};
    \node[state] (QC) at ( -30:\rd) {Quantum Circuit};
    \node[state] (QM) at ( 210:\rd) {Quantum Meas};
%   \node[other] (PP) at ( 160:\rd) {PostProc};
    \node[other] (PP) at ( 160:\rd) {$f(|\langle y | \phi \rangle |^2 )$ };
    
    % ~~~ (1) relative placement of other blocks
%   \node[state] (QX) at ([xshift=\rd]QP) {QX}; % before step (5)
    \node[state] (QX) at ([xshift=\rd]QP)       {$|0\rangle$};
    \node[other] (DT) at ([shift=(60:4)]QP)     {Data: $\{\vec{X\}}$};
    
    % ~~~ (2) draw connections ~~~~~~~~~~
    \draw[->] (OP) -- (QP);
    \draw[->] (QP) -- (QC);
    \draw[->] (QC) -- (QM);
    \draw[->] (QM) to[bend left]
                        node[arrlbl,anchor=east,pos=.3]
                            {Quantum\\state:$|\phi\rangle$}
                        (PP);
    \draw[->] (PP) -- (OP);
    

    \draw[->] (DT) -- (QP.30);  % polar: x deg at node QP's shape
    \draw[->] (QX) -- (QP);
    
    % ~~~ (4) (first) extra labels for block desciptions ~~~~
    \node[txt] at ([shift=(130:1.5)]PP) {Classical\\post-processing};
    \node[txt] at ([shift=( 60:1.0)]QX) {Quantum\\pre-processing};
    \node[txt] at ([shift=(-40:1.5)]QP) {Pre-\\processor};
    
 \end{tikzpicture}
\end{document}

참고로 귀하의 코드로 작업하고 가독성을 높이기 위해 리팩토링하려는 나의 시도를 참조하십시오. 이 시점에서 나에게는 다른 접근 방식으로 처음부터 다시 작성해야 한다는 것이 분명해졌습니다. 더 아름답게 만들 수도 있지만(이로 인해 문제도 줄어듭니다), 그러기에는 상황이 너무 복잡했습니다.

%\documentclass[border=0.1cm]{revtex4-2}
\documentclass[10pt,border=3mm,tikz]{standalone}
%
\usepackage[dvipsnames]{xcolor}
%\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{qcircuit}
\usetikzlibrary{positioning, arrows.meta}

% Create style for node rectangles
\tikzstyle{state}=[
    rectangle,
    minimum width=1.5cm,
    minimum height=1cm,
    draw=white,
    thick,
    text=black,
    font=\bfseries,
    align=center,
    fill=Orange!70,
    rounded corners=5pt % Adjust the radius as needed
]

\begin{document}
% \begin{tikzpicture}[>=Stealth, thick, text=black, font=\sffamily]
%%%%
\tikzset{
    meter/.append style={draw, inner sep=10, rectangle, font=\vphantom{A}, 
    minimum width=30, minimum height=10 line width=.5, 
    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{tikzpicture}[-stealth, thick, text=black]
\begin{tikzpicture}[
    >=Stealth, thick, 
    text=black, 
    font=\sffamily,
    w2h/.style={minimum width=2.cm, minimum height=0.5cm},
    wh/.style={minimum width=1.cm, minimum height=0.5cm},
    fNB/.style={fill=NavyBlue},
    lbl/.style={align=center,font=\small},
]
% ~~~ placing nodes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    % State q0
    \node[state, w2h] (A)                   at (90:2) {\rm {Optimizer}};
    
    % State q1
    \node[state,fNB,w2h, left=-1 cm] (B)    at (18:2) {\rm R({$\Theta$},{$X$})};
%   \node[above]                            at (B.north) {{$\Theta$}};
    
    % Box on the side of q1
    \node[state,fNB,wh] (B_side)            at (3.8,0.6) {$|0\rangle$};

%   % \node[below=0.3cm, align=center, font=\footnotesize] at (B_side.east) {Quantum\\pre-processing};
    % Box on top of q1
    \node[state, fill=Orange, minimum width=1.5cm, minimum height=0.8cm] (B_top) at (2.2,2.1) {Data: {x}};
%   \node[above]                            at (B_top.east) {}; % ???
    
    % State q2
    \node[state,fNB,wh, left=-2.2 cm] (C)   at (-32:2) 
    { 
%       ~\Qcircuit @C=.4em @R=.3em{
%%        \gate{R_y}&\gate{R_z} &\qw & 
%%       \gate{R_y}&\gate{R_z}
%%      \protect\gategroup{1}{1}{1}{2}{0.25em}{--}
%%      \protect\gategroup{1}{4}{1}{5}{0.25em}{--}
%       }
        ???};
%   {xyz};
%   \node[above=0.4cm, right=-0.0 cm]       at (C.north west) {Quantum circuit};
    % State q3
    \node[meter, state,fNB, minimum width=2.cm, minimum height=0.2cm] (D) at (-147:2) {M};
    % \node[meter, state, fill=NavyBlue, minimum width=2.cm, minimum height=0.5cm] (meter) at (-138:2) {M};
%   \node[above=0.01cm]                     at (D.north west) {State measurement};
    
    % State q4
    \node[state, w2h] (E)                   at (162:2) {$f(|\langle y | \phi \rangle |^2 )$};
%   \node[above=-0.5]                       at (E.north) {post-processing};

% ~~~ extra labels ~~~~~~~~~~~~~~~~~~~~
    \node[lbl,anchor=west]      at (B_side.east) {Quantum\\pre-processing};


% ~~~ drawing connections ~~~~~~~~~~~~~~~~~~~~~~~~~
\draw[-stealth] (B_side) -- (B);
\draw[-stealth] (B_top) -- (B);

    % Transition q0 to q1
    \draw[-stealth] (A) to[bend left=30] node[red,above]{Parameter} (B);
    
    % Transition q1 to q2
    \draw[-stealth] (B) to[bend left=15] node[red,right]{$e_1$} (C);
    
    % Transition q2 to q3
    \draw[-stealth] (C) to[bend left=15] node[red,right]{$e_2$} (D);
    
    % Transition q3 to q4
    \draw[-stealth] (D) to[bend left=15] node[red,below=-0.4 cm, right=0.1 cm]{Quantum state$ |\phi\rangle$} (E);
    
    % Transition q4 to q0
    \draw[-stealth] (E) to[bend left=30] node[red,left]{Classical} (A);
\end{tikzpicture}
%
\end{document}

답변3

이것이 제가 수정한 것입니다.

%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
% \usetikzlibrary{quantikz}
\usepackage{qcircuit}
\usepackage[absolute,overlay]{textpos}
\usetikzlibrary{shapes}
\newcommand\rd[0]{32mm} % radius for the circle placement

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define the measurement symbol style
\tikzset{
    meter/.style={
        draw,
        inner sep=10pt,
        rectangle,
        font=\vphantom{A},
        minimum width=30pt,
        minimum height=10pt,
        line width=.5pt,
        path picture={
            \draw[black] ([shift={(2pt,7pt)}]path picture bounding box.south west) to[bend left=50] ([shift={(-2pt,7pt)}]path picture bounding box.south east);
            \node[anchor=center] at (path picture bounding box.center) {$M$};
            \draw[black,-latex] ([shift={(0pt,3pt)}]path picture bounding box.south) -- ([shift={(10pt,-5pt)}]path picture bounding box.north);
        }
    }
}
%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[
        geom/.style={
            rounded corners,
            minimum width=25mm,
            minimum height=9mm,
        },
        state/.style={fill=blue!40!teal!40,geom},
        other/.style={fill=orange!40,geom},
        txt/.style={align=center,font={\small\sffamily}},
        arrlbl/.style={blue,align=center},
    ]
        % Blocks
        \node[other] (OP) at (  90:\rd) {\large Optimizer};
        \node[state] (QP) at (  20:\rd) {$R(\{\vec{\Theta}\},\{\vec{X}\})$};
        \node[state] (QC) at ( -30:\rd) {
    \resizebox{.45\linewidth}{!}{
    \hspace{-.58cm}~\Qcircuit @C=.8em @R=.5em{
    \push{\cdots} &\gate{R_y} & \gate{R_z} & \gate{R_y} & \gate{R_z}&\cdots\\
    % & & & & \\ 
    % & & & & & \\
    \protect\gategroup{1}{2}{1}{3}{0.3em}{--}
    \protect\gategroup{1}{4}{1}{5}{0.3em}{--}
    }
    }
    };
        \node[meter, state] (QM) at ( 210:\rd)  {M};
        \node[other] (PP) at ( 160:\rd) {$f(|\langle y | \phi \rangle |^2 )$ };
    % ~~~ (1) relative placement of other blocks
%   \node[state] (QX) at ([xshift=\rd]QP) {QX}; % before step (5)
    \node[rounded corners, fill=blue!40!teal!40] (QX) at ([shift=(0:2)]QP)       {$|0\rangle$};
    \node[rounded corners, fill=orange!40] (DT) at ([shift=(75:2)]QP)     {\large Data: $\{\vec{X\}}$};
        % Connections
        \draw[->] (OP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QP.70);
        \draw[->] (QP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QC.65);
        \draw[->] (QC) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (QM);
        \draw[->] (QM) to[bend left] node[arrlbl,anchor=west,pos=.8, black] {Quantum state:\\$|\phi\rangle$} (PP);
        \draw[->] (PP) to[bend left] node[arrlbl,anchor=west,pos=.8]{} (OP);
        \draw[->] (DT) -- (QP.35);
        \draw[->] (QX) -- (QP);

        % Extra labels
        \node[txt] at ([shift=(-100:-0.8)]QM) {\large Quantum state measurement};
        \node[txt] at ([shift=(90:0.7)]PP) {\large Classical post-processing};
        \node[txt] at ([shift=( -85:1.0)]QX) {\large Quantum\\pre-processing};
        \node[txt] at ([shift=(-100:1.7)]QP) {\large Quantum circuit};
        \node[txt] at ([shift=(30:-1.2)]QC) {Layer i};
        \node[txt] at ([shift=(150:-1.2)]QC) {Layer i+1};
        \node[txt,font = {\large}, red] at ([shift=(128:1.3)]QP) {Parameters:\\$\{\vec\Theta\}$};
    \end{tikzpicture}
    \end{document}

여기에 이미지 설명을 입력하세요

관련 정보