SlideShare a Scribd company logo
1 of 78
Quantum Programming
A New Approach to Solve Complex Problems
Francisco Gálvez Ramirez
IBM Staff
fjgramirez@es.ibm.com
Introducing myself
Francisco Gálvez
BS in Experimental Physics (UV)
Master in Advanced Physics (UV)
Cloud and Integrated Systems Expert
fjgramirez@es.ibm.com
@fjgramirez
Francisco J. Galvez Ramirez
Agenda
 Why Quantum Computation
 The IBM Quantum Computer
 Quantum Algorithms
 How to Program a Quantum Computer
 Tools for Quantum Computing
Why Quantum Computation ?
Why Quantum Computation ?
“...nature isn't classical, dammit, and if you want to make a simulation
of nature, you'd better make it quantum mechanical...” –
Richard Feynman, Simulating Physics with Computers
Why Quantum Computation ?
A qubit is the quantum concept of a bit.
0 1  It’s not any element or device. It’s a logical concept
that can be implemented on a wide range of
different systems with quantum behaviour
 As a bit, a single qubit can represent two states 0
and 1
But additionally a qubit is able to manage all possible combinations
amont base states 0 and 1
10 βα +
10 βαψ +=
What is a Qubit?
Why Quantum Computation ?
Spin Qubits – Electron or nuclear spins on a solid Substract.
Superconducting Circuits – currents superposition around a superconductor.
Ion’s Traps– Trap ions in electric fields
Photonic Circuits – The qubits are photons driven in in silicon circuits.
Qubit Implementation
Why Quantum Computation ?
 2 BITS
0
1
0 0
0
1
0
1
A 0 0 + B 1 0 + C 0 1 + D 1 1
1 0
0 1
1 1
 2 QUBITS
One state made of a combination
of every possible state of the
system
Quantum Superposition
Why Quantum Computation ?
Quantum Entanglement
1. Preparing an
entangled states.
An entangled stated can be
prepared by applying a common
operation to the system.
2. Measurement
0
1
The IBM Quantum Computer
March - 2016: Quantum Computing in the
Cloud
 IBM scientists have built a quantum processor
that any user can access through the first
quantum computing platform available in the
cloud.
 IBM Quantum Experience, allows users to
execute algorithms and experiments on a real
quantum processor
Marzo-2017: IBM announces IBM Q
IBM Q is the new line of Quantum Computers
IBM announces the building of a quantum computer of 50 qubits and
that will offer services of quantum computation in the cloud
Mayo-2017: First Commercial Quantum
Computer
16 and 17 qubits universal quantum computers
IBM announces a prototype of
17 qubits commercial quantum
computing
IBM has discovered how to
scale quantum architecture
In three years it is planned to
reach 50 qubits
IBM Superconducting Qubits Arquitecture
IBM's new 17-qubit quantum computer.
Coherence Times
• Coherence in IBM today is about
100 microseconds
• There are several initiatives to
improve the coherence times:
• Different materials
• Redesign of geometries
• Cavity Quality
• IR Shielding
• Important progress has been
made in the last decade
The Quantum Volume
The Dilution Refrigerator
 A key piece of the Quantum Computer is the Dilution Refrigerator
Working Temperature 15 mK
Dilution Refrigerator
3
He + 4
He
Some Quantum Algorithms
Quantum Algorithms
• Deusch Algorithm – Determines whether a funcion is balanced or
unbalanced
• Shor Algorithm – Large numbers factorization
• Grover Algoritm – Search in unstructured spaces
Deustch Algorithm
f1:
0 0
1 0
f2:
0 1
1 1
Deustch-Josza Algorithm  Extends Deustch’s
algorithm to n value registers
f3:
0 0
1 1
f4:
0 1
1 0
Shor Algorithm
• Number of steps that a classic computer needs to run in order
to find the prime factors of a number N of x digits
It grows exponencially with x
• The Shor algorithm is made up of two parts:
1. One Classical part - Which focuses on finding the period
of a function
2. A quantum part based on QFT technics
In 2001, IBM and Stanford University, executed for the first time the Shor algorithm in the first quantum computer of 7
qubits developed in Los Álamos.
https://www-03.ibm.com/press/us/en/pressrelease/965.wss
Grover Algorithm
• How many attempts need a data search in an unordered N-
element database to locate a particular element?
An average of N/2 attemps are needed)
http://www.dma.eui.upm.es/MatDis/Seminario4/AlgoritmoGrover.pdf
• A Quantum Computer executing the Grover Algorithm would
run attempsN
How To Program A Quantum Computer?
Quantum Circuits
The Circuit Model
Gates execution time ~ 25 ns
~25 ns~25 ns ~25 ns ... ... ... ... ...
Coherence time 100 ms
measurement
Quantum Operations
X-Gate
Flips a qubit from a 0 to a 1, or vice versa.
Hadamard Gate
Puts a qubit into a superposition of states.
Flips a second qubit only if the first qubit is 1.
Controlled Not Gate
Entanglement
H gate puts the first qubit in a
superposition. CNOT gate both
flips and does not flip the
second qubit.
Assuming the qubits start as 0,
when measured, they will be 11
or 00, but never 10 or 01.
Quantum Operations
 It is a basic circuit that acts on one or several qubits
 It is equivalent to logical gates in digital circuits
Quantum Gates
1. Quantum Gates are Reversible
2. Matematically are represented by unitary matrices.
3. The qubits upon they act keep their quantum nature.






−
=
11
11
2
1












=
0100
1000
0010
0001
=
Hadamard Gate
C-NOT Gate






=
01
10
X - Gate
NOT Gate
 Transforms the state in
the state and viceversa
 It means a rotation of π
radians around X axis
0
1
Change of state
One Qubit Quantum Gates
One Qubit Quantum Gates
Hadamard Gate
 It transforms any of the base
states or in a
combination of both
 It means a rotation of π/2
radians around X axis and Z
axis
Superposition of base states
0 1
It cannot be meassured on Z axis, but we can use an H gate to change the basis
One Qubit Quantum Gates
The Z Gate Cambio de Fase - π
 It runs a rotation of π radians
around Z axis
One Qubit Quantum Gates
The S Gate Phase Shift: – π/2
 It run a rotation of π/2
radians around Z axis
One Qubit Quantum Gates
The S Gate
Phase Shift: – π/4
 It runs a rotation of π/4
radians around Z axis
Two Qubit Quantum Gates
The CNOT Gate
Flips the target qubit, depending on the state
of the control qubit
Gates with more than two qubits
The Toffoli Gate
Flips the target qubit, depending on the state
of two control qubits
control 1
control 2
target
User Defined Gates
Gates with more than two qubits
( ) ( ) ( )λλλ zRUu == ,0,0:11
2
3
( ) ( ) ( ) 





