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

PauliOp.adjoint() does not return correct value #9433

Closed
king-p3nguin opened this issue Jan 23, 2023 · 0 comments · Fixed by #9434
Closed

PauliOp.adjoint() does not return correct value #9433

king-p3nguin opened this issue Jan 23, 2023 · 0 comments · Fixed by #9434
Labels
bug Something isn't working mod: opflow Related to the Opflow module

Comments

@king-p3nguin
Copy link
Contributor

king-p3nguin commented Jan 23, 2023

Environment

  • Qiskit Terra version: 0.24.0.dev0+e981b7e
  • Python version: 3.8.16
  • Operating system: Linux

What is happening?

PauliOp.adjoint() does not return a correct answer like SparsePauliOp.adjoint() does.

How can we reproduce the issue?

from qiskit.opflow.primitive_ops import PauliOp
from qiskit.quantum_info import Pauli, SparsePauliOp

sparse_pauli_op = SparsePauliOp(["iX"], [3.0])
expected = SparsePauliOp(["-iX"], [3.0])
assert sparse_pauli_op.adjoint() == expected # this is OK

pauli_op = PauliOp(Pauli("X"), coeff=3j)
expected = PauliOp(Pauli("X"), coeff=-3j)
assert pauli_op.adjoint() == expected # this is also OK

pauli_op = PauliOp(Pauli("iX"), coeff=3)
expected = PauliOp(Pauli("-iX"), coeff=3)
assert pauli_op.adjoint() == expected # returns AssertionError

What should happen?

The code above should not return AssertionError.

Any suggestions?

No response

@king-p3nguin king-p3nguin added the bug Something isn't working label Jan 23, 2023
@jakelishman jakelishman added the mod: opflow Related to the Opflow module label Jan 23, 2023
@mergify mergify bot closed this as completed in #9434 Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mod: opflow Related to the Opflow module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants