Skip to content

Commit

Permalink
Fix another example/test
Browse files Browse the repository at this point in the history
  • Loading branch information
1tnguyen committed Jun 17, 2024
1 parent 61ab3aa commit 9273474
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/sphinx/examples/python/noise_kraus_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def kraus_operators(probability):
"""See Nielsen, Chuang Chapter 8.3.5 for definition source."""
kraus_0 = np.array([[1, 0], [0, np.sqrt(1 - probability)]],
dtype=np.complex128)
kraus_1 = np.array([[0, 0], [np.sqrt(probability), 0]], dtype=np.complex128)
kraus_1 = np.array([[0, np.sqrt(probability)], [0, 0]], dtype=np.complex128)
return [kraus_0, kraus_1]


Expand Down
9 changes: 4 additions & 5 deletions unittests/integration/noise_tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ CUDAQ_TEST(NoiseTest, checkSimple) {
CUDAQ_TEST(NoiseTest, checkAmplitudeDamping) {
cudaq::set_random_seed(13);
cudaq::kraus_channel amplitudeDamping{{1., 0., 0., .8660254037844386},
{0., 0.0, 0.5, 0.}};
{0., 0.5, 0.0, 0.}};
cudaq::noise_model noise;
noise.add_channel<cudaq::types::x>({0}, amplitudeDamping);
cudaq::set_noise(noise);
Expand Down Expand Up @@ -163,11 +163,10 @@ CUDAQ_TEST(NoiseTest, checkCNOT) {
CUDAQ_TEST(NoiseTest, checkExceptions) {
cudaq::set_random_seed(13);
cudaq::kraus_channel amplitudeDamping{{1., 0., 0., .8660254037844386},
{0., 0.0, 0.5, 0.}};
{0., 0.5, 0.0, 0.}};
cudaq::noise_model noise;
EXPECT_ANY_THROW({
noise.add_channel<cudaq::types::x>({0, 1}, amplitudeDamping);
});
EXPECT_ANY_THROW(
{ noise.add_channel<cudaq::types::x>({0, 1}, amplitudeDamping); });
}

CUDAQ_TEST(NoiseTest, checkDepolType) {
Expand Down

0 comments on commit 9273474

Please sign in to comment.