Skip to content

Commit

Permalink
Docs preview for PR #581.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuda-quantum-bot committed Sep 12, 2023
1 parent cf99e30 commit 2315c49
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pr-581/api/languages/cpp_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -2787,7 +2787,7 @@ <h2>Namespaces<a class="headerlink" href="#namespaces" title="Permalink to this
<dl class="cpp function">
<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. </p>
<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
2 changes: 1 addition & 1 deletion pr-581/searchindex.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pr-581/sphinx/examples/cpp/basics/noise_modeling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ int main() {
// Run the noisy simulation
counts = cudaq::sample(xgate);
counts.dump();

// Unset the noise model when done. This is not necessary in this case but is
// good practice in order to not interfere with future simulations.
cudaq::unset_noise();
}
5 changes: 4 additions & 1 deletion pr-581/sphinx/using/advanced/_noise.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ 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(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 2315c49

Please sign in to comment.