Skip to content

Commit

Permalink
Docs preview for PR #2193.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuda-quantum-bot committed Sep 10, 2024
1 parent b417b8b commit 5d4ff65
Show file tree
Hide file tree
Showing 93 changed files with 1,625 additions and 92 deletions.
83 changes: 83 additions & 0 deletions pr-2193/_sources/api/default_ops.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -633,3 +633,86 @@ operations, each operating on 2 qubits.

Custom operations are currently supported only on :doc:`../using/backends/simulators`.
Attempt to use with a hardware backend will result in runtime error.


Photonic Operations on Qudits
=============================

These operations are valid only on the `photonics` target which does not support the quantum operations above.

:code:`plus`
---------------------

This is a place-holder, to be updated later.

.. tab:: Python

.. code-block:: python
q = qudit(3)
plus(q)
.. tab:: C++

.. code-block:: cpp
cudaq::qvector<3> q(1);
plus(q[0]);
:code:`phase_shift`
---------------------

This is a place-holder, to be updated later.

.. tab:: Python

.. code-block:: python
q = qudit(4)
phase_shift(q, 0.17)
.. tab:: C++

.. code-block:: cpp
cudaq::qvector<4> q(1);
phase_shift(q[0], 0.17);
:code:`beam_splitter`
---------------------

This is a place-holder, to be updated later.

.. tab:: Python

.. code-block:: python
q = [qudit(3) for _ in range(2)]
beam_splitter(q[0], q[1], 0.34)
.. tab:: C++

.. code-block:: cpp
cudaq::qvector<3> q(2);
beam_splitter(q[0], q[1], 0.34);
:code:`mz`
---------------------

This operation returns the measurement results of the input qudit(s).

.. tab:: Python

.. code-block:: python
qutrits = [qudit(3) for _ in range(2)]
mz(qutrits)
.. tab:: C++

.. code-block:: cpp
cudaq::qvector<3> qutrits(2);
mz(qutrits);
6 changes: 6 additions & 0 deletions pr-2193/_sources/api/languages/cpp_api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,9 @@ Namespaces
.. doxygenfunction:: cudaq::mpi::all_reduce(const T &localValue, const BinaryFunction &function)
.. doxygenfunction:: cudaq::mpi::broadcast(std::vector<double> &data, int rootRank)
.. doxygenfunction:: cudaq::mpi::broadcast(std::string &data, int rootRank)

.. doxygennamespace:: cudaq::orca
:desc-only:

.. doxygenfunction:: cudaq::orca::sample(std::vector<std::size_t> &input_state, std::vector<std::size_t> &loop_lengths, std::vector<double> &bs_angles, int n_samples = 10000)
.. doxygenfunction:: cudaq::orca::sample(std::vector<std::size_t> &input_state, std::vector<std::size_t> &loop_lengths, std::vector<double> &bs_angles, std::vector<double> &ps_angles, int n_samples = 10000)
7 changes: 6 additions & 1 deletion pr-2193/_sources/api/languages/python_api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,9 @@ MPI Submodule
.. automethod:: cudaq.mpi::all_gather
.. automethod:: cudaq.mpi::broadcast
.. automethod:: cudaq.mpi::is_initialized
.. automethod:: cudaq.mpi::finalize
.. automethod:: cudaq.mpi::finalize

ORCA Submodule
=============================

.. automethod:: cudaq.orca::sample
1 change: 1 addition & 0 deletions pr-2193/_sources/using/backends/backends.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CUDA-Q Backends
* :ref:`qpp-cpu <qpp-cpu-backend>`
* :ref:`quantinuum <quantinuum-backend>`
* :ref:`remote-mqpu <mqpu-platform>`
* :ref:`stim <stim-backend>`
* :ref:`tensornet <tensor-backends>`
* :ref:`tensornet-mps <tensor-backends>`

Expand Down
34 changes: 34 additions & 0 deletions pr-2193/_sources/using/backends/simulators.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,40 @@ use the following commands:
./program.x
Clifford-Only Simulation (CPU)
++++++++++++++++++++++++++++++++++

.. _stim-backend:

This target provides a fast simulator for circuits containing *only* Clifford
gates. Any non-Clifford gates (such as T gates and Toffoli gates) are not
supported. This simulator is based on the `Stim <https://github.com/quantumlib/Stim>`_
library.

To execute a program on the :code:`stim` target, use the following commands:

.. tab:: Python

.. code:: bash
python3 program.py [...] --target stim
The target can also be defined in the application code by calling

.. code:: python
cudaq.set_target('stim')
If a target is set in the application code, this target will override the :code:`--target` command line flag given during program invocation.

.. tab:: C++

.. code:: bash
nvq++ --target stim program.cpp [...] -o program.x
./program.x
Tensor Network Simulators
==================================

