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

Qiskit / qiskit / 27292754037
88%

Build:
DEFAULT BRANCH: main
Ran 10 Jun 2026 05:45PM UTC
Jobs 1
Files 947
Run time 3min
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

10 Jun 2026 04:44PM UTC coverage: 87.54% (+0.007%) from 87.533%
27292754037

push

github

web-flow
Add QuantumCircuit method to compute estimated fidelity (#16292)

* Add QuantumCircuit method to compute estimated fidelity

This commit adds a new method to the quantum circuit (in both Python and
C) to easily compute the estimated fidelity of a physical circuit for a
given target. This uses the fidelity estimation that Qiskit's internal passes
such as VF2Layout, VF2PostLayout, and TwoQubitPeepholeOptimization use
for estimating fidelity of a circuit or subcircuit. This is a common operation
when working with circuit compilation, especially when trying different
pass manager constructions, or pass configurations to try and optimize the circuit for
execution on a given backend. Having a quick metric for comparison of how the
transpiler reasons about different compilations of the same circuit is
useful for debugging compilation workflows.

While writing this function is fairly straightforward to do in Python
with a simple for loop like:

```python
error = 1.0
for inst in circuit.data:
    qargs = tuple(circuit.find_bits(x).index for x in inst.qubits)
    error *= target[inst.name][qargs].error
1.0 - error
```
(it's a bit more involved in C but fairly trivial too) given the general
utility of this and avoiding Python iteration for large circuits writing this
in Rust and exposing it to both C and Python for a consistent method is worth
the addition.

The rust implementation of this new function is put in
`qiskit_transpiler::target::estimate_fidelity` mostly because that was
the lowest part of the internal dependency tree that it could be
implemented. Typically this kind of function we would put in the
`qiskit_accelerate` crate as a random accelerator, however because this
function is being exposed to C too that was not a viable destination for
it. Since we need both `CircuitData` and `Target` available to implement
the function this made the most sense. The other alternative is probably
to create a standalone module in the transpiler crate but this funct... (continued)

41 of 41 new or added lines in 4 files covered. (100.0%)

23 existing lines in 4 files now uncovered.

110866 of 126646 relevant lines covered (87.54%)

955306.06 hits per line

Coverage Regressions

Lines Coverage ∆ File
18
96.68
-0.47% crates/qasm2/src/parse.rs
3
92.8
0.51% crates/qasm2/src/lex.rs
1
91.03
0.0% crates/circuit/src/parameter/parameter_expression.rs
1
74.25
0.29% crates/circuit/src/parameter/symbol_expr.rs
Jobs
ID Job ID Ran Files Coverage
1 27292754037.1 10 Jun 2026 05:45PM UTC 947
87.54
GitHub Action Run
Source Files on build 27292754037
  • Tree
  • List 947
  • Changed 9
  • Source Changed 5
  • Coverage Changed 9
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #27292754037
  • 6af9c950 on github
  • Prev Build on gh-readonly-queue/main/pr-16404-cee79bc66c1d6f1ef10a995f489fd1a244c8d130 (#27283627993)
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

© 2026 Coveralls, Inc