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

Fix param positions for circuits with conditionals #1851

Merged
merged 8 commits into from
Jul 6, 2023

Conversation

hhorii
Copy link
Collaborator

@hhorii hhorii commented Jun 16, 2023

Summary

Resolve #1849

Details and comments

When conditional gates exist, parameter positions are changed because bfunc operations are injected.
It is the root cause of #1849 that reports wrong parameter bindings with circuits that have conditional gates.

With this PR, positions of Qiskit instructions and Aer operations are mapped and Aer's parameter bindings are based on this mapping.

Also this PR fixes a bug in parameterization of global phases, which was introduced in #1814. Its implementation was not correct and a test was not enough.

  • Add tests

@hhorii hhorii added this to the Aer 0.12.2 milestone Jun 16, 2023
@ajavadia
Copy link
Member

I can confirm this solves #1849 so I think after adding a test it can be merged

@@ -441,22 +461,28 @@ def test_check_parameter_binds_exist(self):

def test_global_phase_parameters(self):
"""Test parameterized global phase"""
backend = AerSimulator()
backend = AerSimulator(method="extended_stabilizer")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it enough only testing extended_stabilizer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We do not know practical cases to use parameterized global phases without extended_stabilizer. From the implementation perspective, parameters for global phases are resolved in common part for any methods.

@hhorii hhorii merged commit de6c489 into Qiskit:main Jul 6, 2023
33 of 34 checks passed
@hhorii hhorii added the stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable label Jul 7, 2023
hhorii added a commit to hhorii/qiskit-aer that referenced this pull request Jul 7, 2023
* fix parameter indexing issues.

* fix issues in parameterization of global phase

* add reno

* fix lint

* fix release note

* fix a bug to call _convert_circuit_binds

* add test
hhorii added a commit that referenced this pull request Jul 12, 2023
* bump version strings and prepare for release

* Remove `AerCircuit` from result of `backend.run()` (#1845)

* take AerCircuit from _metadata in experiment result

* add reno

* Fix rST formatting

---------

Co-authored-by: Jake Lishman <jake@binhbar.com>

* pin numpy version lower than 1.25 (#1859)

* Fix param positions for circuits with conditionals (#1851)

* fix parameter indexing issues.

* fix issues in parameterization of global phase

* add reno

* fix lint

* fix release note

* fix a bug to call _convert_circuit_binds

* add test

* Support save_statevector for QuantumCircuit from QASM3 string (#1846)

* Support save_statevector for QuantumCircuit from QASM3 string

* add qiskit_qasm3_import to requirements-dev.txt

* simplify default_qubits()

* fix lint error

* skip qasm3 circuit test in 3.7

* New GPU binaries with cuQuantum support (#1854)

* New GPU binaries with cuQuantum support

* format setup.py

* remove testpipy settings

* Update setup.py to use numpy with version lower than 1.25

* changed package names, qiskit-aer-gpu for CUDA12, and qiskit-aer-gpu-cu11 for 11

* format setup.py

* Update README.md

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update releasenotes/notes/renew_gpu_binaries-2cf3eba0853b8407.yaml

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* update release note

---------

Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* bump up python version from 3.7 to 3.8 to run cibuildwheel (#1867)

* bump up python version from 3.7 to 3.8 to run cibuildwheel

* bump up all python version in deploy workflow

* add reno

* set numpy version constraint only in dev (#1871)

* add numpy version constraint only in dev

* set numpy version constraint in contraints.txt

* bump up version in docs

---------

Co-authored-by: Jake Lishman <jake@binhbar.com>
Co-authored-by: Jun Doi <doichan@jp.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug in Estimator for parameterized dynamic circuits
3 participants