open source quantum computing - foss c

36
Open Source Quantum Computing Matthew Treinish Software Engineer - IBM Research [email protected] mtreinish on Freenode https://github.com/mtreinish/open-source-quantum-computing/tree/fossc-2019

Upload: others

Post on 03-Jan-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Open Source Quantum Computing - FOSS C

Open Source Quantum Computing

Matthew TreinishSoftware Engineer - IBM Research

[email protected] on Freenode

https://github.com/mtreinish/open-source-quantum-computing/tree/fossc-2019

Page 2: Open Source Quantum Computing - FOSS C

1 / 22

Page 3: Open Source Quantum Computing - FOSS C

Real Quantum Computer

2 / 22

Page 4: Open Source Quantum Computing - FOSS C

Quantum Chips

https://github.com/Qiskit/ibmq-device-information

3 / 22

Page 5: Open Source Quantum Computing - FOSS C

4 / 22

Page 6: Open Source Quantum Computing - FOSS C

What is Qiskit?

◮ SDK for working with NoisyIntermediate-Scale Quantum (NISQ)computers

◮ Apache 2.0 License

◮ Designed to be backend agnostic

◮ Includes out-of-the-box localsimulators and support for running onIBMQ

5 / 22

Page 7: Open Source Quantum Computing - FOSS C

Qiskit Elements

6 / 22

Page 8: Open Source Quantum Computing - FOSS C

Qiskit Terra

◮ Is the base layer for applications,provides interface to hardware andsimulators

◮ Provides an SDK for working withquantum circuits

◮ Compiles circuits to run on differentbackends

◮ Written in Python

7 / 22

Page 9: Open Source Quantum Computing - FOSS C

The Qubit

◮ The bloch sphere provides arepresentation of qubit state

◮ State can be at any pointalong surface of sphere

◮ Measuring a qubit occursalong the Z axis. (also calledbasis states)

◮ Measuring a qubit isirreversible and will either be0 or 1

Bloch Sphere:

8 / 22

Page 10: Open Source Quantum Computing - FOSS C

The Qubit

◮ The bloch sphere provides arepresentation of qubit state

◮ State can be at any pointalong surface of sphere

◮ Measuring a qubit occursalong the Z axis. (also calledbasis states)

◮ Measuring a qubit isirreversible and will either be0 or 1

Bloch Sphere:

8 / 22

Page 11: Open Source Quantum Computing - FOSS C

The Qubit

◮ The bloch sphere provides arepresentation of qubit state

◮ State can be at any pointalong surface of sphere

◮ Measuring a qubit occursalong the Z axis. (also calledbasis states)

◮ Measuring a qubit isirreversible and will either be0 or 1

Bloch Sphere:

8 / 22

Page 12: Open Source Quantum Computing - FOSS C

Quantum Gates◮ Quantum Logic Gates are used perform operations on qubits◮ Gates are reversible◮ Gates can be represented as unitary matrices

9 / 22

Page 13: Open Source Quantum Computing - FOSS C

Superposition◮ Identically prepared qubits can still behave randomly◮ The randomness is inherent in nature

|0〉

|1〉

|0〉 + |1〉

∼50/50 chance of being

|0〉 or |1〉10 / 22

Page 14: Open Source Quantum Computing - FOSS C

Hadamard Gate

11 / 22

Page 15: Open Source Quantum Computing - FOSS C

Controlled Not Gate

CNOT flips the target bit if the control bit is 1

|0〉 • |0〉

a |0〉 + b |1〉 a |0〉 + b |1〉

|1〉 • |1〉

a |0〉 + b |1〉 b |0〉 + a |1〉

12 / 22

Page 16: Open Source Quantum Computing - FOSS C

Quantum Circuits

Putting it together you build a circuit like:

q02 : |0〉 X H •

q01 : |0〉 X H

q00 : |0〉 H

c02 : 0

c01 : 0

c00 : 0

◮ Each row represents a bit, either quantum or classical

◮ The operations are performed each qubit left to right

◮ Shows dependencies of operations

13 / 22

Page 17: Open Source Quantum Computing - FOSS C

Bernstein-Vazirani Algorithm1

The Oracle

Input (query)⇐= Xn−1 · · · X1X0

Secret BitstringSn−1 · · · S1S0

Output (result)=⇒ Xn−1Sn−1 ⊕ · · · X1S1 ⊕ X0S0

1E. Bernstein & U. Vazirani, STOC, 93

14 / 22

Page 18: Open Source Quantum Computing - FOSS C

Optimal Classical Oracle

Loop over each bit!

X = 1 0 · · · 0 0 (2n−1)X = 0 1 · · · 0 0 (2n−2)...X = 0 0 · · · 1 0 (2)X = 0 0 · · · 0 1 (1)

The ideal classical oracle is O(n)

15 / 22

Page 19: Open Source Quantum Computing - FOSS C

Quantum Oracle

|x0〉

Oracle

|x0〉

|x1〉 |x1〉

|x2〉 |x2〉

|x3〉 |x3〉

|tmp〉 |x · s〉 ⊕ |tmp〉

A quantum oracle is O(1)

16 / 22

Page 20: Open Source Quantum Computing - FOSS C

Quantum Oracle Implementation

S = 1001

|x0〉 •

|x1〉

