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

support reset and measure in qasmparser #192

Open
dlyongemallo opened this issue Dec 16, 2023 · 1 comment
Open

support reset and measure in qasmparser #192

dlyongemallo opened this issue Dec 16, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@dlyongemallo
Copy link
Contributor

I was trying to enter some graphs into ZXLive using the "Input Circuit" function and realised that the most natural way to express them in OpenQASM would be to use the reset and measure operations.

I believe the reset operation (initialise a qubit to |0>) can be implemented by sticking an X vertex instead of a boundary on the input (left) side of the graph for that qubit. Also, would it make sense to use the InitAncilla gate to represent reset? I'm not sure what InitAncilla is used for.

Similarly, I think measure can be implemented as a parametrised spider on the output (right) of the graph instead of a boundary. Currently, qasmparser recognises measure as a valid command but just skips it when it encounters it, effectively treating it as a noop, so making this change may be breaking backwards compatibility. Also, it would be nice to be able to implement conditional gates using the created parameter too, though that might be difficult.

These two gates would be slightly different from the currently supported gates in that they would alter the number of effective input/output boundaries when converted to a graph. Is there anything relying on the assumption that the number of boundaries is twice the number of qubits, for example? Or any reason these two operations can't or shouldn't be implemented?

@jvdwetering
Copy link
Collaborator

InitAncilla was originally meant for an extension to circuit extraction to allow for ancillae to be placed, but in the end it was not used.
For the Input Circuit stuff, Aleks was playing around with an extension of his own called 'spider qasm' a couple of years ago, so that you can easily place spiders. It's in the demo's folder, under Spider Qasm tutorial. So maybe in ZXLive, that could also be supported.

dlyongemallo added a commit to dlyongemallo/zxlive that referenced this issue Dec 21, 2023
dlyongemallo added a commit to dlyongemallo/zxlive that referenced this issue Dec 21, 2023
@jvdwetering jvdwetering added the enhancement New feature or request label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants