-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add UnitaryOverlap to the circuit library #10734
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
Conversation
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.
Overall LGTM, the one thing we have to cover is that there are more ways that circuits can be non-unitary, other than that I just have small comments 🙂
main change: check if circuits are unitary by checking if all operations are of type ``Gate``
…a into unitary-overlap
- do not allow U/V - allow setting parameter prefixes
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.
In principle this looks fine to me now. It's better that the argument names have a more consistent way of linking to the (default) parameter names, rather than us using three separate U/V, circ1/circ2 and a/b pairs to refer to the same split throughout the code and the public interface.
I'm still of the opinion that these kinds of things should be helper functions and not subclasses of QuantumCircuit
, but it's better that this new object is consistent with the rest of the circuit library. The _check_unitary
helper is slightly overcautious (it will reject directives like Barrier
, for example), but in lieu of us having a better model for parametric gates at the moment, it's fine.
Summary
Adds the
UnitaryOverlap
circuit to the circuit library that aids in the construction of applications such as machine learning and chemistry.This circuit returns the fidelity of states generated by two unitaries as the probability of being in the all-zeros state or, equivalently, the expectation value of the projector over the all-zeros state.
Details and comments