|x2〉

|x3〉 •

|tmp〉

1 0 0 1|x3 · s3 ⊕ x2 · s2 ⊕ x1 · s1 ⊕ x0 · s0 ⊕ tmp〉

17 / 22

Page 21: Open Source Quantum Computing - FOSS C

Full Circuit for a Quantum Oracle

q0 : |0〉 H

Oracle

H

q1 : |0〉 H H

q2 : |0〉 H H

q3 : |0〉 H H

tmp0 : |0〉 X H H

res0 : 0 1

res1 : 0 0

res2 : 0 0

res3 : 0 1

18 / 22

Page 22: Open Source Quantum Computing - FOSS C

Full Circuit for a Quantum Oracle

The Oracle

q0 : |0〉 H • H

q1 : |0〉 H H

q2 : |0〉 H H

q3 : |0〉 H • H

tmp0 : |0〉 X H H

res0 : 0 1

res1 : 0 0

res2 : 0 0

res3 : 0 1

︷ ︸︸ ︷

Where there is a CNOT phase kickback will set the control qubit to state |1〉

18 / 22

Page 23: Open Source Quantum Computing - FOSS C

Live Demo

19 / 22

Page 24: Open Source Quantum Computing - FOSS C

Open Source in Quantum Computing

◮ Open source is used to help fosters collaboration

◮ Also being used as an educational tool to teach quantum concepts

◮ Learning from the history of development of classical computers

◮ Many open source quantum computing projects already exist:https://github.com/topics/quantum-computing

20 / 22

Page 25: Open Source Quantum Computing - FOSS C

Conclusions

◮ Quantum Computing is about solving problems that we can’t with classicalcomputers

◮ It’s still very early for quantum computers

◮ Not just in labs anymore, quantum computing is accessible by everyone now

◮ Open source software is playing a key role in the development of quantumcomputers

21 / 22

Page 26: Open Source Quantum Computing - FOSS C

Where to get more information

◮ These Slides:https://github.com/mtreinish/open-source-quantum-computing/tree/fossc-2019

◮ Qiskit: https://qiskit.org/

◮ Qiskit Terra on Github: https://github.com/Qiskit/qiskit-terra

◮ IBM Q Experience: https://quantumexperience.ng.bluemix.net/qx

◮ Tutorials on Quantum Computing and Qiskit:https://github.com/Qiskit/qiskit-tutorials

22 / 22

Page 27: Open Source Quantum Computing - FOSS C

BACKUP SLIDES

22 / 22

Page 28: Open Source Quantum Computing - FOSS C

Qubit Phase

◮ While qubits are read alongthe basis vectors you can stilluse the other dimensions

◮ The phase can be leveragedto encode more informationin the qubit

Phase is φ:

22 / 22

Page 29: Open Source Quantum Computing - FOSS C

Hadamard and Phase

Hadamard gates are self inverses:

|0〉 H |0〉 + |1〉 H |0〉

|1〉 H |0〉 - |1〉 H |1〉

Phase

22 / 22

Page 30: Open Source Quantum Computing - FOSS C

Phase Kickback

(|0〉 + |1〉)(|0〉 − |1〉)

|0〉 H

|1〉 H

22 / 22

Page 31: Open Source Quantum Computing - FOSS C

Phase Kickback

(|0〉 + |1〉)(|0〉 − |1〉)= |00〉 − |01〉 + |10〉 − |11〉Expand it

|0〉 H

|1〉 H

22 / 22

Page 32: Open Source Quantum Computing - FOSS C

Phase Kickback

(|0〉 + |1〉)(|0〉 − |1〉)= |00〉 − |01〉 + |10〉 − |11〉

|0〉 H •

|1〉 H

|00〉 − |01〉 − |10〉 + |11〉

22 / 22

Page 33: Open Source Quantum Computing - FOSS C

Phase Kickback

(|0〉 + |1〉)(|0〉 − |1〉)= |00〉 − |01〉 + |10〉 − |11〉

|0〉 H •

|1〉 H

|00〉 − |01〉 − |10〉 + |11〉= (|0〉 - |1〉)(|0〉 − |1〉)Phase Kickback

22 / 22

Page 34: Open Source Quantum Computing - FOSS C

Phase Kickback

(|0〉 + |1〉)(|0〉 − |1〉)= |00〉 − |01〉 + |10〉 − |11〉

|0〉 H • H |1〉

|1〉 H H |1〉

|00〉 − |01〉 − |10〉 + |11〉= (|0〉 - |1〉)(|0〉 − |1〉)Phase Kickback

22 / 22

Page 35: Open Source Quantum Computing - FOSS C

22 / 22

Page 36: Open Source Quantum Computing - FOSS C

Entanglement

◮ 2 qubits too far apart to influenceeach other can behave in a waythat are individually random butare strongly correlated

◮ The state of an n-qubit systemcannot (in general) be written asthe state of its individualcomponents.

◮ To simulate entanglement youneed exponential resources

◮ CNOT gates are often used tosetup entanglements

One Qubit:a |0〉 + b |1〉

Two Qubits:a |00〉 + b |01〉 + c |11〉

Three Qubits:a |000〉 + b |001〉 + c |010〉 + d |011〉 +e |100〉 + f |101〉 + g |110〉 + h |111〉

22 / 22