Open Source Quantum Computing
Matthew TreinishSoftware Engineer - IBM Research
[email protected] on Freenode
https://github.com/mtreinish/open-source-quantum-computing/tree/fossc-2019
1 / 22
Real Quantum Computer
2 / 22
Quantum Chips
https://github.com/Qiskit/ibmq-device-information
3 / 22
4 / 22
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
Qiskit Elements
6 / 22
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
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
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
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
Quantum Gates◮ Quantum Logic Gates are used perform operations on qubits◮ Gates are reversible◮ Gates can be represented as unitary matrices
9 / 22
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
Hadamard Gate
11 / 22
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
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
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
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
Quantum Oracle
|x0〉
Oracle
|x0〉
|x1〉 |x1〉
|x2〉 |x2〉
|x3〉 |x3〉
|tmp〉 |x · s〉 ⊕ |tmp〉
A quantum oracle is O(1)
16 / 22
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
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
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
Live Demo
19 / 22
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
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
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
BACKUP SLIDES
22 / 22
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
Hadamard and Phase
Hadamard gates are self inverses:
|0〉 H |0〉 + |1〉 H |0〉
|1〉 H |0〉 - |1〉 H |1〉
Phase
22 / 22
Phase Kickback
(|0〉 + |1〉)(|0〉 − |1〉)
|0〉 H
|1〉 H
22 / 22
Phase Kickback
(|0〉 + |1〉)(|0〉 − |1〉)= |00〉 − |01〉 + |10〉 − |11〉Expand it
|0〉 H
|1〉 H
22 / 22
Phase Kickback
(|0〉 + |1〉)(|0〉 − |1〉)= |00〉 − |01〉 + |10〉 − |11〉
|0〉 H •
|1〉 H
|00〉 − |01〉 − |10〉 + |11〉
22 / 22
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
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
22 / 22
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
Top Related