Skip to content

Commit

Permalink
Disable save expectation value for ext stabilizer (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseclectic authored Apr 28, 2021
1 parent a56f929 commit d62350a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
3 changes: 1 addition & 2 deletions qiskit/providers/aer/backends/aer_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ class AerSimulator(AerBackend):
'set_stabilizer'
]),
'extended_stabilizer': sorted([
'roerror', 'snapshot', 'save_statevector',
'save_expval', 'save_expval_var'
'roerror', 'snapshot', 'save_statevector'
]),
'unitary': sorted([
'snapshot', 'save_state', 'save_unitary', 'set_unitary'
Expand Down
3 changes: 1 addition & 2 deletions qiskit/providers/aer/backends/qasm_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,7 @@ def _custom_instructions(self):
'set_stabilizer'
])
if method == 'extended_stabilizer':
return sorted(['roerror', 'snapshot', 'save_statevector',
'save_expval', 'save_expval_var'])
return sorted(['roerror', 'snapshot', 'save_statevector'])
return QasmSimulator._DEFAULT_CUSTOM_INSTR

def _set_method_config(self, method=None):
Expand Down
4 changes: 2 additions & 2 deletions qiskit/providers/aer/library/instructions_table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
:class:`SaveAmplitudes`,✔,✔,✘,✔,✘,✘,✘,✘
:class:`SaveAmplitudesSquared`,✔,✔,✔,✔,✔,✘,✘,✘
:class:`SaveDensityMatrix`,✔,✔,✔,✔,✘,✘,✘,✘
:class:`SaveExpectationValue`,✔,✔,✔,✔,✔,,✘,✘
:class:`SaveExpectationValueVariance`,✔,✔,✔,✔,✔,,✘,✘
:class:`SaveExpectationValue`,✔,✔,✔,✔,✔,,✘,✘
:class:`SaveExpectationValueVariance`,✔,✔,✔,✔,✔,,✘,✘
:class:`SaveMatrixProductState`,✘,✘,✘,✔,✘,✘,✘,✘
:class:`SaveProbabilities`,✔,✔,✔,✔,✔,✘,✘,✘
:class:`SaveProbabilitiesDict`,✔,✔,✔,✔,✔,✘,✘,✘
Expand Down
11 changes: 11 additions & 0 deletions releasenotes/notes/ext-stab-expval-b205dcf3a26707d4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
issues:
- |
The :class:`~qiskit.providers.aer.library.SaveExpectationValue` and
:class:`~qiskit.providers.aer.library.SaveExpectationValueVariance` have
been disabled for the `extended_stabilizer` method of the
:class:`~qiskit.providers.aer.QasmSimulator` and
:class:`~qiskit.providers.aer.AerSimulator` due to returning the
incorrect value for certain Pauli operator components. Refer to
`#1227 <https://github.com/Qiskit/qiskit-aer/issues/1227>` for more
information and examples.
11 changes: 6 additions & 5 deletions src/simulators/extended_stabilizer/extended_stabilizer_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Operations::OpSet StateOpSet(
Operations::OpType::reset, Operations::OpType::barrier,
Operations::OpType::roerror, Operations::OpType::bfunc,
Operations::OpType::snapshot, Operations::OpType::save_statevec,
Operations::OpType::save_expval, Operations::OpType::save_expval_var},
}, //Operations::OpType::save_expval, Operations::OpType::save_expval_var},
// Gates
{"CX", "u0", "u1", "p", "cx", "cz", "swap", "id", "x", "y", "z", "h",
"s", "sdg", "t", "tdg", "ccx", "ccz", "delay"},
Expand Down Expand Up @@ -431,10 +431,11 @@ void State::apply_ops(const std::vector<Operations::Op> &ops, ExperimentResult &
case Operations::OpType::save_statevec:
apply_save_statevector(op, result);
break;
case Operations::OpType::save_expval:
case Operations::OpType::save_expval_var:
apply_save_expval(op, result, rng);
break;
// Disabled until can fix bug in expval
// case Operations::OpType::save_expval:
// case Operations::OpType::save_expval_var:
// apply_save_expval(op, result, rng);
// break;
default:
throw std::invalid_argument("CH::State::apply_ops does not support operations of the type \'" +
op.name + "\'.");
Expand Down

0 comments on commit d62350a

Please sign in to comment.