Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/stim/simulators/error_analyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,6 @@ void ErrorAnalyzer::undo_DEPOLARIZE1(const CircuitInstruction &inst) {
if (!accumulate_errors) {
return;
}
if (inst.args[0] > 0.75) {
throw std::invalid_argument("Can't analyze over-mixing DEPOLARIZE1 errors (probability > 3/4).");
}
double p = depolarize1_probability_to_independent_per_channel_probability(inst.args[0]);
for (auto q : inst.targets) {
add_error_combinations<2>(
Expand All @@ -836,9 +833,6 @@ void ErrorAnalyzer::undo_DEPOLARIZE2(const CircuitInstruction &inst) {
if (!accumulate_errors) {
return;
}
if (inst.args[0] > 15.0 / 16.0) {
throw std::invalid_argument("Can't analyze over-mixing DEPOLARIZE2 errors (probability > 15/16).");
}
double p = depolarize2_probability_to_independent_per_channel_probability(inst.args[0]);
for (size_t i = 0; i < inst.targets.size(); i += 2) {
auto a = inst.targets[i];
Expand Down
26 changes: 26 additions & 0 deletions src/stim/util_bot/error_decomp.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,29 @@ TEST(conversions, independent_vs_disjoint_xyz_errors_round_trip_fuzz) {
ASSERT_NEAR(z, z3, 1e-6) << "x=" << x << ",y=" << y << ",z=" << z;
}
}

TEST(conversions, depolarize1_probability_to_independent_per_channel_probability_throws_invalid_argument_if_p_greater_than_0_75) {
const double invalid_p = 0.76;
const std::string expected_error_message = "depolarize1_probability_to_independent_per_channel_probability with p>0.75; p=" + std::to_string(invalid_p);
EXPECT_THROW({
try {
depolarize1_probability_to_independent_per_channel_probability(invalid_p);
} catch (const std::invalid_argument& e) {
EXPECT_EQ(expected_error_message, e.what());
throw;
}
}, std::invalid_argument);
}

TEST(conversions, depolarize2_probability_to_independent_per_channel_probability_throws_invalid_argument_if_p_greater_than_0_9375) {
const double invalid_p = 0.9475;
const std::string expected_error_message = "depolarize2_probability_to_independent_per_channel_probability with p>15.0/16.0; p=" + std::to_string(invalid_p);
EXPECT_THROW({
try {
depolarize2_probability_to_independent_per_channel_probability(invalid_p);
} catch (const std::invalid_argument& e) {
EXPECT_EQ(expected_error_message, e.what());
throw;
}
}, std::invalid_argument);
}