Open edyounis opened 4 months ago
@edyounis would you like to be assigned to this issue? I am glad to try to solve it.
Hey I realized I only should have assigned this once completed.
Alright. I made a pull request "add feature get_inverse" just now that might need your review.
Many gates throughout the library are missing
get_inverse
andget_inverse_params
definitions.These functions are called when inverting an Operation. This is used to find the inverse of a circuit using natural gate definitions rather than a bunch of
DaggerGate
wrappers. This allows users to print qasm output easily after inverting a circuit without much manual intervention.Take a look at the U3Gate for a complete example. The inverse is the same gate but with different parameters. So the
get_inverse
function returns the same gate (U3Gate), and theget_inverse_params
returns the inverted parameters.There is a catch-all implementation for all gates that defaults to the DaggerGate wrapper, and in many cases, this is not necessary. We should implement these functions for all gates in the library that have simple inverses.