You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Return a random spin operator with the given number of terms (<code class="code docutils literal notranslate"><span class="pre">term_count</span></code>) where each term acts on all targets in the open range [0, qubit_count). An optional seed value may also be provided.</p>
Copy file name to clipboardExpand all lines: pr-3313/applications/python/adapt_qaoa.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -942,7 +942,7 @@ <h1>ADAPT-QAOA algorithm<a class="headerlink" href="#ADAPT-QAOA-algorithm" title
942
942
parameter</p>
943
943
<p>3- Optimize all parameters currently in the Ansatz <spanclass="math notranslate nohighlight">\(\beta_m, \gamma_m = 1, 2, ...k\)</span> such that <spanclass="math notranslate nohighlight">\(\braket{\psi (k)|H_C|\psi(k)}\)</span> is minimized, and return to the second step.</p>
944
944
<p>Below is a schematic representation of the ADAPT-QAOA algorithm explained above.</p>
<p>Suppose we have <spanclass="math notranslate nohighlight">\(f(x): \{0,1\} \longrightarrow \{0,1\}\)</span>. We can compute this function on a quantum computer using oracles which we treat as black box functions that yield the output with an appropriate sequence of logical gates.</p>
1004
1004
<p>Above you see an oracle represented as <spanclass="math notranslate nohighlight">\(U_f\)</span> which allows us to transform the state <spanclass="math notranslate nohighlight">\(\ket{x}\ket{y}\)</span> into:</p>
<h2>Deutsch’s Algorithm:<aclass="headerlink" href="#Deutsch's-Algorithm:" title="Permalink to this heading">¶</a></h2>
1048
1048
<p>Our aim is to find out if <spanclass="math notranslate nohighlight">\(f: \{0,1\} \longrightarrow \{0,1\}\)</span> is a constant or a balanced function? If constant, <spanclass="math notranslate nohighlight">\(f(0) = f(1)\)</span>, and if balanced, <spanclass="math notranslate nohighlight">\(f(0) \neq f(1)\)</span>.</p>
1049
1049
<p>We step through the circuit diagram below and follow the math after the application of each gate.</p>
<h2>Quantum Probability Image Encoding (QPIE):<aclass="headerlink" href="#Quantum-Probability-Image-Encoding-(QPIE):" title="Permalink to this heading">¶</a></h2>
981
981
<p>Lets take as an example a classical 2x2 image (4 pixels). We can label each pixel with its position</p>
</div><p>Each pixel will have its own color intensity represented along with its position label as an 8-bit black and white color. To convert the pixel intensity to probability amplitudes of a quantum state</p>
Copy file name to clipboardExpand all lines: pr-3313/applications/python/grovers.html
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1021,7 +1021,7 @@ <h3>Good and Bad States<a class="headerlink" href="#Good-and-Bad-States" title="
1021
1021
<p>Let us now examine the geometric picture behind our current discussion. We’ll consider the ambient Hilbert space to be spanned by the standard basis vectors <spanclass="math notranslate nohighlight">\(|0\rangle, |1\rangle, \dots, |N-1\rangle\)</span>, where the full dimension is <spanclass="math notranslate nohighlight">\(N = 2^n\)</span>. Since the uniform superposition state <spanclass="math notranslate nohighlight">\(|\xi\rangle\)</span> can be expressed as a linear combination of the states <spanclass="math notranslate nohighlight">\(|G\rangle\)</span> and <spanclass="math notranslate nohighlight">\(|B\rangle\)</span> with real coefficients, all three states <spanclass="math notranslate nohighlight">\(|\xi\rangle, |G\rangle,\)</span> and <spanclass="math notranslate nohighlight">\(|B\rangle\)</span>
1022
1022
reside in a two-dimensional real subspace of the ambient Hilbert space, which we can visualize as a 2D plane as in the image below. Since, <spanclass="math notranslate nohighlight">\(|G\rangle\)</span> and <spanclass="math notranslate nohighlight">\(|B\rangle\)</span> are orthogonal, we can imagine them graphed as unit vectors in the positive <spanclass="math notranslate nohighlight">\(y\)</span> and positive <spanclass="math notranslate nohighlight">\(x\)</span> directions, respectively. From our previous expression, <spanclass="math notranslate nohighlight">\(\ket{\xi} = \sin(\theta) |G\rangle + \cos(\theta) |B\rangle,\)</span> we see that the state <spanclass="math notranslate nohighlight">\(|\xi\rangle\)</span> forms an angle <spanclass="math notranslate nohighlight">\(\theta\)</span> with
</div><p>Given that the number of marked states <spanclass="math notranslate nohighlight">\(t\)</span> is typically small compared to <spanclass="math notranslate nohighlight">\(N\)</span>, it follows that <spanclass="math notranslate nohighlight">\(\theta = \arcsin\left(\sqrt{\frac{t}{N}}\right)\)</span> is a small angle. This assumption is reasonable, as otherwise, a sufficient number of independent queries to the oracle would likely yield a solution through classical search methods.</p>
</div><p>Running this circuit initializes <spanclass="math notranslate nohighlight">\(\ket{\xi}\)</span> and performs a rotation by <spanclass="math notranslate nohighlight">\(2\theta\)</span> (twice the angle between <spanclass="math notranslate nohighlight">\(|\xi\rangle\)</span> and <spanclass="math notranslate nohighlight">\(|B\rangle\)</span>) in the direction from <spanclass="math notranslate nohighlight">\(|B\rangle\)</span> to <spanclass="math notranslate nohighlight">\(|G\rangle\)</span>.</p>
</div><p>Let’s verify that the state resulting from one iteration of Grover’s algorithm brings us closer to the good state, <spanclass="math notranslate nohighlight">\(\ket{G}\)</span>. In particular, notice that the amplitudes of <codeclass="docutils literal notranslate"><spanclass="pre">1001</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">1111</span></code> in the resulting state have been amplified compared to the equal superposition of states.</p>
<h3>Step 1: Initialize (Classical pre-processing)<aclass="headerlink" href="#Step-1:-Initialize-(Classical-pre-processing)" title="Permalink to this heading">¶</a></h3>
Copy file name to clipboardExpand all lines: pr-3313/examples/python/performance_optimizations.html
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -927,9 +927,9 @@ <h1>Optimizing Performance<a class="headerlink" href="#Optimizing-Performance" t
927
927
<sectionid="Gate-Fusion">
928
928
<h2>Gate Fusion<aclass="headerlink" href="#Gate-Fusion" title="Permalink to this heading">¶</a></h2>
929
929
<p>Gate fusion is an optimization technique where consecutive gates are combined into a single gate operation to improve the efficiency of the simulation (See figure below). By targeting the <codeclass="docutils literal notranslate"><spanclass="pre">nvidia-mgpu</span></code> backend and setting the <codeclass="docutils literal notranslate"><spanclass="pre">CUDAQ_MGPU_FUSE</span></code> environment variable, you can select the degree of fusion that takes place. A full command line example would look like <codeclass="docutils literal notranslate"><spanclass="pre">CUDAQ_MGPU_FUSE=4</span><spanclass="pre">python</span><spanclass="pre">c2h2VQE.py</span><spanclass="pre">--target</span><spanclass="pre">nvidia</span><spanclass="pre">--target-option</span><spanclass="pre">fp64,mgpu</span></code></p>
<p>The importance of gate fusion is system dependent, but can have a large influence on the performance of the simulation. See the example below for a 24 qubit VQE experiment where changing the fusion level resulted in significant performance boosts.</p>
0 commit comments