All Projects → Quantomatic → Pyzx

Quantomatic / Pyzx

Licence: apache-2.0
Python library for quantum circuit rewriting and optimisation using the ZX-calculus

Projects that are alternatives of or similar to Pyzx

Qubiter
Python tools for reading, writing, compiling, simulating quantum computer circuits. Includes numpy and tensorflow backends. “Quantum Space, the final frontier. These are the voyages of the starship Qubiter. Its five-year mission: to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no man has gone before.”
Stars: ✭ 103 (-33.12%)
Mutual labels:  quantum-computing
Qpanda 2
QPanda 2 is an open source quantum computing framework developed by OriginQC that can be used to build, run, and optimize quantum algorithms.
Stars: ✭ 128 (-16.88%)
Mutual labels:  quantum-computing
Learnquantum
Repo of resources to help learn about quantum computing.
Stars: ✭ 143 (-7.14%)
Mutual labels:  quantum-computing
Quantum Algorithms Tutorials
Tutorials for Quantum Algorithms with Qiskit implementations.
Stars: ✭ 115 (-25.32%)
Mutual labels:  quantum-computing
Recirq
Research using Cirq!
Stars: ✭ 119 (-22.73%)
Mutual labels:  quantum-computing
Ssss
"Deep Learning and Quantum Programming" Spring School @ Song Shan Lake
Stars: ✭ 135 (-12.34%)
Mutual labels:  quantum-computing
Q
Quantum Computation Simulator written in golang
Stars: ✭ 99 (-35.71%)
Mutual labels:  quantum-computing
Qucumber
Neural Network Many-Body Wavefunction Reconstruction
Stars: ✭ 152 (-1.3%)
Mutual labels:  quantum-computing
Quantum Nc
Microsoft Quantum Computing Libraries for noncommercial use
Stars: ✭ 126 (-18.18%)
Mutual labels:  quantum-computing
Awesome Quantum Machine Learning
Here you can get all the Quantum Machine learning Basics, Algorithms ,Study Materials ,Projects and the descriptions of the projects around the web
Stars: ✭ 1,940 (+1159.74%)
Mutual labels:  quantum-computing
Iqx User Guide
The users guide for the IBM Q experience
Stars: ✭ 115 (-25.32%)
Mutual labels:  quantum-computing
Qiskit Tutorials
A collection of Jupyter notebooks showing how to use the Qiskit SDK
Stars: ✭ 1,777 (+1053.9%)
Mutual labels:  quantum-computing
Monthly Challenges
Repository containing monthly challenges about quantum computing.
Stars: ✭ 126 (-18.18%)
Mutual labels:  quantum-computing
Qmlt
The Quantum Machine Learning Toolbox (QMLT) is a Strawberry Fields application that simplifies the optimization of variational quantum circuits (also known as parametrized quantum circuits).
Stars: ✭ 106 (-31.17%)
Mutual labels:  quantum-computing
Discopy
a toolbox for computing with monoidal categories
Stars: ✭ 148 (-3.9%)
Mutual labels:  quantum-computing
Awesome Quantum Computing
A curated list of awesome quantum computing learning and developing resources.
Stars: ✭ 1,350 (+776.62%)
Mutual labels:  quantum-computing
Scaffcc
Compilation, analysis and optimization framework for the Scaffold quantum programming language.
Stars: ✭ 133 (-13.64%)
Mutual labels:  quantum-computing
Ibmq Device Information
Information about the different remote backends available for qiskit users with a IBMQ account
Stars: ✭ 153 (-0.65%)
Mutual labels:  quantum-computing
Qiskit
Qiskit is an open-source SDK for working with quantum computers at the level of circuits, algorithms, and application modules.
Stars: ✭ 2,332 (+1414.29%)
Mutual labels:  quantum-computing
Solutionqcqinielsenchuang
Solution for Quantum Computation and Quantum Information by Nielsen and Chuang
Stars: ✭ 141 (-8.44%)
Mutual labels:  quantum-computing

PyZX

Unitary Fund CQC Support PyPI version

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. Please watch this 2-minute video for a short introduction.

PyZX currently allows you to:

  • Read in quantum circuits in the file format of QASM, Quipper or Quantomatic.
  • Rewrite circuits into a pseudo-normal form using the ZX-calculus.
  • Extract new simplified circuits from these reduced graphs.
  • Visualise the ZX-graphs and rewrites using either Matplotlib, Quantomatic or as a TikZ file for use in LaTeX documents.
  • Output the optimised circuits in QASM, QC or QUIPPER format.

You can try out the in-browser demo which shows some of these features here.

About the ZX-calculus

ZX-diagrams are a type of tensor network built out of combinations of linear maps known as spiders. There are 2 types of spiders: the Z-spiders (represented as green dots in PyZX) and the X-spiders (represented as red dots). Every linear map between some set of qubits can be represented by a ZX-diagram. The ZX-calculus is a set of rewrite rules for ZX-diagrams. There are various extensive set of rewrite rules. PyZX however, uses only rewrite rules concerning the Clifford fragment of the ZX-calculus. Importantly, this set of rewrite rules is complete for Clifford diagrams, meaning that two representations of a Clifford map can be rewritten into one another if and only if the two linear maps they represent are equal.

Here is a website with resources and information about the ZX-calculus. For a short introduction to the ZX-calculus see this paper while for a complete overview we recommend this book. PyZX extensively uses two derived rewrite rules known as local complementation and pivoting. More information about these operations can be found in this paper.

Installation

If you wish to use PyZX as a Python module for use in other projects, we recommend installing via pip:

    pip install pyzx

If you want to use the demos or the benchmark circuits you should install PyZX from source by cloning the git repository.

PyZX has no strict dependencies, although some functionality requires numpy. PyZX is built to interact well with Jupyter, so we additionally recommend you have Jupyter and matplotlib installed.

Usage

See the Documentation for a full overview of the features of PyZX.

If you have Jupyter installed you can use one of the demonstration notebooks in the demos folder for an illustration of what PyZX can do.

This is some example Python code for generating a random circuit, optimizing it, and finally displaying it:

import pyzx as zx
qubit_amount = 5
gate_count = 80
#Generate random circuit of Clifford gates
circuit = zx.generate.cliffordT(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.simplify.full_reduce(circuit)
#See the result
zx.draw(circuit)

PyZX can also be run from the commandline. To optimise a circuit you can for instance run python -m pyzx opt input_circuit.qasm

Attribution

If you wish to cite PyZX in an academic work, please cite the accompanying paper:

  @inproceedings{kissinger2020Pyzx,
    author = {Kissinger, Aleks and van de Wetering, John},
    title = {{PyZX: Large Scale Automated Diagrammatic Reasoning}},
    year = {2020},
    booktitle = {{\rm Proceedings 16th International Conference on} Quantum Physics and Logic, {\rm Chapman University, Orange, CA, USA., 10-14 June 2019}},
    editor = {Coecke, Bob and Leifer, Matthew},
    series = {Electronic Proceedings in Theoretical Computer Science},
    volume = {318},
    pages = {229-241},
    publisher = {Open Publishing Association},
    doi = {10.4204/EPTCS.318.14}
}

Here's a plane that says PYZX: PYZX

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].