-
Notifications
You must be signed in to change notification settings - Fork 616
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
Circuit Cutting: extend fragment_tape to work for Hamiltonians with more than one term #3672
Comments
Hi @gideonuchehara, We are aware of this issue. It's on the roadmap to fix, but we can't make any promises about fixing it asap. If you are keen to try out a fix, we'd be happy to set up a call to discuss how! |
Sure @AlbertMitjans. I'd be happy to chat with you. In the mean time, I though to also bring the following to your attention: I also observed that this error cascaded into the
you will get the circuit below after cut:
Clearly, no cut was done. Instead, To solve this problem, I implemented a hamiltonian version of def splitted_hamiltonian(tape):
ham_tapes, ham_fn = qml.transforms.hamiltonian_expand(tape, group=False)
ricco_tapes, ricco_fn = qml.transforms.map_batch_transform(ricco, ham_tapes)
return ricco_tapes, ricco_fn, ham_fn @qml.batch_transform
def ricco_hamiltonian(tape):
ricco_tapes, ricco_fn, ham_fn = splitted_hamiltonian(tape)
def processing_fn(res):
result = ham_fn(ricco_fn(res))
return qml.math.array(result)
return ricco_tapes, processing_fn I made just a minor change to the original |
Hi @gideonuchehara ! I updated the format of the code in your comment because it was hard to read. You can click the Thank you for the warning and your implementation! We will add an error message soon. Let me get back to you when I find out who coded the |
Hi @AlbertMitjans , That's right. Thanks for helping out! |
Hi @gideonuchehara, @trbromley will get in touch with you! |
Thanks @gideonuchehara! This should now be possible with #4642. You may open a new issue for additional requests. |
Feature details
qml.transforms.qcut.fragment_graph()
does not work for quantum tapes which compute the expectation values of Hamiltonians with more than one term. When applied to a tape with such Hamiltonians, it returns the unfragmented, original circuit without warning or error message.Implementation
Fragment the quantum tape as usual based on the cut locations, then sort and split the Hamiltonian terms among the different fragments.
How important would you say this feature is?
3: Very important! Blocking work.
Additional information
No response
The text was updated successfully, but these errors were encountered: