Problem bei der Vorbereitung eines Zyklus mit Tikz in Latex

Problem bei der Vorbereitung eines Zyklus mit Tikz in Latex

Das Programm, das ich derzeit verwende, soll eine zyklische Darstellung erzeugen, die dem bereitgestellten Bild ähnelt. Beim Ausführen des Codes treten jedoch mehrere Fehler auf und die Ausgabe entspricht nicht dem erwarteten Bild. Für jede Hilfe bei der Lösung dieser Probleme wäre ich sehr dankbar. So soll das Bild aussehen:Bildbeschreibung hier eingeben

"Code"

 \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}

PS: Siehe meine ÄnderungHier, es bleibt jedoch ein kleines Problem, das dort beschrieben wird.

Antwort1

Als Antwort auf Ihrezusätzliche Frage.

Analyse

Als erstes habe ich einen Referenzkreis gezeichnet, um die doch recht großen Abweichungen zu erkennen:

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

to[bend left]Meine erste Idee, jedes durch ein eigenes Statement zu ersetzen to[bend in=, out=], bei dem jeder Ein- und Ausgabewinkel manuell eingestellt werden kann, habe ich bald wieder fallen gelassen. Aber das ist eine Menge Arbeit.

So kam ich auf die Idee,

  • den Kreis hinter alle anderen Pfade setzen (also als ersten zeichnen)
  • Verzierung mit Pfeilen, siehe Kap.50.6.1 Pfeilspitzenmarkierungenim pgf-Handbuch

Lösung, von oben nach unten

Laden Sie die Bibliothek \usetikzlibrary{decorations.markings}.

Dekorationsmarkierungen definieren. Die Besonderheit dabei ist, dass der Kreis mathematisch gezeichnet wird, also gegen den Uhrzeigersinn. Deshalb sind die Pfeile als umgekehrte Pfeile dekoriert. Sie können ihren Stil wie bei Knoten anpassen. Ich habe sie rot markiert, um sie deutlicher zu machen. Die Positionen ergeben sich aus Versuch und Irrtum, und vielleicht ist es nicht so schlimm, sie mehr oder weniger „in der Mitte“ zu haben.

        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
        },

Dekorieren wir also den Kreis:

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

Entfernen wir alle nicht mehr benötigten Verbindungen:

        % 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);

Behalten Sie das jetzt fehlende Etikett bei. Es gibt viele Möglichkeiten, es zu platzieren, genau wie bei jedem Knoten.

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

Nehmen Sie nun Ihre Anpassungen vor. Übrigens können Sie den stateStil von für die Quantenschaltung überschreiben, um sie etwas größer zu machen, z. B. durch:

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

Ergebnis

%%%%%%%%%%%%%%%%%
%\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}

Antwort2

Hier ist ein Ausgangspunkt für Sie. Es ist unvollendet, weil:

  • Ich kann nicht alles aus Ihrem Code abrufen
  • Es versucht, Ihnen die schrittweise iterative Verfeinerung zu zeigen
  • Es bleibt also bei etwas stehen, das für Sie ein neuer Ausgangspunkt sein könnte.

Ergebnis

Schauen wir uns einige Details an:

  • Ich habe den Prozess als Kommentare zusammengefasst
  • (1) platziert unformatierte Knoten auf einem Kreis, dessen Radius Sie ändern können.\newcommand\rd[0]{35mm}
  • (2), gerade Verbindungen, zeigt jetzt die Anfangszeilen mit einer ersten bendEinführung; biegen Sie nicht zu früh, konzentrieren Sie sich zuerst auf relevantere Teile
  • für das Verbindungslabel habe ich einen Stil, einen Anker und für die Demo eine Position gezeigt
  • die vorläufigen Stile (3) sind für den Moment gut genug und würden am Ende der Erstellung all dessen noch weiter verfeinert werden
  • Veränderung-nur-an-einer-Stelle sind ihre Paradigmen; siehe z. B. die Rolle des Stilsgeom

Bisher nicht erledigt sind das Messgerät (der Code konnte nicht gefunden werden) und der Inhalt von „Quantum Circuit“. Dies sind Stellen, an denen Sie anrufen könnten tikz, tikzwovon dringend abgeraten wird.

Als Alternative schlage ich vor, diese Zeichnungen separat mit der standaloneKlasse zu erstellen, wie hier getan, UND \includegraphics(also diese .pdfs) über das Paket graphicx. Siehe z. B.hier (PI-Regler)für diesen Ansatz.

Jetzt beginnen Sie mit der Mischphase, in der Sie beide:

  • mehr Inhalte einführen
  • Platzierungen, Stile etc. anpassen möchten oder müssen.

Aber ich hoffe, dass es jetzt machbarer sein sollte.

% ~~~ 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}

Als Referenz sehen Sie sich bitte meinen Versuch an, mit Ihrem Code zu arbeiten und ihn für eine bessere Lesbarkeit umzugestalten. An diesem Punkt war mir klar, dass er von Grund auf mit einem anderen Ansatz neu erstellt werden sollte. Sie könnten ihn vielleicht noch weiter verschönern (was auch Probleme reduziert), aber ... dafür waren die Dinge einfach zu durcheinander.

%\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}

Antwort3

Dies ist, was ich geändert habe.

%%%%%%%%%%%%%%%%%
\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}

Bildbeschreibung hier eingeben

verwandte Informationen