-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oxidize TwoQubitDecomposeUpToDiagonal #12563
Conversation
This commit ports the TwoQubitDecomposeUpToDiagonal class from Python to rust. This internal private class is used internally by the quantum shannon decomposition code, and while not performance critical was simple to port. One difference is while the original Python implementation was a class, it acted more like a function in practice. So the new rust version is exposed as a function. Co-authored-by: Luciano Bello <[email protected]> Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: Sebastian Brandhofer <[email protected]> Co-authored-by: Jake Lishman <[email protected]> Co-authored-by: John Lapeyre <[email protected]> Co-authored-by: Julien Gacon <[email protected]> Co-authored-by: Eli Arbel <[email protected]> Co-authored-by: Raynel Sanchez <[email protected]> Co-authored-by: Henry Zou <[email protected]> Co-authored-by: Shelly Garion <[email protected]> Co-authored-by: Alexander Ivrii <[email protected]>
Pull Request Test Coverage Report for Build 9496622203Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Since Qiskit#12459 recently merged we now have a mechanism to build a circuit from rust. This commit updates the synthesis function to build the circuit directly in rust instead of returning a circuit sequence and building the circuit from Python. This should speed up the construction substantially.
One or more of the following people are relevant to this code:
|
This commit removes the Python implementation of the function. This is now unused in Qiskit and was never a public class so nothing external should be depending on it. Since it's not used we should just remove it.
8bf99c1
to
c56f8af
Compare
Pull Request Test Coverage Report for Build 9512074968Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9679860893Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9681374865Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 10080593333Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few super minor comments.
|
||
#[new] | ||
#[pyo3(signature=(unitary_matrix, fidelity=DEFAULT_FIDELITY, _specialization=None))] | ||
fn new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there value in following the pattern of naming this py_new
and naming the Rust-side constructor new
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern that's used everywhere in accelerate for this was rust is foo_inner
and python is foo
. I think we should normalize on a single pattern across all the crates, but maybe do that in a separate standalone PR?
* Oxidize TwoQubitDecomposeUpToDiagonal This commit ports the TwoQubitDecomposeUpToDiagonal class from Python to rust. This internal private class is used internally by the quantum shannon decomposition code, and while not performance critical was simple to port. One difference is while the original Python implementation was a class, it acted more like a function in practice. So the new rust version is exposed as a function. Co-authored-by: Luciano Bello <[email protected]> Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: Sebastian Brandhofer <[email protected]> Co-authored-by: Jake Lishman <[email protected]> Co-authored-by: John Lapeyre <[email protected]> Co-authored-by: Julien Gacon <[email protected]> Co-authored-by: Eli Arbel <[email protected]> Co-authored-by: Raynel Sanchez <[email protected]> Co-authored-by: Henry Zou <[email protected]> Co-authored-by: Shelly Garion <[email protected]> Co-authored-by: Alexander Ivrii <[email protected]> * Build circuit from rust Since Qiskit#12459 recently merged we now have a mechanism to build a circuit from rust. This commit updates the synthesis function to build the circuit directly in rust instead of returning a circuit sequence and building the circuit from Python. This should speed up the construction substantially. * Remove unused private Python class This commit removes the Python implementation of the function. This is now unused in Qiskit and was never a public class so nothing external should be depending on it. Since it's not used we should just remove it. * Remove unused import * Calculate best_nbasis in unwrap_or_else() --------- Co-authored-by: Luciano Bello <[email protected]> Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: Sebastian Brandhofer <[email protected]> Co-authored-by: Jake Lishman <[email protected]> Co-authored-by: John Lapeyre <[email protected]> Co-authored-by: Julien Gacon <[email protected]> Co-authored-by: Eli Arbel <[email protected]> Co-authored-by: Raynel Sanchez <[email protected]> Co-authored-by: Henry Zou <[email protected]> Co-authored-by: Shelly Garion <[email protected]> Co-authored-by: Alexander Ivrii <[email protected]>
Summary
This commit ports the TwoQubitDecomposeUpToDiagonal class from Python to rust. This internal private class is used internally by the quantum shannon decomposition code, and while not performance critical was simple to port. One difference is while the original Python implementation was a class, it acted more like a function in practice. So the new rust version is exposed as a function.
Details and comments
TODO: