Skip to content

Commit

Permalink
Merge branch 'main' into fix_deploy_centos
Browse files Browse the repository at this point in the history
  • Loading branch information
doichanj authored Sep 13, 2024
2 parents 31c600d + 5ae3725 commit b2374cb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
fixes:
- |
SIGSEGV raised when the circuits with unsupported gates is
passed to MPS simulator, because of `std::set.find()` in
size estimator for MPS.
This fix avoids SIGSEGV if unsupported gates is passed.
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,19 @@ uint_t MPSSizeEstimator::estimate(const std::vector<Operations::Op> &ops,
case Operations::OpType::gate:
if (ops[i].qubits.size() > 1) {
auto it = gateset.find(ops[i].name);
switch (it->second) {
case Gates::rxx:
case Gates::ryy:
case Gates::rzx:
pi2 = std::real(ops[i].params[0]) / M_PI;
pi2_int = (double)std::round(pi2);
if (!AER::Linalg::almost_equal(pi2, pi2_int))
apply_qubits(ops[i].qubits);
break;
default:
break;
if (it != gateset.end()) {
switch (it->second) {
case Gates::rxx:
case Gates::ryy:
case Gates::rzx:
pi2 = std::real(ops[i].params[0]) / M_PI;
pi2_int = (double)std::round(pi2);
if (!AER::Linalg::almost_equal(pi2, pi2_int))
apply_qubits(ops[i].qubits);
break;
default:
break;
}
}
}
break;
Expand Down

0 comments on commit b2374cb

Please sign in to comment.