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

Qiskit / qiskit / 13168373427
88%

Build:
DEFAULT BRANCH: main
Ran 05 Feb 2025 11:42PM UTC
Jobs 1
Files 907
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

05 Feb 2025 10:43PM UTC coverage: 88.6% (-0.05%) from 88.651%
13168373427

push

github

web-flow
Add unitary gate representation to rust (#13759)

* Add unitary gate representation to rust

This commit expands the rust circuit data model to include a definition
of UnitaryGate. This is a more abstract operation than what we've
defined so far in Rust, a gate represented solely by it's unitary matrix
but during normal transpilation we create and interact with these
operations for optimization purposes so having a native representation
in rust is necessary to avoid calling to Python when working with them.

This introduces a new UnitaryGate struct which represents the unpacked
operation. It has 3 internal storage variants based on either an ndarray
arbitrary sized array, a 2x2 nalgebra fixed sized array, or a 4x4
nalgebra fixed sized array. From the python perspective these all look
the same, but being able to internally work with all 3 variants lets us
optimize the code paths for 1q and 2q unitary gates (which are by far
more common) and avoid one layer of pointer indirection.

When stored in a circuit the packed representation is just a pointer to
the actual UnitaryGate which we put in a Box. This is necessary because
the struct size is too large to fit in our compact representation of
operations. Even the ndarray which is a heap allocated type requires more
than our allotted space in a PackedOperation so we need to reduce it's
size by putting it in a Box.

The one major difference here from the previous python based
representation the unitary matrix was stored as an object type parameter
in the PackedInstruction.params field, which now it is stored internally
in the operation itself. There is arguably a behavior change around
this because it's no longer possible to mutate the array of a
UnitaryGate in place once it's inserted into the circuit. While doing
this was horribly unsound, because there was no guardrails for doing it
a release note is added because there is a small use case where it would
have worked and it wasn't explicitly documented.

... (continued)

117 of 177 new or added lines in 6 files covered. (66.1%)

17 existing lines in 5 files now uncovered.

79337 of 89545 relevant lines covered (88.6%)

349627.62 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
78.96
0.8% crates/circuit/src/circuit_instruction.rs
3
81.11
-0.32% crates/accelerate/src/target_transpiler/mod.rs
23
88.34
-0.66% crates/circuit/src/operations.rs
33
88.84
-0.57% crates/circuit/src/dag_circuit.rs

Uncovered Existing Lines

Lines Coverage ∆ File
1
88.84
-0.57% crates/circuit/src/dag_circuit.rs
1
94.23
-0.23% crates/qasm2/src/expr.rs
2
78.96
0.8% crates/circuit/src/circuit_instruction.rs
6
97.15
0.0% crates/qasm2/src/parse.rs
7
91.98
-0.75% crates/qasm2/src/lex.rs
Jobs
ID Job ID Ran Files Coverage
1 13168373427.1 05 Feb 2025 11:42PM UTC 907
88.6
GitHub Action Run
Source Files on build 13168373427
  • Tree
  • List 907
  • Changed 73
  • Source Changed 6
  • Coverage Changed 9
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #13168373427
  • 936ec8e2 on github
  • Prev Build on main (#13165103262)
  • Next Build on main (#13169984711)
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