Skip to content

Commit

Permalink
Docs preview for PR #635.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuda-quantum-bot committed Sep 12, 2023
1 parent f04c7bd commit 7394e6c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
12 changes: 6 additions & 6 deletions pr-635/api/languages/cpp_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ <h2>Common<a class="headerlink" href="#common" title="Permalink to this heading"

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq16ExecutionContext10noiseModelE">
<span id="_CPPv3N5cudaq16ExecutionContext10noiseModelE"></span><span id="_CPPv2N5cudaq16ExecutionContext10noiseModelE"></span><span id="cudaq::ExecutionContext::noiseModel__std::shared_ptr:cudaq::noise_model:"></span><span class="target" id="classcudaq_1_1ExecutionContext_1a6f2c2fcbd2cede13c62ab05368533200"></span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">shared_ptr</span></span><span class="p"><span class="pre">&lt;</span></span><a class="reference internal" href="#_CPPv45cudaq" title="cudaq"><span class="n"><span class="pre">cudaq</span></span></a><span class="p"><span class="pre">::</span></span><a class="reference internal" href="#_CPPv4N5cudaq11noise_modelE" title="cudaq::noise_model"><span class="n"><span class="pre">noise_model</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">noiseModel</span></span></span><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="k"><span class="pre">nullptr</span></span><a class="headerlink" href="#_CPPv4N5cudaq16ExecutionContext10noiseModelE" title="Permalink to this definition">¶</a><br /></dt>
<span id="_CPPv3N5cudaq16ExecutionContext10noiseModelE"></span><span id="_CPPv2N5cudaq16ExecutionContext10noiseModelE"></span><span id="cudaq::ExecutionContext::noiseModel__noise_modelP"></span><span class="target" id="classcudaq_1_1ExecutionContext_1acb427b54a160c458325a0daf46fe7691"></span><a class="reference internal" href="#_CPPv4N5cudaq11noise_modelE" title="cudaq::noise_model"><span class="n"><span class="pre">noise_model</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">noiseModel</span></span></span><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="k"><span class="pre">nullptr</span></span><a class="headerlink" href="#_CPPv4N5cudaq16ExecutionContext10noiseModelE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Noise model to apply to the current execution. </p>
</dd></dl>

Expand Down Expand Up @@ -2690,8 +2690,8 @@ <h2>Platform<a class="headerlink" href="#platform" title="Permalink to this head
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq16quantum_platform9set_noiseENSt10shared_ptrI11noise_modelEE">
<span id="_CPPv3N5cudaq16quantum_platform9set_noiseENSt10shared_ptrI11noise_modelEE"></span><span id="_CPPv2N5cudaq16quantum_platform9set_noiseENSt10shared_ptrI11noise_modelEE"></span><span id="cudaq::quantum_platform::set_noise__std::shared_ptr:noise_model:"></span><span class="target" id="classcudaq_1_1quantum__platform_1ab15407f7fcee764879e3939e2022e802"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">set_noise</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">shared_ptr</span></span><span class="p"><span class="pre">&lt;</span></span><a class="reference internal" href="#_CPPv4N5cudaq11noise_modelE" title="cudaq::noise_model"><span class="n"><span class="pre">noise_model</span></span></a><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">model</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5cudaq16quantum_platform9set_noiseENSt10shared_ptrI11noise_modelEE" title="Permalink to this definition">¶</a><br /></dt>
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq16quantum_platform9set_noiseEP11noise_model">
<span id="_CPPv3N5cudaq16quantum_platform9set_noiseEP11noise_model"></span><span id="_CPPv2N5cudaq16quantum_platform9set_noiseEP11noise_model"></span><span id="cudaq::quantum_platform::set_noise__noise_modelP"></span><span class="target" id="classcudaq_1_1quantum__platform_1adadaf2ff7337905136c7f1860c64761f"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">set_noise</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="#_CPPv4N5cudaq11noise_modelE" title="cudaq::noise_model"><span class="n"><span class="pre">noise_model</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">model</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5cudaq16quantum_platform9set_noiseEP11noise_model" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Set the noise model for future invocations of quantum kernels. </p>
</dd></dl>

