Skip to content

SparsePauliOp incorrectly sets non-zero imaginary component #13522

@kaelynj

Description

@kaelynj

Environment

  • Qiskit version: 1.3.0
  • Python version: 3.11.7
  • Operating system: Fedora 40

What is happening?

When a SparsePauliOp object is instantiated with a long string of Y's (greater than 100), the imaginary component of the coefficients is non-zero (but trivially small, ~1e-15). This results in errors when submitting jobs using qiskit-ibm-runtime which throws an error when using the SparsePauliOp as the expectation value to estimate.

How can we reproduce the issue?

from qiskit.quantum_info import SparsePauliOp
# produces non-zero imaginary component
yyy = SparsePauliOp('Y'*100)
print(yyy.coeffs)
# correctly contains no imaginary component
yy = SparsePauliOp('Y'*99)
print(yy.coeffs)

What should happen?

A high-weight SparsePauliOp, when no coefficients are specified, should possess coeffcients = [1.0, 0.0]

Any suggestions?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmod: quantum infoRelated to the Quantum Info module (States & Operators)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions