Skip to content

Commit

Permalink
Docs preview for PR #2487.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuda-quantum-bot committed Dec 31, 2024
1 parent 60eabfe commit cdc0eeb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pr-2487/api/languages/python_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,7 @@ <h2>Data Types<a class="headerlink" href="#data-types" title="Permalink to this
they provide methods to convert them to data types that can.</p>
<dl class="py method">
<dt class="sig sig-object py" id="cudaq.operator.expressions.ElementaryOperator.define">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">define</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">op_id</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/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">expected_dimensions</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/typing.html#typing.Sequence" title="(in Python v3.13)"><span class="pre">Sequence</span></a><span class="p"><span class="pre">[</span></span><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 class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">create</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/typing.html#typing.Callable" title="(in Python v3.13)"><span class="pre">Callable</span></a><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">...</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.2)"><span class="pre">ndarray</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.13)"><span class="pre">Any</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype" title="(in NumPy v2.2)"><span class="pre">dtype</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.complexfloating" title="(in NumPy v2.2)"><span class="pre">complexfloating</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></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 external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span></span><a class="headerlink" href="#cudaq.operator.expressions.ElementaryOperator.define" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">define</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">op_id</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/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">expected_dimensions</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/typing.html#typing.Sequence" title="(in Python v3.13)"><span class="pre">Sequence</span></a><span class="p"><span class="pre">[</span></span><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 class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">create</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/typing.html#typing.Callable" title="(in Python v3.13)"><span class="pre">Callable</span></a><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">...</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.2)"><span class="pre">ndarray</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.13)"><span class="pre">Any</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype" title="(in NumPy v2.2)"><span class="pre">dtype</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.complexfloating" title="(in NumPy v2.2)"><span class="pre">complexfloating</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">override</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#bool" title="(in Python v3.13)"><span class="pre">bool</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">False</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 external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span></span><a class="headerlink" href="#cudaq.operator.expressions.ElementaryOperator.define" title="Permalink to this definition"></a></dt>
<dd><p>Adds the definition of an elementary operator with the given id to the class.
After definition, an the defined elementary operator can be instantiated by
providing the operator id as well as the degree(s) of freedom that it acts on.</p>
Expand Down Expand Up @@ -2214,6 +2214,7 @@ <h2>Data Types<a class="headerlink" href="#data-types" title="Permalink to this
for short), if the operator acts on a single degree of freedom, and an
argument called <code class="code docutils literal notranslate"><span class="pre">dimensions</span></code> (or <code class="code docutils literal notranslate"><span class="pre">dims</span></code> for short), if the operator acts
on multiple degrees of freedom.</p></li>
<li><p><strong>override</strong> – if True it allows override the definition. (default: False)</p></li>
</ul>
</dd>
</dl>
Expand Down
4 changes: 2 additions & 2 deletions pr-2487/applications/python/deutschs_algorithm.html
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ <h2>XOR <span class="math notranslate nohighlight">\(\oplus\)</span><a class="he
</section>
<section id="Quantum-oracles">
<h2>Quantum oracles<a class="headerlink" href="#Quantum-oracles" title="Permalink to this heading"></a></h2>
<p><img alt="3673c8b08cf345beb2aa6b14413b212a" class="no-scaled-link" src="../../_images/oracle.png" style="width: 300px; height: 150px;" /></p>
<p><img alt="65266d5669644cd0b082dd0bb9172f2e" class="no-scaled-link" src="../../_images/oracle.png" style="width: 300px; height: 150px;" /></p>
<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>
<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>
<div class="math notranslate nohighlight">
Expand Down Expand Up @@ -851,7 +851,7 @@ <h2>Quantum parallelism<a class="headerlink" href="#Quantum-parallelism" title="
<h2>Deutsch’s Algorithm:<a class="headerlink" href="#Deutsch's-Algorithm:" title="Permalink to this heading"></a></h2>
<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>
<p>We step through the circuit diagram below and follow the math after the application of each gate.</p>
<p><img alt="ee997ff7637f4630985a90dd375a1267" class="no-scaled-link" src="../../_images/deutsch.png" style="width: 500px; height: 210px;" /></p>
<p><img alt="24f258d327e44dd4a2f5bed5b2257a31" class="no-scaled-link" src="../../_images/deutsch.png" style="width: 500px; height: 210px;" /></p>
<div class="math notranslate nohighlight">
\[\ket{\psi_0} = \ket{01}
\tag{1}\]</div>
Expand Down
4 changes: 2 additions & 2 deletions pr-2487/examples/python/performance_optimizations.html
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,9 @@ <h1>Optimizing Performance<a class="headerlink" href="#Optimizing-Performance" t
<section id="Gate-Fusion">
<h2>Gate Fusion<a class="headerlink" href="#Gate-Fusion" title="Permalink to this heading"></a></h2>
<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 <code class="docutils literal notranslate"><span class="pre">nvidia-mgpu</span></code> backend and setting the <code class="docutils literal notranslate"><span class="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 <code class="docutils literal notranslate"><span class="pre">CUDAQ_MGPU_FUSE=4</span> <span class="pre">python</span> <span class="pre">c2h2VQE.py</span> <span class="pre">--target</span> <span class="pre">nvidia</span> <span class="pre">--target-option</span> <span class="pre">fp64,mgpu</span></code></p>
<p><img alt="f879adeb5f874b14a5335a29601019fc" src="../../_images/gate-fuse1.png" /></p>
<p><img alt="0f8b4bfb00914b9c97e99ed0afb8a1e4" src="../../_images/gate-fuse1.png" /></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>
<p><img alt="5bc0a2707fd34d20b6bf6377604a7cb5" src="../../_images/gatefusion.png" /></p>
<p><img alt="825a3ea5efa94390a2638969ec2454aa" src="../../_images/gatefusion.png" /></p>
</section>
</section>

Expand Down
2 changes: 1 addition & 1 deletion pr-2487/searchindex.js

Large diffs are not rendered by default.

0 comments on commit cdc0eeb

Please sign in to comment.