Skip to content

Conversation

@Cryoris
Copy link
Collaborator

@Cryoris Cryoris commented May 22, 2025

Summary

@ElePT reported that #13643 came back for other circuits, too. This essentially affects circuits that use operators as inputs, which have coefficients of complex types. This problem does not appear on main, I assume #13278 removes the 0 complex component. We could still consider to add this safetyguard to main, but there's no way to break it right now that I'm aware of.

@Cryoris Cryoris requested a review from a team as a code owner May 22, 2025 13:44
@Cryoris Cryoris added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library labels May 22, 2025
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Cryoris
  • @Qiskit/terra-core
  • @ajavadia

@mtreinish
Copy link
Member

Should this be backported to 2.0.2?

@Cryoris
Copy link
Collaborator Author

Cryoris commented May 22, 2025

Whoops, wrong target branch -- this was supposed to go on stable/2.0

@Cryoris Cryoris changed the base branch from main to stable/2.0 May 22, 2025 14:06
@coveralls
Copy link

Pull Request Test Coverage Report for Build 15188244278

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 1552 unchanged lines in 53 files lost coverage.
  • Overall coverage increased (+0.2%) to 88.333%

Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/gate_metrics.rs 1 97.06%
crates/accelerate/src/sparse_pauli_op.rs 1 95.61%
qiskit/circuit/controlledgate.py 1 94.62%
qiskit/synthesis/arithmetic/adders/draper_qft_adder.py 1 96.15%
qiskit/transpiler/passes/optimization/template_matching/template_substitution.py 1 93.54%
crates/accelerate/src/synthesis/clifford/bm_synthesis.rs 2 99.22%
qiskit/circuit/parameter.py 2 97.01%
qiskit/primitives/containers/data_bin.py 2 96.15%
crates/accelerate/src/synthesis/clifford/greedy_synthesis.rs 3 97.92%
qiskit/circuit/_add_control.py 3 97.84%
Totals Coverage Status
Change from base Build 15171763641: 0.2%
Covered Lines: 78474
Relevant Lines: 88839

💛 - Coveralls

Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

LGTM. I have confirmed that this fixes the primitives bug that triggered the issue.

@ElePT ElePT enabled auto-merge May 22, 2025 15:56
@ElePT ElePT added the stable backport potential The bug might be minimal and/or import enough to be port to stable label May 22, 2025
@ElePT ElePT added this pull request to the merge queue May 22, 2025
@mtreinish mtreinish added this to the 1.4.4 milestone May 22, 2025
Merged via the queue into Qiskit:stable/2.0 with commit e7fa11d May 22, 2025
25 checks passed
@mtreinish
Copy link
Member

@Mergifyio backport stable/1.4

@mergify
Copy link
Contributor

mergify bot commented May 22, 2025

backport stable/1.4

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request May 22, 2025
* Fix spurious complex part in circuit funcs

* reno links

(cherry picked from commit e7fa11d)
github-merge-queue bot pushed a commit that referenced this pull request May 22, 2025
* Fix spurious complex part in circuit funcs

* reno links

(cherry picked from commit e7fa11d)

Co-authored-by: Julien Gacon <jules.gacon@googlemail.com>
@ElePT
Copy link
Contributor

ElePT commented May 23, 2025

@Mergifyio backport main

@mergify
Copy link
Contributor

mergify bot commented May 23, 2025

backport main

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request May 23, 2025
* Fix spurious complex part in circuit funcs

* reno links

(cherry picked from commit e7fa11d)
github-merge-queue bot pushed a commit that referenced this pull request Jun 5, 2025
#14455)

* Fix more spurious complex parts in circuit functions (#14431)

* Fix spurious complex part in circuit funcs

* reno links

(cherry picked from commit e7fa11d)

* Add qpy compat test

* Fix black

* Fix lint, don't import circuit library element on older qiskit version

* Remove venv

* Fix indentation

* Fix tests

* Fix import

* Fix access

* debug

* Change test

* Restore backwards compat test

* Remove reno

---------

Co-authored-by: Julien Gacon <jules.gacon@googlemail.com>
Co-authored-by: ElePT <epenatap@gmail.com>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
rahaman-quantum pushed a commit to rahaman-quantum/qiskit that referenced this pull request Jun 20, 2025
…#14431) (Qiskit#14455)

* Fix more spurious complex parts in circuit functions (Qiskit#14431)

* Fix spurious complex part in circuit funcs

* reno links

(cherry picked from commit e7fa11d)

* Add qpy compat test

* Fix black

* Fix lint, don't import circuit library element on older qiskit version

* Remove venv

* Fix indentation

* Fix tests

* Fix import

* Fix access

* debug

* Change test

* Restore backwards compat test

* Remove reno

---------

Co-authored-by: Julien Gacon <jules.gacon@googlemail.com>
Co-authored-by: ElePT <epenatap@gmail.com>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: Bugfix Include in the "Fixed" section of the changelog mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library stable backport potential The bug might be minimal and/or import enough to be port to stable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants