Skip to content
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

Add IonQ native gates #1500

Closed
yitchen-tim opened this issue Sep 21, 2022 · 8 comments
Closed

Add IonQ native gates #1500

yitchen-tim opened this issue Sep 21, 2022 · 8 comments
Assignees
Labels
feature-request A request for a feature, tool, or workflow in Mitiq. interface-and-conversions How Mitiq interfaces with quantum software packages. priority/mid Should be fixed by the next 1-2 milestones.
Milestone

Comments

@yitchen-tim
Copy link
Contributor

Issue Description

Amazon Braket now supports verbatim compilation now for IonQ. But when I tired to run this example with verbatim compilation and native gates, I got the validation error that the gate does not exist.

ValueError: Unable to convert the instruction Instruction('operator': GPi('angle': 0.0, 'qubit_count': 1), 'target': QubitSet([Qubit(0)])) to Cirq. If you think this is a bug, you can open an issue on the Mitiq GitHub at https://github.com/unitaryfund/mitiq.

Proposed Solution

Add IonQ native gates, GPi, GPi2 and MS, as part of the supported gates of Mitiq.

Additional References

Amazon Braket's Developer Guide
IonQ's doc

@yitchen-tim yitchen-tim added the feature-request A request for a feature, tool, or workflow in Mitiq. label Sep 21, 2022
@github-actions
Copy link

Hello @yitchen-tim, thank you for your interest in Mitiq!
If this is a bug report, please provide screenshots and/or minimum viable code to reproduce your issue, so we can do our best to help get it fixed. If you have any questions in the meantime, you can also ask us on the Unitary Fund Discord.

@andreamari
Copy link
Member

andreamari commented Sep 22, 2022

Hi @yitchen-tim, thanks for reporting this!
Mitiq doesn't support GPi gates and many other platform-specific gates.
I think there are two alternative paths that you could try:

  • Applying Mitiq before the final verbatim compilation into native gates. In practice this means to insert the compilation in the body of the usual Mitiq execute function such that all the Mitiq circuit workflow happens with "standard gates" until the final step in which circuits are compiled right before entering the IonQ backend.
  • Alternatively, you can try to define a custom folding function, similar to those in mitiq.zne.scaling, but compatible with your native gates. I am not sure if this will work, it's just an idea.

@andreamari andreamari added priority/mid Should be fixed by the next 1-2 milestones. interface-and-conversions How Mitiq interfaces with quantum software packages. IonQ labels Sep 22, 2022
@yitchen-tim
Copy link
Contributor Author

Thanks for the pointers to alternatives. Adding compilation as the final step of execute function sounds like the best way for those who want to use Mitiq with IonQ native gates today. But, for long term, I feel like adding native gates is still the best solution. I am happy to contribute to add the gates. I already started to do so, but I ran into issue that the inverse of IonQ native gates are not implemented in Cirq. I am looking into how to solve this. Any idea how I can bypass this issue besides implementing the inverse method in Cirq?

@andreamari
Copy link
Member

Thanks for the pointers to alternatives. Adding compilation as the final step of execute function sounds like the best way for those who want to use Mitiq with IonQ native gates today. But, for long term, I feel like adding native gates is still the best solution. I am happy to contribute to add the gates.

That would be great, thanks!

I already started to do so, but I ran into issue that the inverse of IonQ native gates are not implemented in Cirq. I am looking into how to solve this. Any idea how I can bypass this issue besides implementing the inverse method in Cirq?

I fear that defining the inverse is necessary since in Mitiq we need to call the inverse method of Cirq gates. E.g. all unitary folding functions in Mitiq requires the evaluation of inverse gates.

@yitchen-tim
Copy link
Contributor Author

Opened a PR in Cirq to implement the inverse of these gates. Once Cirq is updated, I will implement the Braket-Cirq translation in Mitiq.

@andreamari
Copy link
Member

Perfect! thanks @yitchen-tim

@yitchen-tim
Copy link
Contributor Author

@andreamari The PR for gate conversion is out #1525 !

@natestemen natestemen removed the IonQ label Nov 3, 2022
@natestemen natestemen added this to the 0.25.0 milestone Mar 2, 2023
@andreamari
Copy link
Member

andreamari commented Mar 17, 2023

This issue was actually closed by #1525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A request for a feature, tool, or workflow in Mitiq. interface-and-conversions How Mitiq interfaces with quantum software packages. priority/mid Should be fixed by the next 1-2 milestones.
Projects
None yet
Development

No branches or pull requests

3 participants