Skip to content

Commit 164045f

Browse files
Docs preview for PR #3392.
1 parent 858ba7e commit 164045f

27 files changed

+139
-115
lines changed

pr-3392/_sources/using/extending/backend.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Here's a template for implementing a server helper class:
8383
8484
/// @brief Example implementation of backend initialization.
8585
void initialize(BackendConfig config) override {
86-
cudaq::info("Initializing Provider Name Backend");
86+
CUDAQ_INFO("Initializing Provider Name Backend");
8787
backendConfig = config;
8888
8989
if (!backendConfig.count("url"))
@@ -143,7 +143,7 @@ Here's a template for implementing a server helper class:
143143
/// This is the place to do that.
144144
cudaq::sample_result processResults(ServerMessage &getJobResponse,
145145
std::string &jobId) override {
146-
cudaq::info("Processing results: {}", getJobResponse.dump());
146+
CUDAQ_INFO("Processing results: {}", getJobResponse.dump());
147147
148148
// Extract measurement results from the response
149149
auto samplesJson = getJobResponse["results"]["counts"];

pr-3392/api/languages/python_api.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,7 @@ <h3>Spin Operators<a class="headerlink" href="#spin-operators" title="Permalink
23902390
<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>
23912391
<dd><dl class="py function">
23922392
<dt class="sig sig-object py">
2393-
<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.13)"><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.13)"><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.13)"><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">2964267844</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>
2393+
<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.13)"><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.13)"><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.13)"><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">2381283489</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>
23942394
<dd></dd></dl>
23952395

23962396
<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>
@@ -6738,6 +6738,17 @@ <h3>Noisy Simulation<a class="headerlink" href="#noisy-simulation" title="Permal
67386738
<p>Add a <a class="reference internal" href="#cudaq.KrausOperator" title="cudaq.KrausOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">KrausOperator</span></code></a> to this <a class="reference internal" href="#cudaq.KrausChannel" title="cudaq.KrausChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">KrausChannel</span></code></a>.</p>
67396739
</dd></dl>
67406740

6741+
<dl class="py method">
6742+
<dt class="sig sig-object py" id="cudaq.KrausChannel.get_ops">
6743+
<span class="sig-name descname"><span class="pre">get_ops</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cudaq.KrausChannel.get_ops" title="Permalink to this definition">¶</a></dt>
6744+
<dd><dl class="py function">
6745+
<dt class="sig sig-object py">
6746+
<span class="sig-name descname"><span class="pre">get_ops</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.KrausChannel" title="cudaq.KrausChannel"><span class="pre">KrausChannel</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#list" title="(in Python v3.13)"><span class="pre">list</span></a><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#cudaq.KrausOperator" title="cudaq.KrausOperator"><span class="pre">KrausOperator</span></a><span class="p"><span class="pre">]</span></span></span></span></dt>
6747+
<dd></dd></dl>
6748+
6749+
<p>Return the <a class="reference internal" href="#cudaq.KrausOperator" title="cudaq.KrausOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">KrausOperator</span></code></a>’s in this <a class="reference internal" href="#cudaq.KrausChannel" title="cudaq.KrausChannel"><code class="xref py py-class docutils literal notranslate"><span class="pre">KrausChannel</span></code></a>.</p>
6750+
</dd></dl>
6751+
67416752
</dd></dl>
67426753

67436754
<dl class="py class">

pr-3392/api/languages/python_api.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3461,7 +3461,7 @@ Operators[¶](#operators "Permalink to this heading"){.headerlink}
34613461

34623462
:
34633463

3464-
[[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.13)"){.reference .external}]{.n}*, *[[term\_count]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)"){.reference .external}]{.n}*, *[[seed]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)"){.reference .external}]{.n}[ ]{.w}[[=]{.pre}]{.o}[ ]{.w}[[2964267844]{.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}
3464+
[[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.13)"){.reference .external}]{.n}*, *[[term\_count]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)"){.reference .external}]{.n}*, *[[seed]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[int]{.pre}](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)"){.reference .external}]{.n}[ ]{.w}[[=]{.pre}]{.o}[ ]{.w}[[2381283489]{.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}
34653465

34663466
:
34673467

@@ -8484,6 +8484,22 @@ Data Types[¶](#data-types "Permalink to this heading"){.headerlink}
84848484
.notranslate}](#cudaq.KrausChannel "cudaq.KrausChannel"){.reference
84858485
.internal}.
84868486

8487+
[[get\_ops]{.pre}]{.sig-name .descname}[(]{.sig-paren}[)]{.sig-paren}[¶](#cudaq.KrausChannel.get_ops "Permalink to this definition"){.headerlink}
8488+
8489+
:
8490+
8491+
[[get\_ops]{.pre}]{.sig-name .descname}[(]{.sig-paren}*[[self]{.pre}]{.n}[[:]{.pre}]{.p}[ ]{.w}[[[KrausChannel]{.pre}](#cudaq.KrausChannel "cudaq.KrausChannel"){.reference .internal}]{.n}*[)]{.sig-paren} [[→]{.sig-return-icon} [[[list]{.pre}](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)"){.reference .external}[[\[]{.pre}]{.p}[[KrausOperator]{.pre}](#cudaq.KrausOperator "cudaq.KrausOperator"){.reference .internal}[[\]]{.pre}]{.p}]{.sig-return-typehint}]{.sig-return}
8492+
8493+
:
8494+
8495+
Return the [`KrausOperator`{.xref .py .py-class .docutils
8496+
.literal
8497+
.notranslate}](#cudaq.KrausOperator "cudaq.KrausOperator"){.reference
8498+
.internal}'s in this [`KrausChannel`{.xref .py .py-class
8499+
.docutils .literal
8500+
.notranslate}](#cudaq.KrausChannel "cudaq.KrausChannel"){.reference
8501+
.internal}.
8502+
84878503
```{=html}
84888504
<!-- -->
84898505
```

pr-3392/applications/python/adapt_qaoa.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ <h1>ADAPT-QAOA algorithm<a class="headerlink" href="#ADAPT-QAOA-algorithm" title
978978
parameter</p>
979979
<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>
980980
<p>Below is a schematic representation of the ADAPT-QAOA algorithm explained above.</p>
981-
<div><p><img alt="f7cc4c4c7c694a4dbdc2125eee9d5a4d" class="no-scaled-link" src="../../_images/adapt-qaoa.png" style="width: 1000px;" /></p>
981+
<div><p><img alt="3b6304e03ee74146b37d160d367a85b2" class="no-scaled-link" src="../../_images/adapt-qaoa.png" style="width: 1000px;" /></p>
982982
</div><div class="nbinput nblast docutils container">
983983
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[15]:
984984
</pre></div>

pr-3392/applications/python/adapt_qaoa.md

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

17161716
<div>
17171717

1718-
![f7cc4c4c7c694a4dbdc2125eee9d5a4d](../../_images/adapt-qaoa.png){.no-scaled-link}
1718+
![3b6304e03ee74146b37d160d367a85b2](../../_images/adapt-qaoa.png){.no-scaled-link}
17191719

17201720
</div>
17211721

pr-3392/applications/python/adapt_vqe.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ <h1>ADAPT-VQE algorithm<a class="headerlink" href="#ADAPT-VQE-algorithm" title="
975975
<p>7- Perform a VQE experiment to re-optimize all parameters in the ansatz.</p>
976976
<p>8- go to step 4</p>
977977
<p>Below is a Schematic depiction of the ADAPT-VQE algorithm</p>
978-
<div><p><img alt="1c1e1ac6afe74326aedfce0b563605ef" class="no-scaled-link" src="../../_images/adapt-vqe.png" style="width: 800px;" /></p>
978+
<div><p><img alt="95b13ad8193b4e1c94834d616d5b1ba1" class="no-scaled-link" src="../../_images/adapt-vqe.png" style="width: 800px;" /></p>
979979
</div><div class="nbinput docutils container">
980980
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[1]:
981981
</pre></div>

pr-3392/applications/python/adapt_vqe.md

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

16851685
<div>
16861686

1687-
![1c1e1ac6afe74326aedfce0b563605ef](../../_images/adapt-vqe.png){.no-scaled-link}
1687+
![95b13ad8193b4e1c94834d616d5b1ba1](../../_images/adapt-vqe.png){.no-scaled-link}
16881688

16891689
</div>
16901690

pr-3392/applications/python/deutsch_algorithm.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ <h2>XOR <span class="math notranslate nohighlight">\(\oplus\)</span><a class="he
10351035
</section>
10361036
<section id="Quantum-oracles">
10371037
<h2>Quantum oracles<a class="headerlink" href="#Quantum-oracles" title="Permalink to this heading"></a></h2>
1038-
<p><img alt="a79351d373524b2e898a4cd31b1a120e" class="no-scaled-link" src="../../_images/oracle.png" style="width: 300px; height: 150px;" /></p>
1038+
<p><img alt="0cc50f41cd424e24a9381a90524d5f24" class="no-scaled-link" src="../../_images/oracle.png" style="width: 300px; height: 150px;" /></p>
10391039
<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>
10401040
<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>
10411041
<div class="math notranslate nohighlight">
@@ -1083,7 +1083,7 @@ <h2>Quantum parallelism<a class="headerlink" href="#Quantum-parallelism" title="
10831083
<h2>Deutsch’s Algorithm:<a class="headerlink" href="#Deutsch's-Algorithm:" title="Permalink to this heading"></a></h2>
10841084
<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>
10851085
<p>We step through the circuit diagram below and follow the math after the application of each gate.</p>
1086-
<p><img alt="28b210c7a78747aabd5190e8fdfbb6b0" class="no-scaled-link" src="../../_images/deutsch.png" style="width: 500px; height: 210px;" /></p>
1086+
<p><img alt="caeb470bb43146918148b898473f78d3" class="no-scaled-link" src="../../_images/deutsch.png" style="width: 500px; height: 210px;" /></p>
10871087
<div class="math notranslate nohighlight">
10881088
\[\ket{\psi_0} = \ket{01}
10891089
\tag{1}\]</div>

pr-3392/applications/python/deutsch_algorithm.md

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

1770-
![a79351d373524b2e898a4cd31b1a120e](../../_images/oracle.png){.no-scaled-link}
1770+
![0cc50f41cd424e24a9381a90524d5f24](../../_images/oracle.png){.no-scaled-link}
17711771

17721772
Suppose we have [\\(f(x): \\{0,1\\} \\longrightarrow \\{0,1\\}\\)]{.math
17731773
.notranslate .nohighlight}. We can compute this function on a quantum
@@ -1874,7 +1874,7 @@ balanced function? If constant, [\\(f(0) = f(1)\\)]{.math .notranslate
18741874
We step through the circuit diagram below and follow the math after the
18751875
application of each gate.
18761876

1877-
![28b210c7a78747aabd5190e8fdfbb6b0](../../_images/deutsch.png){.no-scaled-link}
1877+
![caeb470bb43146918148b898473f78d3](../../_images/deutsch.png){.no-scaled-link}
18781878

18791879
::: {.math .notranslate .nohighlight}
18801880
\\\[\\ket{\\psi\_0} = \\ket{01} \\tag{1}\\\]

pr-3392/applications/python/edge_detection.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ <h2>Image<a class="headerlink" href="#Image" title="Permalink to this heading">
10151015
<section id="Quantum-Probability-Image-Encoding-(QPIE):">
10161016
<h2>Quantum Probability Image Encoding (QPIE):<a class="headerlink" href="#Quantum-Probability-Image-Encoding-(QPIE):" title="Permalink to this heading"></a></h2>
10171017
<p>Lets take as an example a classical 2x2 image (4 pixels). We can label each pixel with its position</p>
1018-
<div><p><img alt="3f95c32a76354be8bd273bfec8036f92" class="no-scaled-link" src="../../_images/pixels-img.png" style="width: 200px;" /></p>
1018+
<div><p><img alt="73ebd17db1c54d5da31c589f536558a8" class="no-scaled-link" src="../../_images/pixels-img.png" style="width: 200px;" /></p>
10191019
</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>
10201020
<div class="math notranslate nohighlight">
10211021
\[c_i = \frac{I_{yx}}{\sqrt(\sum I^2_{yx})}\]</div>

0 commit comments

Comments
 (0)