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 9, 2023
1 parent e74ac4e commit 5ae6ebd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pr-635/searchindex.js

Large diffs are not rendered by default.

8 changes: 6 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,14 +39,18 @@ int main() {
{-0.05773502691896258, 0.0}});

// Create the noise model
cudaq::noise_model noise;
auto noise = std::make_shared<cudaq::noise_model>();
// 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);

// 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();
}
2 changes: 1 addition & 1 deletion pr-635/sphinx/using/advanced/_noise.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ 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(cudaq::noise_model&)` function. This function
execution via a public :code:`cudaq::set_noise(std::shared_ptr<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.

Expand Down

0 comments on commit 5ae6ebd

Please sign in to comment.