PyZX (pronounce as Pisics) is a Python tool implementing the theory of ZX-calculus for the creation, visualisation, and automated rewriting of large-scale quantum circuits.
It currently allows you to:
- Generate random quantum circuits containing millions of gates.
- Rewrite circuits into a pseudo-normal form using the ZX-calculus.
- Extract new simplified circuits from these reduced graphs.
- Read in quantum circuits in the file format of Quipper or Quantomatic.
- Visualize the ZX-graphs and rewrites using either Matplotlib or Quantomatic.
To install pyzx from source, clone this repository, cd
into it, and run:
pip install -e .
If you have Jupyter installed you can use one of the demo's for an illustration of what PyZX can do. For instance:
import pyzx as zx
qubit_amount = 5
gate_count = 40
#Generate random circuit of Clifford gates
circuit = zx.cliffords(qubit_amount, gate_count)
#If running in Jupyter, draw the circuit
zx.draw(circuit)
#Use one of the built-in rewriting strategies to simplify the circuit
zx.clifford_simp(circuit)
#See the result
zx.draw(circuit)