Skip to content

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

Merged
merged 11 commits into from
Oct 19, 2023

Conversation

nonhermitian
Copy link
Contributor

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

@nonhermitian nonhermitian requested a review from a team as a code owner August 30, 2023 10:58
@mtreinish mtreinish added the Changelog: New Feature Include in the "Added" section of the changelog label Aug 30, 2023
@mtreinish mtreinish added this to the 0.45.0 milestone Aug 30, 2023
Copy link
Contributor

@Cryoris Cryoris left a 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``
- do not allow U/V
- allow setting parameter prefixes
Copy link
Member

@jakelishman jakelishman left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog priority: high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants