b77f3c5b5c
* Better align 1q euler decomposition output to multiples of π/2 This commit updates the euler decomposer to better align the parameter outputs to be multiples of π/2 when possible to enable the circuit to be run under a clifford simulator. Previously the angle was calculated as: ``` phi = angle(u11 * (det**(-0.5))) + angle(u10 * (det**(-0.5))) ``` which has been replaced with: ``` phi = angle(u11) + angle(u10) - angle(det) ``` The algebra to get the new expression is: ``` phi = angle(u11 * (det**(-0.5))) + angle(u10 * (det**(-0.5))) # assumes particular phase convention so not guaranteed to be the # valid interpretation (though it probably is). = angle(u11) - 0.5*angle(det) + angle(u10) - 0.5*angle(det) = angle(u11) + angle(u10) - angle(det) ``` A couple of tests are updated as they were testing for exact circuit outputs and the synthesis is returning equivalent by different results in those cases. Co-authored-by: aeddins-ibm <60495383+aeddins-ibm@users.noreply.github.com> * Simplify calculation Given the same phase convention the calculation of theta and phase can be simplified to remove the need of computing the coeff. This commit implements this change which should speed up the calculation slighty as we're doing less work to reach an equivalent result. Co-authored-by: Jake Lishman <jake.lishman@ibm.com> * Remove complex_phase function The complex phase function previously defined in euler_one_qubit_decomposer.rs was duplicated with an existing `arg()` method of the Complex<T> type from num-complex. This commit removes the duplicated definition in favor of the built-in method. * Try removing rz gate from qpy tests to side step differing decomposition of controlled gate * Update crates/accelerate/src/euler_one_qubit_decomposer.rs Co-authored-by: aeddins-ibm <60495383+aeddins-ibm@users.noreply.github.com> --------- Co-authored-by: aeddins-ibm <60495383+aeddins-ibm@users.noreply.github.com> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |
README.md
qiskit._accelerate
This crate provides a bits-and-pieces Python extension module for small, self-contained functions that are used by the main Python-space components to accelerate certain tasks. If you're trying to speed up one particular Python function by replacing its innards with a Rust one, this is the best place to put the code. This is usually the right place to put Rust/Python interfacing code.
The crate is made accessible as a private submodule, qiskit._accelerate
. There are submodules
within that (largely matching the structure of the Rust code) mostly for grouping similar functions.
Some examples of when it might be more appropriate to start a new crate instead of using the
ready-made solution of qiskit._accelerate
:
-
The feature you are developing will have a large amount of domain-specific Rust code and is a large self-contained module. If it reasonably works in a single Rust file, you probably just want to put it here.
-
The Rust code is for re-use within other Qiskit crates and maintainability of the code will be helped by using the crate system to provide API boundaries between the different sections.
-
You want to start writing your own procedural macros.