Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AerState::probability does not work as expected with the stabilizer simulator #2258

Open
aromanro opened this issue Nov 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@aromanro
Copy link
Contributor

Informations

  • Qiskit Aer version: Latest development version
  • Python version: Irrelevant, as it's called from C++
  • Operating system: Windows, linux, macos

What is the current behavior?

Calling AerState::probability throws an exception with the message "Save amplitude square must be defined on full width of qubits."
The exception comes from here:

if (num_qubits != BaseState::qreg_.num_qubits()) {

Steps to reproduce the problem

Configure a stabilizer simulator then call 'probability' for an outcome.

What is the expected behavior?

Return the probability.

Suggested solutions

Modify AerState::probability to add the list of qubits, that is, insert

  for (uint_t i = 0; i < num_of_qubits_; ++i)
    op.qubits.push_back(i);

somewhere here:

op.save_type = Operations::DataSubType::list;

This issue is similar with this one: #2234

@aromanro aromanro added the bug Something isn't working label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant