PyZX: Quantum circuit optimization using the ZX-calculus Aleks - - PowerPoint PPT Presentation

pyzx quantum circuit optimization using the zx calculus
SMART_READER_LITE
LIVE PREVIEW

PyZX: Quantum circuit optimization using the ZX-calculus Aleks - - PowerPoint PPT Presentation

PyZX: Quantum circuit optimization using the ZX-calculus Aleks Kissinger aleks@cs.ru.nl John van de Wetering john@vdwetering.name Institute for Computing and Information Sciences Radboud University Nijmegen February 3, 2019 Quantum


slide-1
SLIDE 1

PyZX: Quantum circuit optimization using the ZX-calculus

Aleks Kissinger

aleks@cs.ru.nl

John van de Wetering

john@vdwetering.name

Institute for Computing and Information Sciences Radboud University Nijmegen

February 3, 2019

slide-2
SLIDE 2
slide-3
SLIDE 3

Quantum computation

§ Quantum computation is done by quantum circuits.

slide-4
SLIDE 4

Quantum computation

§ Quantum computation is done by quantum circuits. § A quantum circuit consists of quantum gates.

slide-5
SLIDE 5

Quantum computation

§ Quantum computation is done by quantum circuits. § A quantum circuit consists of quantum gates. § Single qubit gates: NOT, S, T, H.

slide-6
SLIDE 6

Quantum computation

§ Quantum computation is done by quantum circuits. § A quantum circuit consists of quantum gates. § Single qubit gates: NOT, S, T, H. NOT S = H ? NOT H H(adamard) T = ? S

slide-7
SLIDE 7

Quantum computation

§ Quantum computation is done by quantum circuits. § A quantum circuit consists of quantum gates. § Single qubit gates: NOT, S, T, H. NOT S = H ? NOT H H(adamard) T = ? S § Two qubit gate: CNOT (controlled NOT)

slide-8
SLIDE 8

Quantum computation

§ Quantum computation is done by quantum circuits. § A quantum circuit consists of quantum gates. § Single qubit gates: NOT, S, T, H. NOT S = H ? NOT H H(adamard) T = ? S § Two qubit gate: CNOT (controlled NOT) § These are all the gates you need.

slide-9
SLIDE 9

Quantum computation

§ Quantum computation is done by quantum circuits. § A quantum circuit consists of quantum gates. § Single qubit gates: NOT, S, T, H. NOT S = H ? NOT H H(adamard) T = ? S § Two qubit gate: CNOT (controlled NOT) § These are all the gates you need. § Our objective is to minimize number of gates needed. § Specifically T-gates.

slide-10
SLIDE 10

Circuit diagrams

NOT =

+

CNOT =

+

slide-11
SLIDE 11

Circuit diagrams

NOT =

+

CNOT =

+

An example quantum circuit:

T

` `

H

`

S S

slide-12
SLIDE 12

Circuit identities

+ +

=

H H

=

T T

=

S T: T

=

slide-13
SLIDE 13

Gate commutation

=

+ + + +

T

=

+

T

+

T

=

+ +

T T

+ +

T

slide-14
SLIDE 14

More circuit equalities

slide-15
SLIDE 15

And more circuit equalities

slide-16
SLIDE 16

And even more circuit equalities

slide-17
SLIDE 17

Things get messy because circuits are very rigid

slide-18
SLIDE 18

Things get messy because circuits are very rigid Enter ZX-diagrams

slide-19
SLIDE 19

ZX-diagrams

What gates are to circuits, spiders are to ZX-diagrams.

slide-20
SLIDE 20

ZX-diagrams

What gates are to circuits, spiders are to ZX-diagrams. Z-spiders:

α

... ... X-spiders:

α

... ... (α P r0, 2πs)

slide-21
SLIDE 21

ZX-diagrams

What gates are to circuits, spiders are to ZX-diagrams. Z-spiders:

α

... ... X-spiders:

α

... ... (α P r0, 2πs) Spiders can be wired in any way:

α

π 2 3π 2

β π

slide-22
SLIDE 22

ZX-diagrams

What gates are to circuits, spiders are to ZX-diagrams. Z-spiders:

α

... ... X-spiders:

α

... ... (α P r0, 2πs) Spiders can be wired in any way:

α

π 2 3π 2

β π

Note: “Only connectivity matters”

slide-23
SLIDE 23

Quantum gates as ZX-diagrams

Every quantum gate can be written as a ZX-diagram: S “

π 2

T “

π 4

H “ :=

π 2 π 2 π 2

CNOT “

slide-24
SLIDE 24

Quantum gates as ZX-diagrams

Every quantum gate can be written as a ZX-diagram: S “

π 2

T “

π 4

H “ :=

π 2 π 2 π 2

CNOT “

Theorem

Any linear map between qubits can be represented as a ZX-diagram.

slide-25
SLIDE 25

Rules for ZX-diagrams: The ZX-calculus

β

... ...

α

... ... “ ... ... ...

α`β p-1qaα

