Skip to content

Commit b54faaf

Browse files
Docs preview for PR #3633.
1 parent bd67356 commit b54faaf

29 files changed

+111
-83
lines changed

pr-3633/_sources/applications/python/digitized_counterdiabatic_qaoa.ipynb.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"#non_edges=[[u,v] for u in nodes for v in nodes if u<v and [u,v] not in edges]\n",
103103
"#print('Edges: ', edges)\n",
104104
"#print('Non-edges: ', non_edges)\n",
105-
"#weights=[0.6686,0.6686,0.6686,0.1091,0.0770,0.0770,0.0770,0.0770]\n",
105+
"#weights=[0.6686,0.6686,0.6686,0.1091,0.0770,0.0770,0.0770,0.1943]\n",
106106
"#penalty=8.0\n",
107107
"#num_layers=8"
108108
]
@@ -400,7 +400,7 @@
400400
],
401401
"metadata": {
402402
"kernelspec": {
403-
"display_name": "Python 3 (ipykernel)",
403+
"display_name": "Python 3",
404404
"language": "python",
405405
"name": "python3"
406406
},
@@ -414,7 +414,7 @@
414414
"name": "python",
415415
"nbconvert_exporter": "python",
416416
"pygments_lexer": "ipython3",
417-
"version": "3.10.12"
417+
"version": "3.12.3"
418418
}
419419
},
420420
"nbformat": 4,

pr-3633/api/languages/python_api.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,7 @@ <h3>Spin Operators<a class="headerlink" href="#spin-operators" title="Permalink
24692469
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">random</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.operators.spin.SpinOperator.random" title="Permalink to this definition">¶</a></dt>
24702470
<dd><dl class="py function">
24712471
<dt class="sig sig-object py">
2472-
<span class="sig-name descname"><span class="pre">random</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">qubit_count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">term_count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><span class="pre">int</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1810332764</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#cudaq.operators.spin.SpinOperator" title="cudaq.operators.spin.SpinOperator"><span class="pre">SpinOperator</span></a></span></span></dt>
2472+
<span class="sig-name descname"><span class="pre">random</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">qubit_count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">term_count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><span class="pre">int</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1898350550</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#cudaq.operators.spin.SpinOperator" title="cudaq.operators.spin.SpinOperator"><span class="pre">SpinOperator</span></a></span></span></dt>
24732473
<dd></dd></dl>
24742474

24752475
<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>
@@ -6054,6 +6054,17 @@ <h2>Data Types<a class="headerlink" href="#data-types" title="Permalink to this
60546054
<p>Print a string of the raw resource counts data to the terminal.</p>
60556055
</dd></dl>
60566056

6057+
<dl class="py method">
6058+
<dt class="sig sig-object py" id="cudaq.Resources.to_dict">
6059+
<span class="sig-name descname"><span class="pre">to_dict</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.Resources.to_dict" title="Permalink to this definition">¶</a></dt>
6060+
<dd><dl class="py function">
6061+
<dt class="sig sig-object py">
6062+
<span class="sig-name descname"><span class="pre">to_dict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#cudaq.Resources" title="cudaq.Resources"><span class="pre">Resources</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.14)"><span class="pre">dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.14)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.14)"><span class="pre">int</span></a><span class="p"><span class="pre">]</span></span></span></span></dt>
6063+
<dd></dd></dl>
6064+
6065+
<p>Return a dictionary of the raw resource counts that are stored in <code class="code docutils literal notranslate"><span class="pre">self</span></code>.</p>
6066+
</dd></dl>
6067+
60576068
</dd></dl>
60586069

60596070
<section id="optimizers">

pr-3633/api/languages/python_api.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3661,7 +3661,7 @@ aria-hidden="true"}](../default_ops.html "Quantum Operations"){.btn
36613661

36623662
:
36633663

3664-
[[random]{.pre}]{.sig-name .descname}[(]{.sig-paren}*[[qubit_count]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.14)"){.reference .external}]{.n}*, *[[term_count]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.14)"){.reference .external}]{.n}*, *[[seed]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.14)"){.reference .external}]{.n}[ ]{.w}[[=]{.pre}]{.o}[ ]{.w}[[1810332764]{.pre}]{.default_value}*[)]{.sig-paren} [[→]{.sig-return-icon} [[[SpinOperator]{.pre}](#cudaq.operators.spin.SpinOperator "cudaq.operators.spin.SpinOperator"){.reference .internal}]{.sig-return-typehint}]{.sig-return}
3664+
[[random]{.pre}]{.sig-name .descname}[(]{.sig-paren}*[[qubit_count]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.14)"){.reference .external}]{.n}*, *[[term_count]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.14)"){.reference .external}]{.n}*, *[[seed]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.14)"){.reference .external}]{.n}[ ]{.w}[[=]{.pre}]{.o}[ ]{.w}[[1898350550]{.pre}]{.default_value}*[)]{.sig-paren} [[→]{.sig-return-icon} [[[SpinOperator]{.pre}](#cudaq.operators.spin.SpinOperator "cudaq.operators.spin.SpinOperator"){.reference .internal}]{.sig-return-typehint}]{.sig-return}
36653665

36663666
:
36673667

@@ -7933,6 +7933,17 @@ aria-hidden="true"}](../default_ops.html "Quantum Operations"){.btn
79337933

79347934
Print a string of the raw resource counts data to the terminal.
79357935

7936+
[[to_dict]{.pre}]{.sig-name .descname}[(]{.sig-paren}[)]{.sig-paren}[¶](#cudaq.Resources.to_dict "Permalink to this definition"){.headerlink}
7937+
7938+
:
7939+
7940+
[[to_dict]{.pre}]{.sig-name .descname}[(]{.sig-paren}*[[self]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[Resources]{.pre}](#cudaq.Resources "cudaq.Resources"){.reference .internal}]{.n}*[)]{.sig-paren} [[→]{.sig-return-icon} [[[dict]{.pre}](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.14)"){.reference .external}[[\[]{.pre}]{.p}[[str]{.pre}](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.14)"){.reference .external}[[,]{.pre}]{.p}[ ]{.w}[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.14)"){.reference .external}[[\]]{.pre}]{.p}]{.sig-return-typehint}]{.sig-return}
7941+
7942+
:
7943+
7944+
Return a dictionary of the raw resource counts that are stored
7945+
in [`self`{.code .docutils .literal .notranslate}]{.pre}.
7946+
79367947
::: {#optimizers .section}
79377948
### Optimizers[¶](#optimizers "Permalink to this heading"){.headerlink}
79387949

pr-3633/applications/python/adapt_qaoa.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ <h1>ADAPT-QAOA algorithm<a class="headerlink" href="#ADAPT-QAOA-algorithm" title
10281028
parameter</p>
10291029
<p>3- Optimize all parameters currently in the Ansatz <span class="math notranslate nohighlight">\(\beta_m, \gamma_m = 1, 2, ...k\)</span> such that <span class="math notranslate nohighlight">\(\braket{\psi (k)|H_C|\psi(k)}\)</span> is minimized, and return to the second step.</p>
10301030
<p>Below is a schematic representation of the ADAPT-QAOA algorithm explained above.</p>
1031-
<div><p><img alt="3c4f21a8523944edb939ab136ef4ba87" class="no-scaled-link" src="../../_images/adapt-qaoa.png" style="width: 1000px;" /></p>
1031+
<div><p><img alt="3722228d83e6436cb59069e08f6aa98a" class="no-scaled-link" src="../../_images/adapt-qaoa.png" style="width: 1000px;" /></p>
10321032
</div><div class="nbinput nblast docutils container">
10331033
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[15]:
10341034
</pre></div>

pr-3633/applications/python/adapt_qaoa.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ explained above.
18091809

18101810
<div>
18111811

1812-
![3c4f21a8523944edb939ab136ef4ba87](../../_images/adapt-qaoa.png){.no-scaled-link
1812+
![3722228d83e6436cb59069e08f6aa98a](../../_images/adapt-qaoa.png){.no-scaled-link
18131813
style="width: 1000px;"}
18141814

18151815
</div>

pr-3633/applications/python/adapt_vqe.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ <h1>ADAPT-VQE algorithm<a class="headerlink" href="#ADAPT-VQE-algorithm" title="
10251025
<p>7- Perform a VQE experiment to re-optimize all parameters in the ansatz.</p>
10261026
<p>8- go to step 4</p>
10271027
<p>Below is a Schematic depiction of the ADAPT-VQE algorithm</p>
1028-
<div><p><img alt="15eabb7aff604a6789a43d34128c7a14" class="no-scaled-link" src="../../_images/adapt-vqe.png" style="width: 800px;" /></p>
1028+
<div><p><img alt="ece3349885224c528cb09332f617966e" class="no-scaled-link" src="../../_images/adapt-vqe.png" style="width: 800px;" /></p>
10291029
</div><div class="nbinput docutils container">
10301030
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[1]:
10311031
</pre></div>

pr-3633/applications/python/adapt_vqe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,7 @@ Below is a Schematic depiction of the ADAPT-VQE algorithm
17771777

17781778
<div>
17791779

1780-
![15eabb7aff604a6789a43d34128c7a14](../../_images/adapt-vqe.png){.no-scaled-link
1780+
![ece3349885224c528cb09332f617966e](../../_images/adapt-vqe.png){.no-scaled-link
17811781
style="width: 800px;"}
17821782

17831783
</div>

pr-3633/applications/python/deutsch_algorithm.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ <h2>XOR <span class="math notranslate nohighlight">\(\oplus\)</span><a class="he
10851085
</section>
10861086
<section id="Quantum-oracles">
10871087
<h2>Quantum oracles<a class="headerlink" href="#Quantum-oracles" title="Permalink to this heading"></a></h2>
1088-
<p><img alt="c2154eb61cb14a088154c3fa43da5d7e" class="no-scaled-link" src="../../_images/oracle.png" style="width: 300px; height: 150px;" /></p>
1088+
<p><img alt="0e7906acdd424457808c303766965876" class="no-scaled-link" src="../../_images/oracle.png" style="width: 300px; height: 150px;" /></p>
10891089
<p>Suppose we have <span class="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>
10901090
<p>Above you see an oracle represented as <span class="math notranslate nohighlight">\(U_f\)</span> which allows us to transform the state <span class="math notranslate nohighlight">\(\ket{x}\ket{y}\)</span> into:</p>
10911091
<div class="math notranslate nohighlight">
@@ -1133,7 +1133,7 @@ <h2>Quantum parallelism<a class="headerlink" href="#Quantum-parallelism" title="
11331133
<h2>Deutsch’s Algorithm:<a class="headerlink" href="#Deutsch's-Algorithm:" title="Permalink to this heading"></a></h2>
11341134
<p>Our aim is to find out if <span class="math notranslate nohighlight">\(f: \{0,1\} \longrightarrow \{0,1\}\)</span> is a constant or a balanced function? If constant, <span class="math notranslate nohighlight">\(f(0) = f(1)\)</span>, and if balanced, <span class="math notranslate nohighlight">\(f(0) \neq f(1)\)</span>.</p>
11351135
<p>We step through the circuit diagram below and follow the math after the application of each gate.</p>
1136-
<p><img alt="f3480281c95f469eb759ec8239d58118" class="no-scaled-link" src="../../_images/deutsch.png" style="width: 500px; height: 210px;" /></p>
1136+
<p><img alt="03f6cdbf6bdf4cf795a566ab6db966e7" class="no-scaled-link" src="../../_images/deutsch.png" style="width: 500px; height: 210px;" /></p>
11371137
<div class="math notranslate nohighlight">
11381138
\[\ket{\psi_0} = \ket{01}
11391139
\tag{1}\]</div>

pr-3633/applications/python/deutsch_algorithm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ number, the result is 0 otherwise 1.
18581858
::: {#Quantum-oracles .section}
18591859
## Quantum oracles[](#Quantum-oracles "Permalink to this heading"){.headerlink}
18601860

1861-
![c2154eb61cb14a088154c3fa43da5d7e](../../_images/oracle.png){.no-scaled-link
1861+
![0e7906acdd424457808c303766965876](../../_images/oracle.png){.no-scaled-link
18621862
style="width: 300px; height: 150px;"}
18631863

18641864
Suppose we have [\\(f(x): \\{0,1\\} \\longrightarrow \\{0,1\\}\\)]{.math
@@ -1964,7 +1964,7 @@ balanced function? If constant, [\\(f(0) = f(1)\\)]{.math .notranslate
19641964
We step through the circuit diagram below and follow the math after the
19651965
application of each gate.
19661966

1967-
![f3480281c95f469eb759ec8239d58118](../../_images/deutsch.png){.no-scaled-link
1967+
![03f6cdbf6bdf4cf795a566ab6db966e7](../../_images/deutsch.png){.no-scaled-link
19681968
style="width: 500px; height: 210px;"}
19691969

19701970
::: {.math .notranslate .nohighlight}

pr-3633/applications/python/digitized_counterdiabatic_qaoa.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ <h2>CUDA-Q Implementation<a class="headerlink" href="#CUDA-Q-Implementation" tit
10671067
<span class="c1">#non_edges=[[u,v] for u in nodes for v in nodes if u&lt;v and [u,v] not in edges]</span>
10681068
<span class="c1">#print(&#39;Edges: &#39;, edges)</span>
10691069
<span class="c1">#print(&#39;Non-edges: &#39;, non_edges)</span>
1070-
<span class="c1">#weights=[0.6686,0.6686,0.6686,0.1091,0.0770,0.0770,0.0770,0.0770]</span>
1070+
<span class="c1">#weights=[0.6686,0.6686,0.6686,0.1091,0.0770,0.0770,0.0770,0.1943]</span>
10711071
<span class="c1">#penalty=8.0</span>
10721072
<span class="c1">#num_layers=8</span>
10731073
</pre></div>

0 commit comments

Comments
 (0)