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

Qiskit / qiskit / 14663307542
88%

Build:
DEFAULT BRANCH: main
Ran 25 Apr 2025 11:37AM UTC
Jobs 1
Files 803
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

25 Apr 2025 10:38AM UTC coverage: 87.915% (-0.01%) from 87.929%
14663307542

push

github

web-flow
Improve 2q block collection via 1q quaternion-based collection (#13649)

* Add versor-based representation of 1q gates

1q gates are members of the group U(2), which we can represent as a
scalar phase term and a member of SU(2).  The members of SU(2) can be
represented by versors (also called unit quaternions, but I got tired of
typing that all the time...).

This adds a representation of versors and the group action to the Rust
code, and ways to convert from matrix-based forms to the them.

This commit introduces `nalgebra` as a dependency, to use its
quaternion logic.  This is a relatively heavy dependency, especially for
something as simple as quaternions, but some of this is in anticipation
of moving more matrix code to the static matrices of `nalgebra`, rather
than the too-dynamic-for-our-needs ones of `ndarray`; `faer` also offers
static matrices, but its APIs continue to heavily fluctuate between
versions, and it requires ever higher MSRVs.

* Use quaternions in 1q block collection

Switch the inner algorithm of `ConsolidateBlocks` to use the quaternion
form for single-qubit matrix multiplications.  This offered a few
percentage-points speedup for the block collection for typical
`rz-sx-rz-sx-rz`-type runs in quantum-volume-like collections.

* Avoid unnecessary allocations in qargs lookup

Switch the lookup logic for the qargs in the block collector to
determine the qargs ordering without additional heap allocations.  This
offers another modest (~4%) improvement in collection performance for
large runs.

* Avoid allocations in simple matrix operations

Producing the Kronecker product of the two single-qubit matrices from
the versor representation is trivially calculable, and can be written
into an existing allocation.  Similarly, switching the qubit order of a
2q matrix involves only six swaps, and does not need to allocate a new
matrix if one is already available.

There are lots of places remaining in this code where more matrix
allocations ... (continued)

261 of 315 new or added lines in 3 files covered. (82.86%)

10 existing lines in 4 files now uncovered.

74356 of 84577 relevant lines covered (87.92%)

433470.2 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
3
93.38
1.55% crates/accelerate/src/convert_2q_block_matrix.rs
51
76.92
crates/accelerate/src/quantum_info/versor_u2.rs

Uncovered Existing Lines

Lines Coverage ∆ File
1
91.63
-0.04% crates/accelerate/src/two_qubit_decompose.rs
1
94.78
0.0% crates/accelerate/src/unitary_synthesis.rs
2
92.23
0.75% crates/qasm2/src/lex.rs
6
96.68
0.0% crates/qasm2/src/parse.rs
Jobs
ID Job ID Ran Files Coverage
1 14663307542.1 25 Apr 2025 11:37AM UTC 803
87.92
GitHub Action Run
Source Files on build 14663307542
  • Tree
  • List 803
  • Changed 9
  • Source Changed 3
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #14663307542
  • a50d73d9 on github
  • Prev Build on gh-readonly-queue/main/pr-14210-6bf8f1c11ececae79aa0d0f505400452ae60e05e (#14639528421)
  • Next Build on main (#14668025139)
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