Skip to content

Commit

Permalink
Docs preview for PR #827.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuda-quantum-bot committed Nov 2, 2023
1 parent a6f45da commit 985611a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pr-827/api/languages/python_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -3386,7 +3386,7 @@ <h2>Data Types<a class="headerlink" href="#data-types" title="Permalink to this
<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.SpinOperator.random" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py function">
<dt class="sig sig-object py">
<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.12)"><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.12)"><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.12)"><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">3166277130</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.SpinOperator" title="cudaq.SpinOperator"><span class="pre">cudaq.SpinOperator</span></a></span></span></dt>
<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.12)"><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.12)"><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.12)"><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">1612926682</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.SpinOperator" title="cudaq.SpinOperator"><span class="pre">cudaq.SpinOperator</span></a></span></span></dt>
<dd></dd></dl>

<p>Return a random <a class="reference internal" href="#cudaq.SpinOperator" title="cudaq.SpinOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">SpinOperator</span></code></a> on the given number of qubits (<code class="code docutils literal notranslate"><span class="pre">qubit_count</span></code>) and composed of the given number of terms (<code class="code docutils literal notranslate"><span class="pre">term_count</span></code>). An optional seed value may also be provided.</p>
Expand Down
2 changes: 1 addition & 1 deletion pr-827/searchindex.js

Large diffs are not rendered by default.

24 changes: 15 additions & 9 deletions pr-827/sphinx/examples/cpp/providers/iqm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,22 @@ struct adonis_ghz {
// |
// QB5

auto operator()() __qpu__ {
void operator()() __qpu__ {
cudaq::qreg q(5);
h(q[2]); // QB3

x<cudaq::ctrl>(q[2], q[0]);
x<cudaq::ctrl>(q[2], q[1]);
x<cudaq::ctrl>(q[2], q[3]);
x<cudaq::ctrl>(q[2], q[4]);

mz(q);
h(q[0]);

// Note that the CUDA Quantum compiler will automatically generate the
// necessary instructions to swap qubits to satisfy the required
// connectivity constraints for the Adonis QPU. In this program, that means
// that despite QB1 not being physically connected to QB2, the user can
// still perform joint operations q[0] and q[1] because the compiler will
// automatically (and transparently) inject the necessary swap instructions
// to execute the user's program without the user having to worry about the
// physical constraints.
for (int i = 0; i < 4; i++) {
x<cudaq::ctrl>(q[i], q[i + 1]);
}
auto result = mz(q);
}
};

Expand Down

0 comments on commit 985611a

Please sign in to comment.