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
Copy file name to clipboardExpand all lines: pr-2590/_sources/applications/python/deutsch_jozsa.ipynb.txt
+1-1
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
"id": "7aa9cc8f-4e42-401f-a1fd-665e5cda19c7",
6
6
"metadata": {},
7
7
"source": [
8
-
"## _*The Deutsch-Jozsa Algorithm*_\n",
8
+
"#The Deutsch-Jozsa Algorithm\n",
9
9
"\n",
10
10
"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",
Copy file name to clipboardExpand all lines: pr-2590/_sources/using/backends/sims/tnsims.rst.txt
+3
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,9 @@ Specific aspects of the simulation can be configured by setting the following of
81
81
* **`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.
82
82
* **`OMP_PLACES=cores`**: Set this environment variable to improve CPU parallelization.
83
83
* **`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.
<h1><em>The Deutsch-Jozsa Algorithm</em><aclass="headerlink" href="#The-Deutsch-Jozsa-Algorithm" title="Permalink to this heading">¶</a></h1>
742
+
<h1>The Deutsch-Jozsa Algorithm<aclass="headerlink" href="#The-Deutsch-Jozsa-Algorithm" title="Permalink to this heading">¶</a></h1>
741
743
<p>Here is the link to the original paper: <aclass="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>
742
744
<ulclass="simple">
743
745
<li><p><strong>Balanced</strong>, meaning it outputs 0 for exactly half of its possible inputs and 1 for the other half.</p></li>
744
746
<li><p><strong>Constant</strong>, meaning it outputs the same value (either 0 or 1) for all inputs.</p></li>
745
747
</ul>
746
748
<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>
747
749
<p>This notebook implements the Deutsch-Jozsa algorithm as described in <aclass="reference external" href="https://arxiv.org/pdf/quant-ph/9708016.pdf">Cleve et al. 1997</a>. The input for the oracle function <spanclass="math notranslate nohighlight">\(f\)</span> is a <spanclass="math notranslate nohighlight">\(n\)</span>-bit string. It means that for <spanclass="math notranslate nohighlight">\(x\ in \{0,1\}^n\)</span>, the value of <spanclass="math notranslate nohighlight">\(f(x)\)</span> is either constant, i.e., the same for all <spanclass="math notranslate nohighlight">\(x\)</span>, or balanced, i.e., exactly half of the <spanclass="math notranslate nohighlight">\(n\)</span>-bit string whose <spanclass="math notranslate nohighlight">\(f(x) = 0\)</span>.</p>
748
-
</section>
749
750
<sectionid="The-Theory">
750
-
<h1>The Theory<aclass="headerlink" href="#The-Theory" title="Permalink to this heading">¶</a></h1>
751
+
<h2>The Theory<aclass="headerlink" href="#The-Theory" title="Permalink to this heading">¶</a></h2>
751
752
<p>Here are the steps to implement the algorithm: 1. Start with initializing all input qubits and single auxiliary qubits to zero. The first <spanclass="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>
752
753
<divclass="math notranslate nohighlight">
753
754
\[|0\ldots 0\rangle |0\rangle\]</div>
@@ -771,7 +772,7 @@ <h1>The Theory<a class="headerlink" href="#The-Theory" title="Permalink to this
771
772
</ol>
772
773
</section>
773
774
<sectionid="The-Algorithm-Implementation">
774
-
<h1>The Algorithm Implementation<aclass="headerlink" href="#The-Algorithm-Implementation" title="Permalink to this heading">¶</a></h1>
775
+
<h2>The Algorithm Implementation<aclass="headerlink" href="#The-Algorithm-Implementation" title="Permalink to this heading">¶</a></h2>
775
776
<p>Here is the CUDA-Q code following the steps outlined in the above theory section.</p>
0 commit comments