Expand Down
12 changes: 12 additions & 0 deletions pr-2193/api/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
<li class="toctree-l4"><a class="reference internal" href="../using/backends/simulators.html#single-gpu">Single-GPU</a></li>
<li class="toctree-l4"><a class="reference internal" href="../using/backends/simulators.html#multi-node-multi-gpu">Multi-node multi-GPU</a></li>
<li class="toctree-l4"><a class="reference internal" href="../using/backends/simulators.html#openmp-cpu-only">OpenMP CPU-only</a></li>
<li class="toctree-l4"><a class="reference internal" href="../using/backends/simulators.html#clifford-only-simulation-cpu">Clifford-Only Simulation (CPU)</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../using/backends/simulators.html#tensor-network-simulators">Tensor Network Simulators</a><ul>
Expand Down Expand Up @@ -527,6 +528,10 @@
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.mpi.finalize"><code class="docutils literal notranslate"><span class="pre">finalize()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="languages/python_api.html#orca-submodule">ORCA Submodule</a><ul>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.orca.sample"><code class="docutils literal notranslate"><span class="pre">sample()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="default_ops.html">Quantum Operations</a><ul>
Expand All @@ -553,6 +558,13 @@
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="default_ops.html#user-defined-custom-operations">User-Defined Custom Operations</a></li>
<li class="toctree-l3"><a class="reference internal" href="default_ops.html#photonic-operations-on-qudits">Photonic Operations on Qudits</a><ul>
<li class="toctree-l4"><a class="reference internal" href="default_ops.html#plus"><code class="code docutils literal notranslate"><span class="pre">plus</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="default_ops.html#phase-shift"><code class="code docutils literal notranslate"><span class="pre">phase_shift</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="default_ops.html#beam-splitter"><code class="code docutils literal notranslate"><span class="pre">beam_splitter</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="default_ops.html#id1"><code class="code docutils literal notranslate"><span class="pre">mz</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
Expand Down
88 changes: 88 additions & 0 deletions pr-2193/api/default_ops.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
<li class="toctree-l4"><a class="reference internal" href="../using/backends/simulators.html#single-gpu">Single-GPU</a></li>
<li class="toctree-l4"><a class="reference internal" href="../using/backends/simulators.html#multi-node-multi-gpu">Multi-node multi-GPU</a></li>
<li class="toctree-l4"><a class="reference internal" href="../using/backends/simulators.html#openmp-cpu-only">OpenMP CPU-only</a></li>
<li class="toctree-l4"><a class="reference internal" href="../using/backends/simulators.html#clifford-only-simulation-cpu">Clifford-Only Simulation (CPU)</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../using/backends/simulators.html#tensor-network-simulators">Tensor Network Simulators</a><ul>
Expand Down Expand Up @@ -527,6 +528,10 @@
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.mpi.finalize"><code class="docutils literal notranslate"><span class="pre">finalize()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="languages/python_api.html#orca-submodule">ORCA Submodule</a><ul>
<li class="toctree-l4"><a class="reference internal" href="languages/python_api.html#cudaq.orca.sample"><code class="docutils literal notranslate"><span class="pre">sample()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Quantum Operations</a><ul>
Expand All @@ -553,6 +558,13 @@
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#user-defined-custom-operations">User-Defined Custom Operations</a></li>
<li class="toctree-l3"><a class="reference internal" href="#photonic-operations-on-qudits">Photonic Operations on Qudits</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#plus"><code class="code docutils literal notranslate"><span class="pre">plus</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#phase-shift"><code class="code docutils literal notranslate"><span class="pre">phase_shift</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#beam-splitter"><code class="code docutils literal notranslate"><span class="pre">beam_splitter</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#id1"><code class="code docutils literal notranslate"><span class="pre">mz</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -1242,6 +1254,82 @@ <h2>User-Defined Custom Operations<a class="headerlink" href="#user-defined-cust
Attempt to use with a hardware backend will result in runtime error.</p>
</div>
</section>
<section id="photonic-operations-on-qudits">
<h2>Photonic Operations on Qudits<a class="headerlink" href="#photonic-operations-on-qudits" title="Permalink to this heading"></a></h2>
<p>These operations are valid only on the <code class="code docutils literal notranslate"><span class="pre">photonics</span></code> target which does not support the quantum operations above.</p>
<section id="plus">
<h3><code class="code docutils literal notranslate"><span class="pre">plus</span></code><a class="headerlink" href="#plus" title="Permalink to this heading"></a></h3>
<p>This is a place-holder, to be updated later.</p>
<div class="tab-set docutils">
<input checked="True" class="tab-input" id="tab-set--19-input--1" name="tab-set--19" type="radio"><label class="tab-label" for="tab-set--19-input--1">Python</label><div class="tab-content docutils">
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">q</span> <span class="o">=</span> <span class="n">qudit</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="n">plus</span><span class="p">(</span><span class="n">q</span><span class="p">)</span>
</pre></div>
</div>
</div>
<input class="tab-input" id="tab-set--19-input--2" name="tab-set--19" type="radio"><label class="tab-label" for="tab-set--19-input--2">C++</label><div class="tab-content docutils">
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">cudaq</span><span class="o">::</span><span class="n">qvector</span><span class="o">&lt;</span><span class="mi">3</span><span class="o">&gt;</span><span class="w"> </span><span class="n">q</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
<span class="n">plus</span><span class="p">(</span><span class="n">q</span><span class="p">[</span><span class="mi">0</span><span class="p">]);</span>
</pre></div>
</div>
</div>
</div>
</section>
<section id="phase-shift">
<h3><code class="code docutils literal notranslate"><span class="pre">phase_shift</span></code><a class="headerlink" href="#phase-shift" title="Permalink to this heading"></a></h3>
<p>This is a place-holder, to be updated later.</p>
<div class="tab-set docutils">
<input checked="True" class="tab-input" id="tab-set--20-input--1" name="tab-set--20" type="radio"><label class="tab-label" for="tab-set--20-input--1">Python</label><div class="tab-content docutils">
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">q</span> <span class="o">=</span> <span class="n">qudit</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="n">phase_shift</span><span class="p">(</span><span class="n">q</span><span class="p">,</span> <span class="mf">0.17</span><span class="p">)</span>
</pre></div>
</div>
</div>
<input class="tab-input" id="tab-set--20-input--2" name="tab-set--20" type="radio"><label class="tab-label" for="tab-set--20-input--2">C++</label><div class="tab-content docutils">
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">cudaq</span><span class="o">::</span><span class="n">qvector</span><span class="o">&lt;</span><span class="mi">4</span><span class="o">&gt;</span><span class="w"> </span><span class="n">q</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
<span class="n">phase_shift</span><span class="p">(</span><span class="n">q</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="w"> </span><span class="mf">0.17</span><span class="p">);</span>
</pre></div>
</div>
</div>
</div>
</section>
<section id="beam-splitter">
<h3><code class="code docutils literal notranslate"><span class="pre">beam_splitter</span></code><a class="headerlink" href="#beam-splitter" title="Permalink to this heading"></a></h3>
<p>This is a place-holder, to be updated later.</p>
<div class="tab-set docutils">
<input checked="True" class="tab-input" id="tab-set--21-input--1" name="tab-set--21" type="radio"><label class="tab-label" for="tab-set--21-input--1">Python</label><div class="tab-content docutils">
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">q</span> <span class="o">=</span> <span class="p">[</span><span class="n">qudit</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">)]</span>
<span class="n">beam_splitter</span><span class="p">(</span><span class="n">q</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">q</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="mf">0.34</span><span class="p">)</span>
</pre></div>
</div>
</div>
<input class="tab-input" id="tab-set--21-input--2" name="tab-set--21" type="radio"><label class="tab-label" for="tab-set--21-input--2">C++</label><div class="tab-content docutils">
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">cudaq</span><span class="o">::</span><span class="n">qvector</span><span class="o">&lt;</span><span class="mi">3</span><span class="o">&gt;</span><span class="w"> </span><span class="n">q</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>
<span class="n">beam_splitter</span><span class="p">(</span><span class="n">q</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="w"> </span><span class="n">q</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="w"> </span><span class="mf">0.34</span><span class="p">);</span>
</pre></div>
</div>
</div>
</div>
</section>
<section id="id1">
<h3><code class="code docutils literal notranslate"><span class="pre">mz</span></code><a class="headerlink" href="#id1" title="Permalink to this heading"></a></h3>
<p>This operation returns the measurement results of the input qudit(s).</p>
<div class="tab-set docutils">
<input checked="True" class="tab-input" id="tab-set--22-input--1" name="tab-set--22" type="radio"><label class="tab-label" for="tab-set--22-input--1">Python</label><div class="tab-content docutils">
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">qutrits</span> <span class="o">=</span> <span class="p">[</span><span class="n">qudit</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">)]</span>
<span class="n">mz</span><span class="p">(</span><span class="n">qutrits</span><span class="p">)</span>
</pre></div>
</div>
</div>
<input class="tab-input" id="tab-set--22-input--2" name="tab-set--22" type="radio"><label class="tab-label" for="tab-set--22-input--2">C++</label><div class="tab-content docutils">
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">cudaq</span><span class="o">::</span><span class="n">qvector</span><span class="o">&lt;</span><span class="mi">3</span><span class="o">&gt;</span><span class="w"> </span><span class="n">qutrits</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>
<span class="n">mz</span><span class="p">(</span><span class="n">qutrits</span><span class="p">);</span>
</pre></div>
</div>
</div>
</div>
</section>
</section>
</section>


Expand Down
Loading

0 comments on commit 5d4ff65

Please sign in to comment.