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

BasicAer (and Aer) do not capture global phase #4805

Closed
Cryoris opened this issue Jul 26, 2020 · 1 comment · Fixed by #4915
Closed

BasicAer (and Aer) do not capture global phase #4805

Cryoris opened this issue Jul 26, 2020 · 1 comment · Fixed by #4915
Labels
bug Something isn't working

Comments

@Cryoris
Copy link
Contributor

Cryoris commented Jul 26, 2020

Information

  • Qiskit Terra version: 8f717d9
  • Python version: 3.7.7
  • Operating system: macOS Catalina

What is the current behavior?

BasicAer doesn't get the phases right (neither does Aer, but that'll probably be fixed within Aer). The tests using BasicAer, which I think is only test_to_matrix in test_extensions_standard works by coincidence because the rotation angles are 0 and thereby the phase difference is e^{i0} = 1.

Also this causes the tests in #4638 to fail, because there's a test using BasicAer where the phase is not 1.

Steps to reproduce the problem

>>> qc = QuantumCircuit(1)
>>> qc.rz(0.2, 0)
>>> Operator(qc)
Operator([[0.99500417-0.09983342j, 0.        +0.j        ],
          [0.        +0.j        , 0.99500417+0.09983342j]],
         input_dims=(2,), output_dims=(2,))
>>> execute(qc, Aer.get_backend('unitary_simulator')).result().get_unitary()
array([[1.        +0.j        , 0.        +0.j        ],
       [0.        +0.j        , 0.98006658+0.19866933j]])
>>> execute(qc, BasicAer.get_backend('unitary_simulator')).result().get_unitary()
array([[1.        +0.j        , 0.        +0.j        ],
       [0.        +0.j        , 0.98006658+0.19866933j]])
@Cryoris Cryoris added the bug Something isn't working label Jul 26, 2020
@kdk kdk added this to the 0.15 milestone Jul 28, 2020
mtreinish added a commit to mtreinish/qiskit-core that referenced this issue Jul 29, 2020
This commit adds the global phase circuit property to the experiment
headers in the assembled qobj. Currently we do not pass the global phase
to backends so simulators can not take it into account. The experiment
header is used since it's a free form field for properties of the
circuit that a backend can use if they want, but there are no
requirements on it. With this in place it should enable Qiskit#4805 and
Qiskit/qiskit-aer#847 to be fixed.

Related to Qiskit#4805
mtreinish added a commit that referenced this issue Jul 29, 2020
This commit adds the global phase circuit property to the experiment
headers in the assembled qobj. Currently we do not pass the global phase
to backends so simulators can not take it into account. The experiment
header is used since it's a free form field for properties of the
circuit that a backend can use if they want, but there are no
requirements on it. With this in place it should enable #4805 and
Qiskit/qiskit-aer#847 to be fixed.

Related to #4805
@kdk kdk modified the milestones: 0.15, 0.16 Aug 4, 2020
@chriseclectic
Copy link
Member

Qobj global phase support was added to Aer in Qiskit/qiskit-aer#931

@mergify mergify bot closed this as completed in #4915 Sep 24, 2020
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

Successfully merging a pull request may close this issue.

3 participants