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

Qiskit / qiskit / 14750218858

30 Apr 2025 06:58AM UTC coverage: 87.907% (-0.02%) from 87.922%
14750218858

push

github

web-flow
Stop using faer-rs for uc_gate.rs (#13956)

* Stop using faer-rs for uc_gate.rs

This commit stops using faer and ndarray for the uc_gate.rs module and
switches to use nalgebra instead. The uc_gate.rs module works all in
terms of 2x2 matrices and moving to nalgebra brings the advantage of
having everything be fixed size stack allocated for the arrays used.
While this code path isn't performance critical this should improve
performance, despite the goal here being to remove a dependency on faer.

The tradeoff here is that nalgebra doesn't seem to have a general
eigensolver natively. There is functionality for this in the
nalgebra-lapack crate, but as the name implies this depends on linking
against lapack to work. The reason we originally started using faer is
because it's pure rust and doesn't complicate our build system. In this
specific case this is not a big deal because the matrices we need to
compute the eigenvectors and eigenvalues for is a 2x2 so this commit
includes a function to compute that directly. This lack of functionality
is something to keep in mind for the future if we need this
functionality more generally we will have to make a choice between faer
and linking against lapack.

Part of #13665

Co-authored-by: Gadi Aleksandrowicz <gadial@gmail.com>
Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>

* Add tests for 2x2 eig

* Fix lint

* Simplify random matrix tests

* Remove divide by sqrt(2) from random number

---------

Co-authored-by: Gadi Aleksandrowicz <gadial@gmail.com>
Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>

70 of 77 new or added lines in 2 files covered. (90.91%)

13 existing lines in 4 files now uncovered.

74551 of 84807 relevant lines covered (87.91%)

432977.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.23
/crates/qasm2/src/expr.rs


Source Not Available

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