Skip to content

Change DType's real -> Bit casting rule - #16927

Open
Ian Hincks (ihincks) wants to merge 1 commit into
ihincks/qp-06c-shot-loopfrom
ihincks/qp-07-bit-cast
Open

Change DType's real -> Bit casting rule#16927
Ian Hincks (ihincks) wants to merge 1 commit into
ihincks/qp-06c-shot-loopfrom
ihincks/qp-07-bit-cast

Conversation

@ihincks

Copy link
Copy Markdown
Contributor

This PR makes the real->Bit casting rule follow NumPy's convention.
The current definition doesn't really make sense, it populates the 7 bits with junk.

AI/LLM disclosure

  • No part of this submission is LLM generated.
  • Some written text was generated by:
  • Some submitted code was generated by: claude opus 5

Stack created with GitHub Stacks CLIGive Feedback 💬

@ihincks
Ian Hincks (ihincks) requested a review from a team as a code owner September 3, 2026 15:04
@ihincks
Ian Hincks (ihincks) requested review from Jeevan (jeevan0920) and removed request for a team September 3, 2026 15:04
@qiskit-bot

Copy link
Copy Markdown
Collaborator

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

  • @Qiskit/terra-core

@ShellyGarion Shelly Garion (ShellyGarion) added the mod: providers Related to the backend and job abstractions label Sep 3, 2026
@coveralls

Coveralls (coveralls) commented Sep 3, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 34398814989

Coverage increased (+0.001%) to 88.1%

Details

  • Coverage increased (+0.001%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (8 of 10 lines covered, 80.0%).
  • 3 coverage regressions across 2 files.

Uncovered Changes

File Changed Covered %
crates/providers/src/tensor/value.rs 10 8 80.0%

Coverage Regressions

3 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
crates/qasm2/src/lex.rs 2 92.54%
crates/circuit/src/parameter/parameter_expression.rs 1 90.3%

Coverage Stats

Coverage Status
Relevant Lines: 135976
Covered Lines: 119795
Line Coverage: 88.1%
Coverage Strength: 960961.06 hits per line

💛 - Coveralls

@ihincks
Ian Hincks (ihincks) changed the base branch from ihincks/qp-06-quantum-program to ihincks/qp-06c-shot-loop September 3, 2026 22:13
A `Bit` tensor holds only 0 or 1. Casting `2.5` to `Bit` produced `2`, which
`bitwise_not` reads as `2 ^ 1 == 3`. The cast now compares against zero, like
NumPy's cast to `bool`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod: providers Related to the backend and job abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants