Skip to content

Commit 9971fa8

Browse files
Docs preview for PR #2590.
1 parent 3335d6b commit 9971fa8

File tree

103 files changed

+506
-307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+506
-307
lines changed

pr-2590/_sources/applications/python/deutsch_jozsa.ipynb.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"id": "7aa9cc8f-4e42-401f-a1fd-665e5cda19c7",
66
"metadata": {},
77
"source": [
8-
"## _*The Deutsch-Jozsa Algorithm*_\n",
8+
"# The Deutsch-Jozsa Algorithm\n",
99
"\n",
1010
"Here is the link to the original paper: [Deutsch-Jozsa algorithm](http://rspa.royalsocietypublishing.org/content/439/1907/553). This algorithm is an earlier demonstration of the computational advantage of quantum algorithm over classical one. It addresses the problem of identifying the nature of a hidden Boolean function, which is provided as an oracle. The function is guaranteed to be either:\n",
1111
"\n",

pr-2590/_sources/using/backends/sims/tnsims.rst.txt

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ Specific aspects of the simulation can be configured by setting the following of
8181
* **`CUDA_VISIBLE_DEVICES=X`**: Makes the process only see GPU X on multi-GPU nodes. Each MPI process must only see its own dedicated GPU. For example, if you run 8 MPI processes on a DGX system with 8 GPUs, each MPI process should be assigned its own dedicated GPU via `CUDA_VISIBLE_DEVICES` when invoking `mpiexec` (or `mpirun`) commands.
8282
* **`OMP_PLACES=cores`**: Set this environment variable to improve CPU parallelization.
8383
* **`OMP_NUM_THREADS=X`**: To enable CPU parallelization, set X to `NUMBER_OF_CORES_PER_NODE/NUMBER_OF_GPUS_PER_NODE`.
84+
* **`CUDAQ_TENSORNET_CONTROLLED_RANK=X`**: Specify the number of controlled qubits whereby the full tensor body of the controlled gate is expanded. If the number of controlled qubits is greater than this value, the gate is applied as a controlled tensor operator to the tensor network state. Default value is 1.
85+
* **`CUDAQ_TENSORNET_OBSERVE_CONTRACT_PATH_REUSE=X`**: Set this environment variable to `TRUE` (`ON`) or `FALSE` (`OFF`) to enable or disable contraction path reuse when computing expectation values. Default is `OFF`.
86+
* **`CUDAQ_TENSORNET_NUM_HYPER_SAMPLES=X`**: Specify the number of hyper samples used in the tensor network contraction path finder. Default value is 8 if not specified.
8487

8588
.. note::
8689

pr-2590/api/api.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,11 @@
227227
<li class="toctree-l3"><a class="reference internal" href="../applications/python/deutschs_algorithm.html#Deutsch's-Algorithm:">Deutsch’s Algorithm:</a></li>
228228
</ul>
229229
</li>
230-
<li class="toctree-l2"><a class="reference internal" href="../applications/python/deutsch_jozsa.html"><em>The Deutsch-Jozsa Algorithm</em></a></li>
231-
<li class="toctree-l2"><a class="reference internal" href="../applications/python/deutsch_jozsa.html#The-Theory">The Theory</a></li>
232-
<li class="toctree-l2"><a class="reference internal" href="../applications/python/deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
230+
<li class="toctree-l2"><a class="reference internal" href="../applications/python/deutsch_jozsa.html">The Deutsch-Jozsa Algorithm</a><ul>
231+
<li class="toctree-l3"><a class="reference internal" href="../applications/python/deutsch_jozsa.html#The-Theory">The Theory</a></li>
232+
<li class="toctree-l3"><a class="reference internal" href="../applications/python/deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
233+
</ul>
234+
</li>
233235
<li class="toctree-l2"><a class="reference internal" href="../applications/python/hamiltonian_simulation.html">Spin-Hamiltonian Simulation Using CUDA-Q</a><ul>
234236
<li class="toctree-l3"><a class="reference internal" href="../applications/python/hamiltonian_simulation.html#Introduction">Introduction</a><ul>
235237
<li class="toctree-l4"><a class="reference internal" href="../applications/python/hamiltonian_simulation.html#Heisenberg-Hamiltonian">Heisenberg Hamiltonian</a></li>

pr-2590/api/default_ops.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,11 @@
229229
<li class="toctree-l3"><a class="reference internal" href="../applications/python/deutschs_algorithm.html#Deutsch's-Algorithm:">Deutsch’s Algorithm:</a></li>
230230
</ul>
231231
</li>
232-
<li class="toctree-l2"><a class="reference internal" href="../applications/python/deutsch_jozsa.html"><em>The Deutsch-Jozsa Algorithm</em></a></li>
233-
<li class="toctree-l2"><a class="reference internal" href="../applications/python/deutsch_jozsa.html#The-Theory">The Theory</a></li>
234-
<li class="toctree-l2"><a class="reference internal" href="../applications/python/deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
232+
<li class="toctree-l2"><a class="reference internal" href="../applications/python/deutsch_jozsa.html">The Deutsch-Jozsa Algorithm</a><ul>
233+
<li class="toctree-l3"><a class="reference internal" href="../applications/python/deutsch_jozsa.html#The-Theory">The Theory</a></li>
234+
<li class="toctree-l3"><a class="reference internal" href="../applications/python/deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
235+
</ul>
236+
</li>
235237
<li class="toctree-l2"><a class="reference internal" href="../applications/python/hamiltonian_simulation.html">Spin-Hamiltonian Simulation Using CUDA-Q</a><ul>
236238
<li class="toctree-l3"><a class="reference internal" href="../applications/python/hamiltonian_simulation.html#Introduction">Introduction</a><ul>
237239
<li class="toctree-l4"><a class="reference internal" href="../applications/python/hamiltonian_simulation.html#Heisenberg-Hamiltonian">Heisenberg Hamiltonian</a></li>

pr-2590/api/languages/cpp_api.html

+7-5
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,11 @@
227227
<li class="toctree-l3"><a class="reference internal" href="../../applications/python/deutschs_algorithm.html#Deutsch's-Algorithm:">Deutsch’s Algorithm:</a></li>
228228
</ul>
229229
</li>
230-
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html"><em>The Deutsch-Jozsa Algorithm</em></a></li>
231-
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html#The-Theory">The Theory</a></li>
232-
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
230+
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html">The Deutsch-Jozsa Algorithm</a><ul>
231+
<li class="toctree-l3"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html#The-Theory">The Theory</a></li>
232+
<li class="toctree-l3"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
233+
</ul>
234+
</li>
233235
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/hamiltonian_simulation.html">Spin-Hamiltonian Simulation Using CUDA-Q</a><ul>
234236
<li class="toctree-l3"><a class="reference internal" href="../../applications/python/hamiltonian_simulation.html#Introduction">Introduction</a><ul>
235237
<li class="toctree-l4"><a class="reference internal" href="../../applications/python/hamiltonian_simulation.html#Heisenberg-Hamiltonian">Heisenberg Hamiltonian</a></li>
@@ -2613,8 +2615,8 @@ <h2>Noise Modeling<a class="headerlink" href="#noise-modeling" title="Permalink
26132615
</dd></dl>
26142616

26152617
<dl class="cpp function">
2616-
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq13kraus_channel7get_opsEv">
2617-
<span class="target" id="classcudaq_1_1kraus__channel_1ad86a7f7a00f7cea74d4d3ab684e32a35"></span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">vector</span></span><span class="p"><span class="pre">&lt;</span></span><a class="reference internal" href="#_CPPv4N5cudaq8kraus_opE" title="cudaq::kraus_op"><span class="n"><span class="pre">kraus_op</span></span></a><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">get_ops</span></span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5cudaq13kraus_channel7get_opsEv" title="Permalink to this definition">¶</a><br /></dt>
2618+
<dt class="sig sig-object cpp" id="_CPPv4NK5cudaq13kraus_channel7get_opsEv">
2619+
<span class="target" id="classcudaq_1_1kraus__channel_1a81c44b3c4097d0c417377511164cce4c"></span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">vector</span></span><span class="p"><span class="pre">&lt;</span></span><a class="reference internal" href="#_CPPv4N5cudaq8kraus_opE" title="cudaq::kraus_op"><span class="n"><span class="pre">kraus_op</span></span></a><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">get_ops</span></span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><span class="w"> </span><span class="k"><span class="pre">const</span></span><a class="headerlink" href="#_CPPv4NK5cudaq13kraus_channel7get_opsEv" title="Permalink to this definition">¶</a><br /></dt>
26182620
<dd><p>Return all kraus_ops in this channel. </p>
26192621
</dd></dl>
26202622

pr-2590/api/languages/python_api.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,11 @@
227227
<li class="toctree-l3"><a class="reference internal" href="../../applications/python/deutschs_algorithm.html#Deutsch's-Algorithm:">Deutsch’s Algorithm:</a></li>
228228
</ul>
229229
</li>
230-
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html"><em>The Deutsch-Jozsa Algorithm</em></a></li>
231-
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html#The-Theory">The Theory</a></li>
232-
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
230+
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html">The Deutsch-Jozsa Algorithm</a><ul>
231+
<li class="toctree-l3"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html#The-Theory">The Theory</a></li>
232+
<li class="toctree-l3"><a class="reference internal" href="../../applications/python/deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
233+
</ul>
234+
</li>
233235
<li class="toctree-l2"><a class="reference internal" href="../../applications/python/hamiltonian_simulation.html">Spin-Hamiltonian Simulation Using CUDA-Q</a><ul>
234236
<li class="toctree-l3"><a class="reference internal" href="../../applications/python/hamiltonian_simulation.html#Introduction">Introduction</a><ul>
235237
<li class="toctree-l4"><a class="reference internal" href="../../applications/python/hamiltonian_simulation.html#Heisenberg-Hamiltonian">Heisenberg Hamiltonian</a></li>

pr-2590/applications/python/afqmc.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@
230230
<li class="toctree-l3"><a class="reference internal" href="deutschs_algorithm.html#Deutsch's-Algorithm:">Deutsch’s Algorithm:</a></li>
231231
</ul>
232232
</li>
233-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html"><em>The Deutsch-Jozsa Algorithm</em></a></li>
234-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html#The-Theory">The Theory</a></li>
235-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
233+
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html">The Deutsch-Jozsa Algorithm</a><ul>
234+
<li class="toctree-l3"><a class="reference internal" href="deutsch_jozsa.html#The-Theory">The Theory</a></li>
235+
<li class="toctree-l3"><a class="reference internal" href="deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
236+
</ul>
237+
</li>
236238
<li class="toctree-l2"><a class="reference internal" href="hamiltonian_simulation.html">Spin-Hamiltonian Simulation Using CUDA-Q</a><ul>
237239
<li class="toctree-l3"><a class="reference internal" href="hamiltonian_simulation.html#Introduction">Introduction</a><ul>
238240
<li class="toctree-l4"><a class="reference internal" href="hamiltonian_simulation.html#Heisenberg-Hamiltonian">Heisenberg Hamiltonian</a></li>

pr-2590/applications/python/bernstein_vazirani.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@
230230
<li class="toctree-l3"><a class="reference internal" href="deutschs_algorithm.html#Deutsch's-Algorithm:">Deutsch’s Algorithm:</a></li>
231231
</ul>
232232
</li>
233-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html"><em>The Deutsch-Jozsa Algorithm</em></a></li>
234-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html#The-Theory">The Theory</a></li>
235-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
233+
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html">The Deutsch-Jozsa Algorithm</a><ul>
234+
<li class="toctree-l3"><a class="reference internal" href="deutsch_jozsa.html#The-Theory">The Theory</a></li>
235+
<li class="toctree-l3"><a class="reference internal" href="deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
236+
</ul>
237+
</li>
236238
<li class="toctree-l2"><a class="reference internal" href="hamiltonian_simulation.html">Spin-Hamiltonian Simulation Using CUDA-Q</a><ul>
237239
<li class="toctree-l3"><a class="reference internal" href="hamiltonian_simulation.html#Introduction">Introduction</a><ul>
238240
<li class="toctree-l4"><a class="reference internal" href="hamiltonian_simulation.html#Heisenberg-Hamiltonian">Heisenberg Hamiltonian</a></li>

pr-2590/applications/python/cost_minimization.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@
230230
<li class="toctree-l3"><a class="reference internal" href="deutschs_algorithm.html#Deutsch's-Algorithm:">Deutsch’s Algorithm:</a></li>
231231
</ul>
232232
</li>
233-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html"><em>The Deutsch-Jozsa Algorithm</em></a></li>
234-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html#The-Theory">The Theory</a></li>
235-
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
233+
<li class="toctree-l2"><a class="reference internal" href="deutsch_jozsa.html">The Deutsch-Jozsa Algorithm</a><ul>
234+
<li class="toctree-l3"><a class="reference internal" href="deutsch_jozsa.html#The-Theory">The Theory</a></li>
235+
<li class="toctree-l3"><a class="reference internal" href="deutsch_jozsa.html#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
236+
</ul>
237+
</li>
236238
<li class="toctree-l2"><a class="reference internal" href="hamiltonian_simulation.html">Spin-Hamiltonian Simulation Using CUDA-Q</a><ul>
237239
<li class="toctree-l3"><a class="reference internal" href="hamiltonian_simulation.html#Introduction">Introduction</a><ul>
238240
<li class="toctree-l4"><a class="reference internal" href="hamiltonian_simulation.html#Heisenberg-Hamiltonian">Heisenberg Hamiltonian</a></li>

pr-2590/applications/python/deutsch_jozsa.html

+10-8
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@
230230
<li class="toctree-l3"><a class="reference internal" href="deutschs_algorithm.html#Deutsch's-Algorithm:">Deutsch’s Algorithm:</a></li>
231231
</ul>
232232
</li>
233-
<li class="toctree-l2 current"><a class="current reference internal" href="#"><em>The Deutsch-Jozsa Algorithm</em></a></li>
234-
<li class="toctree-l2"><a class="reference internal" href="#The-Theory">The Theory</a></li>
235-
<li class="toctree-l2"><a class="reference internal" href="#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
233+
<li class="toctree-l2 current"><a class="current reference internal" href="#">The Deutsch-Jozsa Algorithm</a><ul>
234+
<li class="toctree-l3"><a class="reference internal" href="#The-Theory">The Theory</a></li>
235+
<li class="toctree-l3"><a class="reference internal" href="#The-Algorithm-Implementation">The Algorithm Implementation</a></li>
236+
</ul>
237+
</li>
236238
<li class="toctree-l2"><a class="reference internal" href="hamiltonian_simulation.html">Spin-Hamiltonian Simulation Using CUDA-Q</a><ul>
237239
<li class="toctree-l3"><a class="reference internal" href="hamiltonian_simulation.html#Introduction">Introduction</a><ul>
238240
<li class="toctree-l4"><a class="reference internal" href="hamiltonian_simulation.html#Heisenberg-Hamiltonian">Heisenberg Hamiltonian</a></li>
@@ -723,7 +725,7 @@
723725
<ul class="wy-breadcrumbs">
724726
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
725727
<li class="breadcrumb-item"><a href="../../using/applications.html">CUDA-Q Applications</a></li>
726-
<li class="breadcrumb-item active"><em>The Deutsch-Jozsa Algorithm</em></li>
728+
<li class="breadcrumb-item active">The Deutsch-Jozsa Algorithm</li>
727729
<li class="wy-breadcrumbs-aside">
728730
<a href="../../_sources/applications/python/deutsch_jozsa.ipynb.txt" rel="nofollow"> View page source</a>
729731
</li>
@@ -737,17 +739,16 @@
737739
<div itemprop="articleBody">
738740

739741
<section id="The-Deutsch-Jozsa-Algorithm">
740-
<h1><em>The Deutsch-Jozsa Algorithm</em><a class="headerlink" href="#The-Deutsch-Jozsa-Algorithm" title="Permalink to this heading"></a></h1>
742+
<h1>The Deutsch-Jozsa Algorithm<a class="headerlink" href="#The-Deutsch-Jozsa-Algorithm" title="Permalink to this heading"></a></h1>
741743
<p>Here is the link to the original paper: <a class="reference external" href="http://rspa.royalsocietypublishing.org/content/439/1907/553">Deutsch-Jozsa algorithm</a>. This algorithm is an earlier demonstration of the computational advantage of quantum algorithm over classical one. It addresses the problem of identifying the nature of a hidden Boolean function, which is provided as an oracle. The function is guaranteed to be either:</p>
742744
<ul class="simple">
743745
<li><p><strong>Balanced</strong>, meaning it outputs 0 for exactly half of its possible inputs and 1 for the other half.</p></li>
744746
<li><p><strong>Constant</strong>, meaning it outputs the same value (either 0 or 1) for all inputs.</p></li>
745747
</ul>
746748
<p>Classically, determining whether the function is balanced or constant requires evaluating the oracle multiple times. In the worst-case scenario, one would need to query at least half of the inputs to distinguish a constant function. However, the Deutsch-Jozsa algorithm demonstrates quantum superiority by solving this problem with a single query to the oracle, regardless of the input size.</p>
747749
<p>This notebook implements the Deutsch-Jozsa algorithm as described in <a class="reference external" href="https://arxiv.org/pdf/quant-ph/9708016.pdf">Cleve et al. 1997</a>. The input for the oracle function <span class="math notranslate nohighlight">\(f\)</span> is a <span class="math notranslate nohighlight">\(n\)</span>-bit string. It means that for <span class="math notranslate nohighlight">\(x\ in \{0,1\}^n\)</span>, the value of <span class="math notranslate nohighlight">\(f(x)\)</span> is either constant, i.e., the same for all <span class="math notranslate nohighlight">\(x\)</span>, or balanced, i.e., exactly half of the <span class="math notranslate nohighlight">\(n\)</span>-bit string whose <span class="math notranslate nohighlight">\(f(x) = 0\)</span>.</p>
748-
</section>
749750
<section id="The-Theory">
750-
<h1>The Theory<a class="headerlink" href="#The-Theory" title="Permalink to this heading"></a></h1>
751+
<h2>The Theory<a class="headerlink" href="#The-Theory" title="Permalink to this heading"></a></h2>
751752
<p>Here are the steps to implement the algorithm: 1. Start with initializing all input qubits and single auxiliary qubits to zero. The first <span class="math notranslate nohighlight">\(n-1\)</span> input qubits are used for querying the oracle, and the last auxiliary qubit is used for storing the answer of the oracle</p>
752753
<div class="math notranslate nohighlight">
753754
\[|0\ldots 0\rangle |0\rangle\]</div>
@@ -771,7 +772,7 @@ <h1>The Theory<a class="headerlink" href="#The-Theory" title="Permalink to this
771772
</ol>
772773
</section>
773774
<section id="The-Algorithm-Implementation">
774-
<h1>The Algorithm Implementation<a class="headerlink" href="#The-Algorithm-Implementation" title="Permalink to this heading"></a></h1>
775+
<h2>The Algorithm Implementation<a class="headerlink" href="#The-Algorithm-Implementation" title="Permalink to this heading"></a></h2>
775776
<p>Here is the CUDA-Q code following the steps outlined in the above theory section.</p>
776777
<div class="nbinput nblast docutils container">
777778
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[31]:
@@ -917,6 +918,7 @@ <h1>The Algorithm Implementation<a class="headerlink" href="#The-Algorithm-Imple
917918
</pre></div>
918919
</div>
919920
</div>
921+
</section>
920922
</section>
921923

922924

0 commit comments

Comments
 (0)