−





+==
2
2
2
,,2:,2
π
λπ
π
φλφπλφ zxz RRRUu
( ) ( ) ( ) ( ) ( ) ( ) ( )λππθππφλφθλφθ zxzxz RRRRRUu 223,,:,,3 ++==
User Defined Control Gates
Gates with more than two qubits
1
1
if(q0==1) U1 q1;
if(q0==1 and q1==1) U1 q2;
Quantum Operations
Quantum Gates Set
Quantum Operations
The Bloch Sphere
 Standard Basis is not enough to specify a quantum State.
 We need to specify a phase as well.
 Bloch Sphere depicts the amplitudes and the phase of
one state.
1
2
0
2
cos 





+





=
θθ
ψ φ
senei
 There’s a one-to-one correspondence between pure qubits
states and the points on the surface on a unit sphere
2
C 3
R
Quantum Operations
The Qsphere
Qsphere shows states of more than 1 qubit
For 1 qubit  2 points
For 2 qubit  3 points
for n qubit  (n+1) points
 Each line from the center is possible outcome
 Allows to distinguish classical states from entangled states
• A classical state will have a single line pointing in one direction
• A superposition of two basis states will have two lines pointing in two directions of half
weight.
Tools For Quantum Programming
Tools for Quantum Programming
IBM Quantum Experience
Visual interface, Drag and Drop for 5 qubits
QISKit OpenQASM
Asembler Language for representing Quantum
Circuits
QISKit API
Python API to create and execute Quantum Circuits
Tools For Quantum Programming
IBM Quantum Experience QX2, QX4
IBM Quantum Experience
https://quantumexperience.ng.bluemix.net/qx
Quantum Circutis
IBM QX Composer
The Circuit Model
Quantum Circutis
Creating Scores
 Graphical Interface used to create programs for the quantum processor
 It allows to create quantum circuits using a logical gates library and well defined points of
measurement
Running Scores
 Bar Chart
• 0’s & 1’s combination in the bottom means the measured Qubit state.
• The height of the bar represents how often that particular state occurs
Tools For Quantum Programming
IBM Quantum Experience QX2, QX4
Grover Algorithm
1 2 3 4 ... ... N=2nω
Programming the Grover Algorithm – (I)
 A list of N item and there’s one item with a unique property that we wish to locate
 A classical computation needs to check on average of this boxes2N
 On a quantum computer, using the Grover’s algorithm it can be done in aprox. stepsN
1 2 3 4
Lets do it for N = 4
Programming the Grover Algorithm – (II)
∑
−
=
=
1
0
1 N
x
x
N
s
 At the beginning we have a uniform superposition
