-
Notifications
You must be signed in to change notification settings - Fork 7
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
ZX-Calculus pass for Qiskit Terra #27
Comments
Hi Ivan, the project seems pretty interesting to me. Can you point to some references for more details regarding the project? |
Hello @IvanIsCoding, this project looks super interesting. I have opted for this. I have been wanting to learn and understand ZX calculus and when I saw this, I thought this would be a good opportunity. I am well-versed with Python. I have studied a lot of Graph Theory during my education. Looking forward to a discussion and hopefully, get an opportunity to work on this :) |
I requested to have you working on this, thanks for letting me know it is your first option |
This is the checkpoint 1 presentation that we presented yesterday :) |
Checkpoint 2 After understanding ZX Calculus from the main paper, we dived deeper into pyZX. We have implemented the part of our project that involves converting ZX-diagrams into Qiskit DAG circuits. pyZX offers a Graph API and a Circuit API. We observe 2 cases most relevant for us and these cases are also more common:
There are other cases which we have also tried incorporating. One such case is when extract_circuit does not work for ZX graphs. In this case, we use full_reduce optimization offered by pyZX. The full_reduce method, while optimizing also turns all the red-spiders into green ones. The Graph API helps us with extracting phases of each green spider, the edges, the input and output vertices, most importantly the qubit mapping between each vertex and the qubits, the edge type which could indicate if there is CZ gate or CNOT gate if the edge is between vertices on 2 different qubits and if there is a H gate when the edge is between vertices on the same qubit. In case the full_reduce optimization gives us vertices that are not mapped on any qubit, we skip full_reduce, use to_gh for conversion into all green spiders and use the same approach we use when full_reduce worked, but this is a rare case for us. At the moment, we are not supporting cases if any 3 or more qubit gates cannot be decomposed into 2-qubit and single qubit gates. In case multi-qubit gates can be decomposed into 2 qubits and single qubit gates, we recommend passing the circuit or graph after the decomposition. Our implementation so far for ZX to DAG, can be seen here. One can read more about full_optimize and full_reduce from the pyZX documentation that also provides links to useful papers. Specifically, these approaches use ZX-Calculus concepts like phase polynomials and their optimization, local complementation, pivoting, Clifford simplification, phase gadgets. Our next step is to focus on unit-testing. We are currently thinking about some common and some unique circuits to test on. Here's an example of how the ZX diagram to Qiskit DAG circuit conversion looks like (the left is a ZX diagram and the right is the corresponding Qiskit DAG circuit): |
Final showcase slides: My github repo that has the codes: https://github.com/gprs1809/ZX_to_DAG_QAMP_fall_2022 My personal blog describing briefly what I understood about ZX-calculus, transpiler pass, pyZX and my overall QAMP experience: https://medium.com/@grishmaprs/zx-calculus-qiskit-transpiler-pass-pyzx-and-my-qamp-fall-2022-experience-cf17a6731cda We haven't made a PR yet because we would first resolve the issue we raised on pyZX, but I hope we raise a PR soon and it gets merged with Qiskit-Terra :) |
Congratulations on completing all the requirements for QAMP Fall 2022!! 🌟🌟🌟 |
Description
This project consists of implementing a ZX Calculus Optimization pass for Qiskit Terra (Qiskit/qiskit#4990). Previously, there had been attempts of integrating ZX Calculus to Qiskit via the
pyzx
library. However, the conversion relied on converting the representations to QASM, which is not viable option.Instead, this project will opt to directly convert the data structures from Qiskit (directed acyclic graphs backed by
rustworkx
) to the data structures ofpyzx
.Deliverables
pyzx
(e.g. Graph, Circuit)pyzx
format to DAGCircuitMentors details
Number of mentees
2
Type of mentees
The text was updated successfully, but these errors were encountered: