• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 11263539461
88%

Build:
DEFAULT BRANCH: main
Ran 09 Oct 2024 10:05PM UTC
Jobs 1
Files 891
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

09 Oct 2024 08:54PM UTC coverage: 88.642% (-0.2%) from 88.865%
11263539461

push

github

web-flow
Add .index() and new() method to Qubit and Clbit (#13284)

* Add .index() and new() method to Qubit and Clbit

The Qubit and Clbit rust newtypes are a u32 that are used to track the
Qubits or Clbits in a circuit. The u32 value represents the index of the
Qubit or Clbit in the circuit and are often used as indices in Vecs or
other structures where the index must be a usize. Accordingly there are
a lot of times we need to convert a Qubit or Clbit object into a usize
and previously the only way to do that was use `.0 as usize` on a given
qubit object. To improve the ergonomics of that pattern this commit adds
two new methods for converting from and to a usize new() and index()
respectively. These are modeled after what petgraph does with it's
NodeIndex type which is a similar pattern (although NodeIndex is generic
over the inner type, although it defaults to u32).

* Use Qubit::new() and Clbit::new() where applicable

* Panic on overflow with new() constructor

This commit changes the behavior of the Qubit::new() and Clbit::new()
constructors so that they panic if a user provides a usize that's too
large for the u32 we store internally. Previously the way it was written
it would just wrap the value to u32::MAX.

Co-authored-by: Kevin Hartman <kevin@hart.mn>

---------

Co-authored-by: Kevin Hartman <kevin@hart.mn>

147 of 152 new or added lines in 14 files covered. (96.71%)

20 existing lines in 6 files now uncovered.

73107 of 82474 relevant lines covered (88.64%)

376736.87 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
92.55
-0.52% crates/accelerate/src/synthesis/multi_controlled/mcmt.rs
2
98.08
0.75% crates/accelerate/src/synthesis/clifford/greedy_synthesis.rs
2
96.15
-3.85% crates/circuit/src/lib.rs

Uncovered Existing Lines

Lines Coverage ∆ File
1
88.41
-0.0% crates/circuit/src/dag_circuit.rs
1
94.02
-0.24% crates/qasm2/src/expr.rs
2
88.19
-0.42% qiskit/transpiler/passes/synthesis/unitary_synthesis.py
4
91.98
0.25% crates/qasm2/src/lex.rs
6
96.69
0.46% crates/qasm2/src/parse.rs
6
90.77
-4.69% qiskit/synthesis/two_qubit/xx_decompose/decomposer.py
Jobs
ID Job ID Ran Files Coverage
1 11263539461.1 09 Oct 2024 10:05PM UTC 891
88.64
GitHub Action Run
Source Files on build 11263539461
  • Tree
  • List 891
  • Changed 841
  • Source Changed 14
  • Coverage Changed 783
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #11263539461
  • 4dcb0a0b on github
  • Prev Build on gh-readonly-queue/main/pr-13168-4e573f36febd01e9147b037f2cb485c232febae7 (#11240551122)
  • Next Build on main (#11275139027)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc