8000 Fix random number generator seed argument for quantum_volume (backport #14586) by mergify[bot] · Pull Request #14592 · Qiskit/qiskit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix random number generator seed argument for quantum_volume (backport #14586) #14592

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

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

mergify[bot]
Copy link
Contributor
@mergify mergify bot commented Jun 12, 2025

The seed argument to quantum_volume being a numpy.random.Generator resulted in integers being called with 0 for the low argument. When called with only a low argument like this, this value is taken as one more than the maximum and 0 is treated as the minimum. This resulted in a TypeError because the range is from 0 to -1. Here the handling of Generator was updated to match how the deprecated QuantumVolume class handled seed (which was slightly odd -- it caps the range at the int64 limit even though the argument is a u64 in the Rust function -- but probably fine; keeping the range helps keep the behavior consistent between QuantumVolume and quantum_volume for a generator with the same seed).


This is an automatic backport of pull request #14586 done by [Mergify](https://mergify.com).

* Fix random number generator seed argument for quantum_volume

The `seed` argument to `quantum_volume` being a `numpy.random.Generator`
resulted in `integers` being called with 0 for the `low` argument. When
called with only a `low` argument like this, this value is taken as one
more than the maximum and 0 is treated as the minimum. This resulted in a
`TypeError` because the range is from 0 to -1. Here the handling of
`Generator` was updated to match how the deprecated `QuantumVolume`
class handled `seed` (which was slightly odd -- it caps the range at the
int64 limit even though the argument is a `u64` in the Rust function --
but probably fine; keeping the range helps keep the behavior consistent
between `QuantumVolume` and `quantum_volume` for a generator with the
same seed).

* Address pylint's misunderstanding of the test import

(cherry picked from commit ba74b5c)
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

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

@github-actions github-actions bot added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Jun 12, 2025
@github-actions github-actions bot added this to the 1.4.4 milestone Jun 12, 2025
@github-actions github-actions bot added the mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library label Jun 12, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 15621943358

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on mergify/bp/stable/2.1/pr-14586 at 87.984%

Totals Coverage Status
Change from base Build 15608557081: 88.0%
Covered Lines: 83031
Relevant Lines: 94371

💛 - Coveralls

@ElePT ElePT added this pull request to the merge queue Jun 13, 2025
Merged via the queue into stable/2.1 with commit 3fef690 Jun 13, 2025
29 checks passed
@ElePT ElePT deleted the mergify/bp/stable/2.1/pr-14586 branch June 13, 2025 16:49
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0