IBM-Quantum-Technical-Enablement / quantum-enablement

IBM Quantum Engineering and Enabling Technologies
Apache License 2.0
28 stars 8 forks source link

feat(circuits): add `compute_uncompute` function #16

Closed pedrorrivero closed 6 months ago

pedrorrivero commented 7 months ago

Summary

Adds new compute_uncompute function to automatically implement this strategy in any given input circuit (i.e. $U \rightarrow U^\dagger U$).

Details and comments

coveralls commented 7 months ago

Pull Request Test Coverage Report for Build 8032164131

Details


Totals Coverage Status
Change from base Build 8031993973: 0.0%
Covered Lines: 19
Relevant Lines: 19

💛 - Coveralls
miamico commented 7 months ago

I'm a little bit unsure about this. Let's have some discussion about pros and cons. My feeling is that if we do this for every single small function we'll end up with a huge baggage of tests.

Separate issue to clarify, if the corresponding notebook ends up on the learning platform, how are these functions retrieved?

pedrorrivero commented 7 months ago

Thanks @miamico

Yeah, this function started being significantly larger because it was applied to specific circuits but I ended up narrowing it down a lot in clean up. At this point I think we could/should add it to the notebook directly. Nonetheless, I'd still like to keep the construct in the available tooling for ease of reference in the future.

I think it is also a great simple example for the team on how to write tests. But let's talk offline if you want.

To retrieve this function (not sure exactly what you mean) you would do

from quantum_enablement.circuits import compute_uncompute
miamico commented 6 months ago

Thanks @miamico

Yeah, this function started being significantly larger because it was applied to specific circuits but I ended up narrowing it down a lot in clean up. At this point I think we could/should add it to the notebook directly. Nonetheless, I'd still like to keep the construct in the available tooling for ease of reference in the future.

I think it is also a great simple example for the team on how to write tests. But let's talk offline if you want.

To retrieve this function (not sure exactly what you mean) you would do

from quantum_enablement.circuits import compute_uncompute

I agree that the testing framework is hashed out nicely for this function and it is worth to keep the example around for reference. What I meant by "retrieve" is that when we run a notebook on the learning platform, does that notebook have access to the quantum_enablement repo?

pedrorrivero commented 6 months ago

What I meant by "retrieve" is that when we run a notebook on the learning platform, does that notebook have access to the quantum_enablement repo?

Not yet, but it could be configured if we needed to and got approval. Great point!