aπ aπ aπ α

... ...

aπ aπ

...

aπ α

“ ...

aπ aπ α

... “

α

... “ “ “ α, β P r0, 2πs, a P t0, 1u

slide-26
SLIDE 26

Completeness of the ZX-calculus

Theorem

If two ZX-diagrams represent the same computation, then they can be transformed into one another using the previous rules (and one additional one).

slide-27
SLIDE 27

Completeness of the ZX-calculus

Theorem

If two ZX-diagrams represent the same computation, then they can be transformed into one another using the previous rules (and one additional one). So instead of dozens of circuit equalities, we just have a few simple rules.

slide-28
SLIDE 28

PyZX

§ PyZX is an open-source Python library. § github.com/Quantomatic/pyzx

slide-29
SLIDE 29

PyZX

§ PyZX is an open-source Python library. § github.com/Quantomatic/pyzx § Its goal is to allow easy manipulation of large ZX-diagrams.

slide-30
SLIDE 30

PyZX

§ PyZX is an open-source Python library. § github.com/Quantomatic/pyzx § Its goal is to allow easy manipulation of large ZX-diagrams. § Visualisation: Jupyter and Matplotlib. § Documentation: Sphinx § Numpy for various things.

slide-31
SLIDE 31

PyZX and optimization

§ Recall: we want to minimize T-count.

slide-32
SLIDE 32

PyZX and optimization

§ Recall: we want to minimize T-count. § So how well does PyZX do this?

slide-33
SLIDE 33

PyZX and optimization

§ Recall: we want to minimize T-count. § So how well does PyZX do this? § For every circuit tested matches or beats the state-of-the-art.

slide-34
SLIDE 34

PyZX and optimization

§ Recall: we want to minimize T-count. § So how well does PyZX do this? § For every circuit tested matches or beats the state-of-the-art.

(Usually performs similarly, but goes up to 50% better than previous best)

slide-35
SLIDE 35

PyZX and optimization

§ Recall: we want to minimize T-count. § So how well does PyZX do this? § For every circuit tested matches or beats the state-of-the-art.

(Usually performs similarly, but goes up to 50% better than previous best)

§ What about other metrics: gate count/depth?

slide-36
SLIDE 36

PyZX and optimization

§ Recall: we want to minimize T-count. § So how well does PyZX do this? § For every circuit tested matches or beats the state-of-the-art.

(Usually performs similarly, but goes up to 50% better than previous best)

§ What about other metrics: gate count/depth? § Work in progress.

slide-37
SLIDE 37

Demonstration time

slide-38
SLIDE 38

Future work

§ Allow routing for restricted architectures.

slide-39
SLIDE 39

Future work

§ Allow routing for restricted architectures. § Optimize for different metrics.

slide-40
SLIDE 40

Future work

§ Allow routing for restricted architectures. § Optimize for different metrics. § Allow ancillae.

slide-41
SLIDE 41

Future work

§ Allow routing for restricted architectures. § Optimize for different metrics. § Allow ancillae. § Closer integration with other frameworks/libraries.

slide-42
SLIDE 42

Thank you for your attention