Expand Down Expand Up @@ -2780,9 +2780,9 @@ <h2>Namespaces<a class="headerlink" href="#namespaces" title="Permalink to this
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq9set_noiseENSt10shared_ptrIN5cudaq11noise_modelEEE">
<span id="_CPPv3N5cudaq9set_noiseENSt10shared_ptrIN5cudaq11noise_modelEEE"></span><span id="_CPPv2N5cudaq9set_noiseENSt10shared_ptrIN5cudaq11noise_modelEEE"></span><span id="cudaq::set_noise__std::shared_ptr:cudaq::noise_model:"></span><span class="target" id="cudaq_8h_1a5ebdd7e2964ea49e31b92d9ff88a45e6"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-prename descclassname"><a class="reference internal" href="#_CPPv45cudaq" title="cudaq"><span class="n"><span class="pre">cudaq</span></span></a><span class="p"><span class="pre">::</span></span></span><span class="sig-name descname"><span class="n"><span class="pre">set_noise</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">shared_ptr</span></span><span class="p"><span class="pre">&lt;</span></span><a class="reference internal" href="#_CPPv45cudaq" title="cudaq"><span class="n"><span class="pre">cudaq</span></span></a><span class="p"><span class="pre">::</span></span><a class="reference internal" href="#_CPPv4N5cudaq11noise_modelE" title="cudaq::noise_model"><span class="n"><span class="pre">noise_model</span></span></a><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">model</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5cudaq9set_noiseENSt10shared_ptrIN5cudaq11noise_modelEEE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Set a custom noise model for simulation. </p>
<dt class="sig sig-object cpp" id="_CPPv4N5cudaq9set_noiseERN5cudaq11noise_modelE">
<span id="_CPPv3N5cudaq9set_noiseERN5cudaq11noise_modelE"></span><span id="_CPPv2N5cudaq9set_noiseERN5cudaq11noise_modelE"></span><span id="cudaq::set_noise__cudaq::noise_modelR"></span><span class="target" id="cudaq_8h_1a29a2fd140ac6b2296a73c2dbdbc2c08a"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-prename descclassname"><a class="reference internal" href="#_CPPv45cudaq" title="cudaq"><span class="n"><span class="pre">cudaq</span></span></a><span class="p"><span class="pre">::</span></span></span><span class="sig-name descname"><span class="n"><span class="pre">set_noise</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="#_CPPv45cudaq" title="cudaq"><span class="n"><span class="pre">cudaq</span></span></a><span class="p"><span class="pre">::</span></span><a class="reference internal" href="#_CPPv4N5cudaq11noise_modelE" title="cudaq::noise_model"><span class="n"><span class="pre">noise_model</span></span></a><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">model</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5cudaq9set_noiseERN5cudaq11noise_modelE" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Set a custom noise model for simulation. The caller must also call <code class="docutils literal notranslate"><span class="pre">cudaq::unset_noise</span></code> before <code class="docutils literal notranslate"><span class="pre">model</span></code> gets deallocated or goes out of scope. </p>
</dd></dl>

<dl class="cpp function">
Expand Down
4 changes: 2 additions & 2 deletions pr-635/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ <h2 id="C">C</h2>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq16quantum_platform12set_exec_ctxEPN5cudaq16ExecutionContextENSt6size_tE">cudaq::quantum_platform::set_exec_ctx (C++ function)</a>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq16quantum_platform9set_noiseENSt10shared_ptrI11noise_modelEE">cudaq::quantum_platform::set_noise (C++ function)</a>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq16quantum_platform9set_noiseEP11noise_model">cudaq::quantum_platform::set_noise (C++ function)</a>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq16quantum_platform9set_shotsEi">cudaq::quantum_platform::set_shots (C++ function)</a>
</li>
Expand Down Expand Up @@ -967,7 +967,7 @@ <h2 id="C">C</h2>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq13sample_resultD0Ev">cudaq::sample_result::~sample_result (C++ function)</a>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq9set_noiseENSt10shared_ptrIN5cudaq11noise_modelEEE">cudaq::set_noise (C++ function)</a>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq9set_noiseERN5cudaq11noise_modelE">cudaq::set_noise (C++ function)</a>
</li>
<li><a href="api/languages/cpp_api.html#_CPPv4N5cudaq15set_random_seedENSt6size_tE">cudaq::set_random_seed (C++ function)</a>
</li>
Expand Down
Binary file modified pr-635/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion pr-635/searchindex.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pr-635/sphinx/examples/cpp/basics/noise_modeling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ int main() {
{-0.05773502691896258, 0.0}});

// Create the noise model
auto noise = std::make_shared<cudaq::noise_model>();
cudaq::noise_model noise;
// Add the Kraus channel to the x operation on qubit 0.
noise->add_channel<cudaq::types::x>({0}, depol);
noise.add_channel<cudaq::types::x>({0}, depol);

// Set the noise model
cudaq::set_noise(noise);
Expand Down
7 changes: 5 additions & 2 deletions pr-635/sphinx/using/advanced/_noise.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ template type is the quantum operation the channel applies to (e.g. :code:`model
apply to the simulated state via a :code:`noise_model::get_channel(...)` call.

Noise models can be constructed via the :code:`cudaq::noise_model` and specified for
execution via a public :code:`cudaq::set_noise(std::shared_ptr<cudaq::noise_model>)` function. This function
execution via a public :code:`cudaq::set_noise(cudaq::noise_model&)` function. This function
should forward the :code:`noise_model` to the current :code:`quantum_platform` which can attach it
to the current :code:`ExecutionContext` and retrieved by backend simulators.
to the current :code:`ExecutionContext` and retrieved by backend simulators. The
:code:`noise_model` must stay in scope in order to be successfully used by the
backend simulators, and you must call :code:`cudaq::unset_noise()` when you are
done with the noise model.

The :code:`kraus_op` matrix data assumes a LSB qubit ordering.

Expand Down

0 comments on commit 7394e6c

Please sign in to comment.