Use rust-native error for UnitarySynthesis#16281
Conversation
The following commits modify `UnitarySynthesis` to use rust-native errors throughout its pipeline. We implement the `UnitarySynthesisError` enumeration which derives from `DAGError`; `PyErr` for `XXDecomposer` and python gates purposes only; QSDError from Synthesis, and implements two variants: `NoPreferredDirection` and `SynthesisFidelityOutOfRange` used with decomposers.
|
One or more of the following people are relevant to this code:
|
Coverage Report for CI Build 26655587578Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.007%) to 87.551%Details
Uncovered Changes
Coverage Regressions28 previously-covered lines in 5 files lost coverage.
Coverage Stats
💛 - Coveralls |
gadial
left a comment
There was a problem hiding this comment.
LGTM. One question about which errors are raised (which is actually a legacy of the old code).
| fn from(value: UnitarySynthesisError) -> Self { | ||
| match value { | ||
| UnitarySynthesisError::NoPreferredDirection(_) => { | ||
| QiskitError::new_err(value.to_string()) |
There was a problem hiding this comment.
Why are we using QiskitError for one and PyValueError for the other?
There was a problem hiding this comment.
This is how the original error was.
This is what it looked like for NoPreferredDirection:
qiskit/crates/transpiler/src/passes/unitary_synthesis/decomposers.rs
Lines 562 to 568 in 5294c2a
This is for SynthesisFidelityOutOfRange
- here:
qiskit/crates/transpiler/src/passes/unitary_synthesis/decomposers.rs
Lines 608 to 612 in 5294c2a
- and here:
qiskit/crates/transpiler/src/passes/unitary_synthesis/decomposers.rs
Lines 699 to 706 in 5294c2a
The following commits modify
UnitarySynthesisto use rust-native errors throughout its pipeline. We implement theUnitarySynthesisErrorenumeration which derives from:DAGError;PyErrforXXDecomposerand python gates purposes only;QSDErrorfrom Synthesis;NoPreferredDirectionandSynthesisFidelityOutOfRangeused with decomposers.AI/LLM disclosure