amplitu
de
0ψ
N
1
Items1 2 3 4
00 01 10 11
Programming the Grover Algorithm – (III)
 We need a function such that: for the marked state:1)( =xf ω
 In that way we build the “oracle” matrix: fU
( ) xxU xf
f
)(
1−=
 Applying the oracle reflection: If is an unmarked item, the oracle does nothing, otherwise:x
ωω −=fU
amplitu
de
0ψ
N
1
Items
1 2 3 4
00 01 10 11
Programming the Grover Algorithm – (III)
 We need a function such that: for the marked state:1)( =xf ω
Rotates 90º (on the basis )
Superposition  Changes to the basis
Superposition  Back to the basis  only qubit #2
Change state of qubit #2 (based on #1)
−+ ,
−+ ,
1,0
Programming the Grover Algorithm – (III)
 We need a function such that: for the marked state:1)( =xf ω
Superposition  qubit # 2 back to the basis
Rotates 90º (on the basis )
−+ ,
−+ ,
Programming the Grover Algorithm
 We now apply an additional reflection about the state .
 In the bra-ket notation this reflection is written as:
 This transformation maps the state to:
 and completes the transformation:
s
12 −= ssUs
'tsU ψ
tfst UU ψψ =+1
sU
amplitu
de
0ψ
Items
1 2 3 4
00 01 10 11
Programming the Grover Algorithm – (IV)
Programming the Grover Algorithm – (V)
Programming the Grover Algorithm – (VI)
Programming the Grover Algorithm – (VII)
Programming the Grover Algorithm – (VIII)
Programming the Grover Algorithm – (IX)
Programming the Grover Algorithm – (X)
 Getting the right oracle function :
For element
For element
For element
For element
10
11
fU
00
01
Programming the Grover Algorithm – Results
 The most probable state is |00>
Tools For Quantum Programming
QISKit OpenQASM
QISKit OpenQASM
What is OpenQASM?
An intermediate representation for Quantun Circuits
Hardware Agnostic
OPENQASM, or “Quantum Assembly Language,” is a simple
text representation that describes generic quantum circuits.
OpenQASM submit batch jobs via HTTP API/PYTHON wrapper.
QISKit API
Architecture
User Program *.py KISQit SDK
KISQit API Cient
Internet
Simulators QX2 QX4 QX16
User Program *.qasm
OpenQASM
Language Statements
IBMQASM 2.0;
qreg name[size];
creg name[size];
include "filename";
gate name(params) qargs { body }
opaque name(params) qargs;
U(theta,phi,lambda) qubit|qreg;
CX qubit|qreg,qubit|qreg;
measure qubit|qreg -> bit|creg;
reset qubit|qreg;
gatename(params) qargs;
if(creg==int) qop;
barrier qargs;
QISKit OpenQASM
Predefined Gates
// These are the predefined gates
U(theta,phi,lambda) qubit|qreg;
CX qubit|qreg,qubit|qreg;
New Gate Definition
// This is the definition
gate name(params) qargs
{
body
}
// This is an example
gate g a
{
U(0,0,0) a;
}
gate crz(theta) a,b
{
U(0,0,theta/2) a;
CX a,b;
U(0,0,-theta/2) b;
CX a,b;
U(0,0,theta/2) b;
}
crz(pi/2) q[0],q[1];
QISKit OpenQASM
Example: Quantum Fourier Transform// quantum Fourier
transform
IBMQASM 2.0;
include "qelib1.inc";
qreg q[4];
creg c[4];
x q[0];
x q[2];
barrier q;
h q[0];
cu1(pi/2) q[1],q[0];
h q[1];
cu1(pi/4) q[2],q[0];
cu1(pi/2) q[2],q[1];
h q[2];
cu1(pi/8) q[3],q[0];
cu1(pi/4) q[3],q[1];
cu1(pi/2) q[3],q[2];
h q[3];
measure q -> c;
 The quantum Fourier transform demonstrates parameter
passing to gate subroutines.
 This circuit applies the QFT to the state
and measures in the computational basis.
=3210 qqqq 0101
Tools For Quantum Programming
QISKit Python SDK
QISKit API
What is QISKit API?
 Access to IBM’s Quantum Experience using a Python interface.
 This interface allows working with quantum circuits and executing multiple
circuits in an efficient batch of experiments.
QISKit API
QISKit SDK Installation
1.Using pip python tool
• Install Anaconda (with Python3)
• Run Anaconda command line
• Execute pip install qiskit
1.Cloning github project
• Install Anaconda (with Python3)
• Clone github project:
git clone https://github.com/QISKit/qiskit-sdk-py
• Activate environment:
> activate QISKitenv
• Change to directory: qiskit-sdk-py and execute
.make env
QISKit API
Managing Packages with Anaconda
http://corochann.com/setup-python-environment-1395.html
QISKit API
Basic program elements:
The Quantum Program
QuantumProgram()
The Circuit
.create_circuit()
The Quantum Register
.create_quantum_registers()
The Classical Register
.create_classical_registers()
QISKit API
The Circuit
First, create the circuit
circuit = Q_program.get_circuit(“Circuit")
The Registers
 Quantum Registers
q2 = Q_program.create_quantum_registers("q2", 2)
 Classical Registers
c2 = Q_program.create_classical_registers("c2", 2)
QISKit API
The Gates
Adding Gates to the circuit
QISKit API
Extracting QASM code
QISKit API
Creating an entangled Bell state
1.Create Quantum Registers
q2 = Q_program.create_quantum_registers("q2", 2)
1.Create Classical Registers
c2 = Q_program.create_classical_registers("c2", 2)
Thanks

More Related Content

What's hot

Quantum computation: past-now-future - 2021-06-19
Quantum computation: past-now-future - 2021-06-19Quantum computation: past-now-future - 2021-06-19
Quantum computation: past-now-future - 2021-06-19Aritra Sarkar
 
Quantum computing for CS students: the unitary circuit model
Quantum computing for CS students: the unitary circuit modelQuantum computing for CS students: the unitary circuit model
Quantum computing for CS students: the unitary circuit modelBruno Fedrici, PhD
 
The second quantum revolution: the world beyond binary 0 and 1
The second quantum revolution: the world beyond binary 0 and 1The second quantum revolution: the world beyond binary 0 and 1
The second quantum revolution: the world beyond binary 0 and 1Bruno Fedrici, PhD
 
Quantum computing for CS students: open source software
Quantum computing for CS students: open source softwareQuantum computing for CS students: open source software
Quantum computing for CS students: open source softwareBruno Fedrici, PhD
 
Quantum computing, non-determinism, probabilistic systems... and the logic be...
Quantum computing, non-determinism, probabilistic systems... and the logic be...Quantum computing, non-determinism, probabilistic systems... and the logic be...
Quantum computing, non-determinism, probabilistic systems... and the logic be...Alejandro Díaz-Caro
 
Quantum algorithms for pattern matching in genomic sequences - 2018-06-22
Quantum algorithms for pattern matching in genomic sequences - 2018-06-22Quantum algorithms for pattern matching in genomic sequences - 2018-06-22
Quantum algorithms for pattern matching in genomic sequences - 2018-06-22Aritra Sarkar
 
What is Quantum Computing and Why it is Important
What is Quantum Computing and Why it is ImportantWhat is Quantum Computing and Why it is Important
What is Quantum Computing and Why it is ImportantSasha Lazarevic
 
Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computingt0pgun
 
Quantum computing - 2021-01-09
Quantum computing - 2021-01-09Quantum computing - 2021-01-09
Quantum computing - 2021-01-09Aritra Sarkar
 
Genomics algorithms on digital NISQ accelerators - 2019-01-25
Genomics algorithms on digital NISQ accelerators - 2019-01-25Genomics algorithms on digital NISQ accelerators - 2019-01-25
Genomics algorithms on digital NISQ accelerators - 2019-01-25Aritra Sarkar
 
NSC #2 - D1 05 - Renaud Lifchitz - Quantum computing in practice
NSC #2 - D1 05 - Renaud Lifchitz - Quantum computing in practiceNSC #2 - D1 05 - Renaud Lifchitz - Quantum computing in practice
NSC #2 - D1 05 - Renaud Lifchitz - Quantum computing in practiceNoSuchCon
 
Search and optimization on quantum accelerators - 2019-05-23
Search and optimization on quantum accelerators - 2019-05-23Search and optimization on quantum accelerators - 2019-05-23
Search and optimization on quantum accelerators - 2019-05-23Aritra Sarkar
 
Aritra Sarkar - Search and Optimisation Algorithms for Genomics on Quantum Ac...
Aritra Sarkar - Search and Optimisation Algorithms for Genomics on Quantum Ac...Aritra Sarkar - Search and Optimisation Algorithms for Genomics on Quantum Ac...
Aritra Sarkar - Search and Optimisation Algorithms for Genomics on Quantum Ac...Tom Hubregtsen
 
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23Aritra Sarkar
 
QX Simulator and quantum programming - 2020-04-28
QX Simulator and quantum programming - 2020-04-28QX Simulator and quantum programming - 2020-04-28
QX Simulator and quantum programming - 2020-04-28Aritra Sarkar
 

What's hot (20)

Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computing
 
Quantum computing
Quantum computingQuantum computing
Quantum computing
 
Quantum Roles in Quantum Computing
Quantum Roles in Quantum ComputingQuantum Roles in Quantum Computing
Quantum Roles in Quantum Computing
 
Quantum computation: past-now-future - 2021-06-19
Quantum computation: past-now-future - 2021-06-19Quantum computation: past-now-future - 2021-06-19
Quantum computation: past-now-future - 2021-06-19
 
Quantum computing for CS students: the unitary circuit model
Quantum computing for CS students: the unitary circuit modelQuantum computing for CS students: the unitary circuit model
Quantum computing for CS students: the unitary circuit model
 
The second quantum revolution: the world beyond binary 0 and 1
The second quantum revolution: the world beyond binary 0 and 1The second quantum revolution: the world beyond binary 0 and 1
The second quantum revolution: the world beyond binary 0 and 1
 
Quantum computing for CS students: open source software
Quantum computing for CS students: open source softwareQuantum computing for CS students: open source software
Quantum computing for CS students: open source software
 
Quantum computing, non-determinism, probabilistic systems... and the logic be...
Quantum computing, non-determinism, probabilistic systems... and the logic be...Quantum computing, non-determinism, probabilistic systems... and the logic be...
Quantum computing, non-determinism, probabilistic systems... and the logic be...
 
Quantum algorithms for pattern matching in genomic sequences - 2018-06-22
Quantum algorithms for pattern matching in genomic sequences - 2018-06-22Quantum algorithms for pattern matching in genomic sequences - 2018-06-22
Quantum algorithms for pattern matching in genomic sequences - 2018-06-22
 
What is Quantum Computing and Why it is Important
What is Quantum Computing and Why it is ImportantWhat is Quantum Computing and Why it is Important
What is Quantum Computing and Why it is Important
 
Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computing
 
Quantum computing - 2021-01-09
Quantum computing - 2021-01-09Quantum computing - 2021-01-09
Quantum computing - 2021-01-09
 
Genomics algorithms on digital NISQ accelerators - 2019-01-25
Genomics algorithms on digital NISQ accelerators - 2019-01-25Genomics algorithms on digital NISQ accelerators - 2019-01-25
Genomics algorithms on digital NISQ accelerators - 2019-01-25
 
NSC #2 - D1 05 - Renaud Lifchitz - Quantum computing in practice
NSC #2 - D1 05 - Renaud Lifchitz - Quantum computing in practiceNSC #2 - D1 05 - Renaud Lifchitz - Quantum computing in practice
NSC #2 - D1 05 - Renaud Lifchitz - Quantum computing in practice
 
Search and optimization on quantum accelerators - 2019-05-23
Search and optimization on quantum accelerators - 2019-05-23Search and optimization on quantum accelerators - 2019-05-23
Search and optimization on quantum accelerators - 2019-05-23
 
Aritra Sarkar - Search and Optimisation Algorithms for Genomics on Quantum Ac...
Aritra Sarkar - Search and Optimisation Algorithms for Genomics on Quantum Ac...Aritra Sarkar - Search and Optimisation Algorithms for Genomics on Quantum Ac...
Aritra Sarkar - Search and Optimisation Algorithms for Genomics on Quantum Ac...
 
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
 
Basanta jtr2009
Basanta jtr2009Basanta jtr2009
Basanta jtr2009
 
QX Simulator and quantum programming - 2020-04-28
QX Simulator and quantum programming - 2020-04-28QX Simulator and quantum programming - 2020-04-28
QX Simulator and quantum programming - 2020-04-28
 
02 analysis
02 analysis02 analysis
02 analysis
 

Similar to 2017 10 17_quantum_program_v2

Similar to 2017 10 17_quantum_program_v2 (20)

Quantum Computers
Quantum ComputersQuantum Computers
Quantum Computers
 
Des2017 quantum computing_final
Des2017 quantum computing_finalDes2017 quantum computing_final
Des2017 quantum computing_final
 
Quantum computing
Quantum computingQuantum computing
Quantum computing
 
Quantum computing
Quantum computingQuantum computing
Quantum computing
 
Quantum computing
Quantum computingQuantum computing
Quantum computing
 
Quantum computer
Quantum computerQuantum computer
Quantum computer
 
Quantum Computation simplified.pptx
Quantum Computation simplified.pptxQuantum Computation simplified.pptx
Quantum Computation simplified.pptx
 
Quantum Computing: The Why and How
Quantum Computing: The Why and HowQuantum Computing: The Why and How
Quantum Computing: The Why and How
 
OPTICALQuantum
OPTICALQuantumOPTICALQuantum
OPTICALQuantum
 
Documents
Documents Documents
Documents
 
Virus, Vaccines, Genes and Quantum - 2020-06-18
Virus, Vaccines, Genes and Quantum - 2020-06-18Virus, Vaccines, Genes and Quantum - 2020-06-18
Virus, Vaccines, Genes and Quantum - 2020-06-18
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
 
quantumComputers (1).ppt
quantumComputers (1).pptquantumComputers (1).ppt
quantumComputers (1).ppt
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
 
quantumComputers.pptICICI-An HR perspective
quantumComputers.pptICICI-An HR perspectivequantumComputers.pptICICI-An HR perspective
quantumComputers.pptICICI-An HR perspective
 

More from Francisco J. Gálvez Ramírez

More from Francisco J. Gálvez Ramírez (9)

2019 03 28_upv_computacion_cuantica_liderat
2019 03 28_upv_computacion_cuantica_liderat2019 03 28_upv_computacion_cuantica_liderat
2019 03 28_upv_computacion_cuantica_liderat
 
2019 03 28_upv_transformacion_digital_liderat
2019 03 28_upv_transformacion_digital_liderat2019 03 28_upv_transformacion_digital_liderat
2019 03 28_upv_transformacion_digital_liderat
 
Perfiles en Tecnologias Cuanticas
Perfiles en Tecnologias CuanticasPerfiles en Tecnologias Cuanticas
Perfiles en Tecnologias Cuanticas
 
2017 12 19_campus_madrid_the_age_of_quantumcomputing_final
2017 12 19_campus_madrid_the_age_of_quantumcomputing_final2017 12 19_campus_madrid_the_age_of_quantumcomputing_final
2017 12 19_campus_madrid_the_age_of_quantumcomputing_final
 
2017 09 07_programar_ordenadorcuanticov3
2017 09 07_programar_ordenadorcuanticov32017 09 07_programar_ordenadorcuanticov3
2017 09 07_programar_ordenadorcuanticov3
 
Evento univ30may quantumcomputing_final
Evento univ30may quantumcomputing_finalEvento univ30may quantumcomputing_final
Evento univ30may quantumcomputing_final
 
Breve historia de_la_computacion_cuantica
Breve historia de_la_computacion_cuanticaBreve historia de_la_computacion_cuantica
Breve historia de_la_computacion_cuantica
 
Introduccion algoritmoscuanticos
Introduccion algoritmoscuanticosIntroduccion algoritmoscuanticos
Introduccion algoritmoscuanticos
 
Lenguajes para programación cuántica
Lenguajes para programación cuánticaLenguajes para programación cuántica
Lenguajes para programación cuántica
 

Recently uploaded

Gas-ExchangeS-in-Plants-and-Animals.pptx
Gas-ExchangeS-in-Plants-and-Animals.pptxGas-ExchangeS-in-Plants-and-Animals.pptx
Gas-ExchangeS-in-Plants-and-Animals.pptxGiovaniTrinidad
 
Combining Asynchronous Task Parallelism and Intel SGX for Secure Deep Learning
Combining Asynchronous Task Parallelism and Intel SGX for Secure Deep LearningCombining Asynchronous Task Parallelism and Intel SGX for Secure Deep Learning
Combining Asynchronous Task Parallelism and Intel SGX for Secure Deep Learningvschiavoni
 
final waves properties grade 7 - third quarter
final waves properties grade 7 - third quarterfinal waves properties grade 7 - third quarter
final waves properties grade 7 - third quarterHanHyoKim
 
Science (Communication) and Wikipedia - Potentials and Pitfalls
Science (Communication) and Wikipedia - Potentials and PitfallsScience (Communication) and Wikipedia - Potentials and Pitfalls
Science (Communication) and Wikipedia - Potentials and PitfallsDobusch Leonhard
 
KDIGO-2023-CKD-Guideline-Public-Review-Draft_5-July-2023.pdf
KDIGO-2023-CKD-Guideline-Public-Review-Draft_5-July-2023.pdfKDIGO-2023-CKD-Guideline-Public-Review-Draft_5-July-2023.pdf
KDIGO-2023-CKD-Guideline-Public-Review-Draft_5-July-2023.pdfGABYFIORELAMALPARTID1
 
Oxo-Acids of Halogens and their Salts.pptx
Oxo-Acids of Halogens and their Salts.pptxOxo-Acids of Halogens and their Salts.pptx
Oxo-Acids of Halogens and their Salts.pptxfarhanvvdk
 
办理麦克马斯特大学毕业证成绩单|购买加拿大文凭证书
办理麦克马斯特大学毕业证成绩单|购买加拿大文凭证书办理麦克马斯特大学毕业证成绩单|购买加拿大文凭证书
办理麦克马斯特大学毕业证成绩单|购买加拿大文凭证书zdzoqco
 
Charateristics of the Angara-A5 spacecraft launched from the Vostochny Cosmod...
Charateristics of the Angara-A5 spacecraft launched from the Vostochny Cosmod...Charateristics of the Angara-A5 spacecraft launched from the Vostochny Cosmod...
Charateristics of the Angara-A5 spacecraft launched from the Vostochny Cosmod...Christina Parmionova
 
Abnormal LFTs rate of deco and NAFLD.pptx
Abnormal LFTs rate of deco and NAFLD.pptxAbnormal LFTs rate of deco and NAFLD.pptx
Abnormal LFTs rate of deco and NAFLD.pptxzeus70441
 
bonjourmadame.tumblr.com bhaskar's girls
bonjourmadame.tumblr.com bhaskar's girlsbonjourmadame.tumblr.com bhaskar's girls
bonjourmadame.tumblr.com bhaskar's girlshansessene
 
Fertilization: Sperm and the egg—collectively called the gametes—fuse togethe...
Fertilization: Sperm and the egg—collectively called the gametes—fuse togethe...Fertilization: Sperm and the egg—collectively called the gametes—fuse togethe...
Fertilization: Sperm and the egg—collectively called the gametes—fuse togethe...D. B. S. College Kanpur
 
6.2 Pests of Sesame_Identification_Binomics_Dr.UPR
6.2 Pests of Sesame_Identification_Binomics_Dr.UPR6.2 Pests of Sesame_Identification_Binomics_Dr.UPR
6.2 Pests of Sesame_Identification_Binomics_Dr.UPRPirithiRaju
 
complex analysis best book for solving questions.pdf
complex analysis best book for solving questions.pdfcomplex analysis best book for solving questions.pdf
complex analysis best book for solving questions.pdfSubhamKumar3239
 
The Sensory Organs, Anatomy and Function
The Sensory Organs, Anatomy and FunctionThe Sensory Organs, Anatomy and Function
The Sensory Organs, Anatomy and FunctionJadeNovelo1
 
LESSON PLAN IN SCIENCE GRADE 4 WEEK 1 DAY 2
LESSON PLAN IN SCIENCE GRADE 4 WEEK 1 DAY 2LESSON PLAN IN SCIENCE GRADE 4 WEEK 1 DAY 2
LESSON PLAN IN SCIENCE GRADE 4 WEEK 1 DAY 2AuEnriquezLontok
 
Observation of Gravitational Waves from the Coalescence of a 2.5–4.5 M⊙ Compa...
Observation of Gravitational Waves from the Coalescence of a 2.5–4.5 M⊙ Compa...Observation of Gravitational Waves from the Coalescence of a 2.5–4.5 M⊙ Compa...
Observation of Gravitational Waves from the Coalescence of a 2.5–4.5 M⊙ Compa...Sérgio Sacani
 
DECOMPOSITION PATHWAYS of TM-alkyl complexes.pdf
DECOMPOSITION PATHWAYS of TM-alkyl complexes.pdfDECOMPOSITION PATHWAYS of TM-alkyl complexes.pdf
DECOMPOSITION PATHWAYS of TM-alkyl complexes.pdfDivyaK787011
 
Loudspeaker- direct radiating type and horn type.pptx
Loudspeaker- direct radiating type and horn type.pptxLoudspeaker- direct radiating type and horn type.pptx
Loudspeaker- direct radiating type and horn type.pptxpriyankatabhane
 

Recently uploaded (20)

Gas-ExchangeS-in-Plants-and-Animals.pptx
Gas-ExchangeS-in-Plants-and-Animals.pptxGas-ExchangeS-in-Plants-and-Animals.pptx
Gas-ExchangeS-in-Plants-and-Animals.pptx
 
Combining Asynchronous Task Parallelism and Intel SGX for Secure Deep Learning
Combining Asynchronous Task Parallelism and Intel SGX for Secure Deep LearningCombining Asynchronous Task Parallelism and Intel SGX for Secure Deep Learning
Combining Asynchronous Task Parallelism and Intel SGX for Secure Deep Learning
 
final waves properties grade 7 - third quarter
final waves properties grade 7 - third quarterfinal waves properties grade 7 - third quarter
final waves properties grade 7 - third quarter
 
Science (Communication) and Wikipedia - Potentials and Pitfalls
Science (Communication) and Wikipedia - Potentials and PitfallsScience (Communication) and Wikipedia - Potentials and Pitfalls
Science (Communication) and Wikipedia - Potentials and Pitfalls
 
KDIGO-2023-CKD-Guideline-Public-Review-Draft_5-July-2023.pdf
KDIGO-2023-CKD-Guideline-Public-Review-Draft_5-July-2023.pdfKDIGO-2023-CKD-Guideline-Public-Review-Draft_5-July-2023.pdf
KDIGO-2023-CKD-Guideline-Public-Review-Draft_5-July-2023.pdf
 
Oxo-Acids of Halogens and their Salts.pptx
Oxo-Acids of Halogens and their Salts.pptxOxo-Acids of Halogens and their Salts.pptx
Oxo-Acids of Halogens and their Salts.pptx
 
办理麦克马斯特大学毕业证成绩单|购买加拿大文凭证书
办理麦克马斯特大学毕业证成绩单|购买加拿大文凭证书办理麦克马斯特大学毕业证成绩单|购买加拿大文凭证书
办理麦克马斯特大学毕业证成绩单|购买加拿大文凭证书
 
Charateristics of the Angara-A5 spacecraft launched from the Vostochny Cosmod...
Charateristics of the Angara-A5 spacecraft launched from the Vostochny Cosmod...Charateristics of the Angara-A5 spacecraft launched from the Vostochny Cosmod...
Charateristics of the Angara-A5 spacecraft launched from the Vostochny Cosmod...
 
Abnormal LFTs rate of deco and NAFLD.pptx
Abnormal LFTs rate of deco and NAFLD.pptxAbnormal LFTs rate of deco and NAFLD.pptx
Abnormal LFTs rate of deco and NAFLD.pptx
 
bonjourmadame.tumblr.com bhaskar's girls
bonjourmadame.tumblr.com bhaskar's girlsbonjourmadame.tumblr.com bhaskar's girls
bonjourmadame.tumblr.com bhaskar's girls
 
Interferons.pptx.
Interferons.pptx.Interferons.pptx.
Interferons.pptx.
 
Fertilization: Sperm and the egg—collectively called the gametes—fuse togethe...
Fertilization: Sperm and the egg—collectively called the gametes—fuse togethe...Fertilization: Sperm and the egg—collectively called the gametes—fuse togethe...
Fertilization: Sperm and the egg—collectively called the gametes—fuse togethe...
 
6.2 Pests of Sesame_Identification_Binomics_Dr.UPR
6.2 Pests of Sesame_Identification_Binomics_Dr.UPR6.2 Pests of Sesame_Identification_Binomics_Dr.UPR
6.2 Pests of Sesame_Identification_Binomics_Dr.UPR
 
complex analysis best book for solving questions.pdf
complex analysis best book for solving questions.pdfcomplex analysis best book for solving questions.pdf
complex analysis best book for solving questions.pdf
 
The Sensory Organs, Anatomy and Function
The Sensory Organs, Anatomy and FunctionThe Sensory Organs, Anatomy and Function
The Sensory Organs, Anatomy and Function
 
LESSON PLAN IN SCIENCE GRADE 4 WEEK 1 DAY 2
LESSON PLAN IN SCIENCE GRADE 4 WEEK 1 DAY 2LESSON PLAN IN SCIENCE GRADE 4 WEEK 1 DAY 2
LESSON PLAN IN SCIENCE GRADE 4 WEEK 1 DAY 2
 
Observation of Gravitational Waves from the Coalescence of a 2.5–4.5 M⊙ Compa...
Observation of Gravitational Waves from the Coalescence of a 2.5–4.5 M⊙ Compa...Observation of Gravitational Waves from the Coalescence of a 2.5–4.5 M⊙ Compa...
Observation of Gravitational Waves from the Coalescence of a 2.5–4.5 M⊙ Compa...
 
PLASMODIUM. PPTX
PLASMODIUM. PPTXPLASMODIUM. PPTX
PLASMODIUM. PPTX
 
DECOMPOSITION PATHWAYS of TM-alkyl complexes.pdf
DECOMPOSITION PATHWAYS of TM-alkyl complexes.pdfDECOMPOSITION PATHWAYS of TM-alkyl complexes.pdf
DECOMPOSITION PATHWAYS of TM-alkyl complexes.pdf
 
Loudspeaker- direct radiating type and horn type.pptx
Loudspeaker- direct radiating type and horn type.pptxLoudspeaker- direct radiating type and horn type.pptx
Loudspeaker- direct radiating type and horn type.pptx
 

2017 10 17_quantum_program_v2

  • 1. Quantum Programming A New Approach to Solve Complex Problems Francisco Gálvez Ramirez IBM Staff fjgramirez@es.ibm.com
  • 2. Introducing myself Francisco Gálvez BS in Experimental Physics (UV) Master in Advanced Physics (UV) Cloud and Integrated Systems Expert fjgramirez@es.ibm.com @fjgramirez Francisco J. Galvez Ramirez
  • 3. Agenda  Why Quantum Computation  The IBM Quantum Computer  Quantum Algorithms  How to Program a Quantum Computer  Tools for Quantum Computing
  • 5. Why Quantum Computation ? “...nature isn't classical, dammit, and if you want to make a simulation of nature, you'd better make it quantum mechanical...” – Richard Feynman, Simulating Physics with Computers
  • 6. Why Quantum Computation ? A qubit is the quantum concept of a bit. 0 1  It’s not any element or device. It’s a logical concept that can be implemented on a wide range of different systems with quantum behaviour  As a bit, a single qubit can represent two states 0 and 1 But additionally a qubit is able to manage all possible combinations amont base states 0 and 1 10 βα + 10 βαψ += What is a Qubit?
  • 7. Why Quantum Computation ? Spin Qubits – Electron or nuclear spins on a solid Substract. Superconducting Circuits – currents superposition around a superconductor. Ion’s Traps– Trap ions in electric fields Photonic Circuits – The qubits are photons driven in in silicon circuits. Qubit Implementation
  • 8. Why Quantum Computation ?  2 BITS 0 1 0 0 0 1 0 1 A 0 0 + B 1 0 + C 0 1 + D 1 1 1 0 0 1 1 1  2 QUBITS One state made of a combination of every possible state of the system Quantum Superposition
  • 9. Why Quantum Computation ? Quantum Entanglement 1. Preparing an entangled states. An entangled stated can be prepared by applying a common operation to the system. 2. Measurement 0 1
  • 10. The IBM Quantum Computer
  • 11. March - 2016: Quantum Computing in the Cloud  IBM scientists have built a quantum processor that any user can access through the first quantum computing platform available in the cloud.  IBM Quantum Experience, allows users to execute algorithms and experiments on a real quantum processor
  • 12. Marzo-2017: IBM announces IBM Q IBM Q is the new line of Quantum Computers IBM announces the building of a quantum computer of 50 qubits and that will offer services of quantum computation in the cloud
  • 13. Mayo-2017: First Commercial Quantum Computer 16 and 17 qubits universal quantum computers IBM announces a prototype of 17 qubits commercial quantum computing IBM has discovered how to scale quantum architecture In three years it is planned to reach 50 qubits
  • 14. IBM Superconducting Qubits Arquitecture IBM's new 17-qubit quantum computer.
  • 15. Coherence Times • Coherence in IBM today is about 100 microseconds • There are several initiatives to improve the coherence times: • Different materials • Redesign of geometries • Cavity Quality • IR Shielding • Important progress has been made in the last decade
  • 17. The Dilution Refrigerator  A key piece of the Quantum Computer is the Dilution Refrigerator Working Temperature 15 mK Dilution Refrigerator 3 He + 4 He
  • 18.
  • 20. Quantum Algorithms • Deusch Algorithm – Determines whether a funcion is balanced or unbalanced • Shor Algorithm – Large numbers factorization • Grover Algoritm – Search in unstructured spaces
  • 21. Deustch Algorithm f1: 0 0 1 0 f2: 0 1 1 1 Deustch-Josza Algorithm  Extends Deustch’s algorithm to n value registers f3: 0 0 1 1 f4: 0 1 1 0
  • 22. Shor Algorithm • Number of steps that a classic computer needs to run in order to find the prime factors of a number N of x digits It grows exponencially with x • The Shor algorithm is made up of two parts: 1. One Classical part - Which focuses on finding the period of a function 2. A quantum part based on QFT technics In 2001, IBM and Stanford University, executed for the first time the Shor algorithm in the first quantum computer of 7 qubits developed in Los Álamos. https://www-03.ibm.com/press/us/en/pressrelease/965.wss
  • 23. Grover Algorithm • How many attempts need a data search in an unordered N- element database to locate a particular element? An average of N/2 attemps are needed) http://www.dma.eui.upm.es/MatDis/Seminario4/AlgoritmoGrover.pdf • A Quantum Computer executing the Grover Algorithm would run attempsN
  • 24. How To Program A Quantum Computer?
  • 25. Quantum Circuits The Circuit Model Gates execution time ~ 25 ns ~25 ns~25 ns ~25 ns ... ... ... ... ... Coherence time 100 ms measurement
  • 26. Quantum Operations X-Gate Flips a qubit from a 0 to a 1, or vice versa. Hadamard Gate Puts a qubit into a superposition of states. Flips a second qubit only if the first qubit is 1. Controlled Not Gate Entanglement H gate puts the first qubit in a superposition. CNOT gate both flips and does not flip the second qubit. Assuming the qubits start as 0, when measured, they will be 11 or 00, but never 10 or 01.
  • 27. Quantum Operations  It is a basic circuit that acts on one or several qubits  It is equivalent to logical gates in digital circuits Quantum Gates 1. Quantum Gates are Reversible 2. Matematically are represented by unitary matrices. 3. The qubits upon they act keep their quantum nature.       − = 11 11 2 1             = 0100 1000 0010 0001 = Hadamard Gate C-NOT Gate       = 01 10 X - Gate
  • 28. NOT Gate  Transforms the state in the state and viceversa  It means a rotation of π radians around X axis 0 1 Change of state One Qubit Quantum Gates
  • 29. One Qubit Quantum Gates Hadamard Gate  It transforms any of the base states or in a combination of both  It means a rotation of π/2 radians around X axis and Z axis Superposition of base states 0 1 It cannot be meassured on Z axis, but we can use an H gate to change the basis
  • 30. One Qubit Quantum Gates The Z Gate Cambio de Fase - π  It runs a rotation of π radians around Z axis
  • 31. One Qubit Quantum Gates The S Gate Phase Shift: – π/2  It run a rotation of π/2 radians around Z axis
  • 32. One Qubit Quantum Gates The S Gate Phase Shift: – π/4  It runs a rotation of π/4 radians around Z axis
  • 33. Two Qubit Quantum Gates The CNOT Gate Flips the target qubit, depending on the state of the control qubit
  • 34. Gates with more than two qubits The Toffoli Gate Flips the target qubit, depending on the state of two control qubits control 1 control 2 target
  • 35. User Defined Gates Gates with more than two qubits ( ) ( ) ( )λλλ zRUu == ,0,0:11 2 3 ( ) ( ) ( )       −      +== 2 2 2 ,,2:,2 π λπ π φλφπλφ zxz RRRUu ( ) ( ) ( ) ( ) ( ) ( ) ( )λππθππφλφθλφθ zxzxz RRRRRUu 223,,:,,3 ++==
  • 36. User Defined Control Gates Gates with more than two qubits 1 1 if(q0==1) U1 q1; if(q0==1 and q1==1) U1 q2;
  • 38. Quantum Operations The Bloch Sphere  Standard Basis is not enough to specify a quantum State.  We need to specify a phase as well.  Bloch Sphere depicts the amplitudes and the phase of one state. 1 2 0 2 cos       +      = θθ ψ φ senei  There’s a one-to-one correspondence between pure qubits states and the points on the surface on a unit sphere 2 C 3 R
  • 39. Quantum Operations The Qsphere Qsphere shows states of more than 1 qubit For 1 qubit  2 points For 2 qubit  3 points for n qubit  (n+1) points  Each line from the center is possible outcome  Allows to distinguish classical states from entangled states • A classical state will have a single line pointing in one direction • A superposition of two basis states will have two lines pointing in two directions of half weight.
  • 40. Tools For Quantum Programming
  • 41. Tools for Quantum Programming IBM Quantum Experience Visual interface, Drag and Drop for 5 qubits QISKit OpenQASM Asembler Language for representing Quantum Circuits QISKit API Python API to create and execute Quantum Circuits
  • 42. Tools For Quantum Programming IBM Quantum Experience QX2, QX4
  • 46. Creating Scores  Graphical Interface used to create programs for the quantum processor  It allows to create quantum circuits using a logical gates library and well defined points of measurement
  • 47. Running Scores  Bar Chart • 0’s & 1’s combination in the bottom means the measured Qubit state. • The height of the bar represents how often that particular state occurs
  • 48. Tools For Quantum Programming IBM Quantum Experience QX2, QX4 Grover Algorithm
  • 49. 1 2 3 4 ... ... N=2nω Programming the Grover Algorithm – (I)  A list of N item and there’s one item with a unique property that we wish to locate  A classical computation needs to check on average of this boxes2N  On a quantum computer, using the Grover’s algorithm it can be done in aprox. stepsN 1 2 3 4 Lets do it for N = 4
  • 50. Programming the Grover Algorithm – (II) ∑ − = = 1 0 1 N x x N s  At the beginning we have a uniform superposition amplitu de 0ψ N 1 Items1 2 3 4 00 01 10 11
  • 51. Programming the Grover Algorithm – (III)  We need a function such that: for the marked state:1)( =xf ω  In that way we build the “oracle” matrix: fU ( ) xxU xf f )( 1−=  Applying the oracle reflection: If is an unmarked item, the oracle does nothing, otherwise:x ωω −=fU amplitu de 0ψ N 1 Items 1 2 3 4 00 01 10 11
  • 52. Programming the Grover Algorithm – (III)  We need a function such that: for the marked state:1)( =xf ω Rotates 90º (on the basis ) Superposition  Changes to the basis Superposition  Back to the basis  only qubit #2 Change state of qubit #2 (based on #1) −+ , −+ , 1,0
  • 53. Programming the Grover Algorithm – (III)  We need a function such that: for the marked state:1)( =xf ω Superposition  qubit # 2 back to the basis Rotates 90º (on the basis ) −+ , −+ ,
  • 54. Programming the Grover Algorithm  We now apply an additional reflection about the state .  In the bra-ket notation this reflection is written as:  This transformation maps the state to:  and completes the transformation: s 12 −= ssUs 'tsU ψ tfst UU ψψ =+1 sU amplitu de 0ψ Items 1 2 3 4 00 01 10 11
  • 55. Programming the Grover Algorithm – (IV)
  • 56. Programming the Grover Algorithm – (V)
  • 57. Programming the Grover Algorithm – (VI)
  • 58. Programming the Grover Algorithm – (VII)
  • 59. Programming the Grover Algorithm – (VIII)
  • 60. Programming the Grover Algorithm – (IX)
  • 61. Programming the Grover Algorithm – (X)  Getting the right oracle function : For element For element For element For element 10 11 fU 00 01
  • 62. Programming the Grover Algorithm – Results  The most probable state is |00>
  • 63. Tools For Quantum Programming QISKit OpenQASM
  • 64. QISKit OpenQASM What is OpenQASM? An intermediate representation for Quantun Circuits Hardware Agnostic OPENQASM, or “Quantum Assembly Language,” is a simple text representation that describes generic quantum circuits. OpenQASM submit batch jobs via HTTP API/PYTHON wrapper.
  • 65. QISKit API Architecture User Program *.py KISQit SDK KISQit API Cient Internet Simulators QX2 QX4 QX16 User Program *.qasm
  • 66. OpenQASM Language Statements IBMQASM 2.0; qreg name[size]; creg name[size]; include "filename"; gate name(params) qargs { body } opaque name(params) qargs; U(theta,phi,lambda) qubit|qreg; CX qubit|qreg,qubit|qreg; measure qubit|qreg -> bit|creg; reset qubit|qreg; gatename(params) qargs; if(creg==int) qop; barrier qargs;
  • 67. QISKit OpenQASM Predefined Gates // These are the predefined gates U(theta,phi,lambda) qubit|qreg; CX qubit|qreg,qubit|qreg; New Gate Definition // This is the definition gate name(params) qargs { body } // This is an example gate g a { U(0,0,0) a; } gate crz(theta) a,b { U(0,0,theta/2) a; CX a,b; U(0,0,-theta/2) b; CX a,b; U(0,0,theta/2) b; } crz(pi/2) q[0],q[1];
  • 68. QISKit OpenQASM Example: Quantum Fourier Transform// quantum Fourier transform IBMQASM 2.0; include "qelib1.inc"; qreg q[4]; creg c[4]; x q[0]; x q[2]; barrier q; h q[0]; cu1(pi/2) q[1],q[0]; h q[1]; cu1(pi/4) q[2],q[0]; cu1(pi/2) q[2],q[1]; h q[2]; cu1(pi/8) q[3],q[0]; cu1(pi/4) q[3],q[1]; cu1(pi/2) q[3],q[2]; h q[3]; measure q -> c;  The quantum Fourier transform demonstrates parameter passing to gate subroutines.  This circuit applies the QFT to the state and measures in the computational basis. =3210 qqqq 0101
  • 69. Tools For Quantum Programming QISKit Python SDK
  • 70. QISKit API What is QISKit API?  Access to IBM’s Quantum Experience using a Python interface.  This interface allows working with quantum circuits and executing multiple circuits in an efficient batch of experiments.
  • 71. QISKit API QISKit SDK Installation 1.Using pip python tool • Install Anaconda (with Python3) • Run Anaconda command line • Execute pip install qiskit 1.Cloning github project • Install Anaconda (with Python3) • Clone github project: git clone https://github.com/QISKit/qiskit-sdk-py • Activate environment: > activate QISKitenv • Change to directory: qiskit-sdk-py and execute .make env
  • 72. QISKit API Managing Packages with Anaconda http://corochann.com/setup-python-environment-1395.html
  • 73. QISKit API Basic program elements: The Quantum Program QuantumProgram() The Circuit .create_circuit() The Quantum Register .create_quantum_registers() The Classical Register .create_classical_registers()
  • 74. QISKit API The Circuit First, create the circuit circuit = Q_program.get_circuit(“Circuit") The Registers  Quantum Registers q2 = Q_program.create_quantum_registers("q2", 2)  Classical Registers c2 = Q_program.create_classical_registers("c2", 2)
  • 75. QISKit API The Gates Adding Gates to the circuit
  • 77. QISKit API Creating an entangled Bell state 1.Create Quantum Registers q2 = Q_program.create_quantum_registers("q2", 2) 1.Create Classical Registers c2 = Q_program.create_classical_registers("c2", 2)

Editor's Notes

  1. To try this out for yourself, go into the Composer and create a new experiment with three qubits. Drag a pink measurement gate over to each of them and click “Run” or “Simulate.” At this point, there should be only one possible outcome, 000. That’s because all of the qubits began in the state and we haven’t changed them with any gates. Now, drag a blue H gate to each of the qubits before the measurement. The H gate puts each of the qubits into an equal superposition state. Now you should see that there are many more possible outcomes. We’ll go into more detail about the H gate in a later section.
  2. IBMQASM 2.0; Denotes a le in IBM QASM formata IBMQASM 2.0; qreg name[size]; Declare a named register of qubits qreg q[5]; creg name[size]; Declare a named register of bits creg c[5]; include "filename"; Open and parse another source le include "qelib1.inc"; gate name(params) qargs { body } Declare a unitary gate (see text) opaque name(params) qargs; Declare an opaque gate (see text) // comment text Comment a line of text // oops! U(theta,phi,lambda) qubit|qreg; Apply built-in single qubit gate(s)b U(pi/2,2*pi/3,0) q[0]; CX qubit|qreg,qubit|qreg; Apply built-in CNOT gate(s) CX q[0],q[1]; measure qubit|qreg -> bit|creg; Make measurement(s) in Z basis measure q -> c; reset qubit|qreg; Prepare qubit(s) in j0i reset q[0]; gatename(params) qargs; Apply a user-dened unitary gate crz(pi/2) q[1],q[0]; if(creg==int) qop; Conditionally apply quantum operation if(c==5) CX q[0],q[1]; barrier qargs; Prevent transformations across this source line