+ All Categories
Home > Technology > 2017 07 04_cmmse_quantum_programming_v1

2017 07 04_cmmse_quantum_programming_v1

Date post: 22-Jan-2018
Category:
Upload: francisco-j-galvez-ramirez
View: 183 times
Download: 0 times
Share this document with a friend
55
Quantum Programming A New Approach to Solve Complex Problems Francisco Gálvez Ramirez IBM Staff [email protected]
Transcript
Page 1: 2017 07 04_cmmse_quantum_programming_v1

Quantum ProgrammingA New Approach to Solve Complex Problems

Francisco Gálvez RamirezIBM Staff

[email protected]

Page 2: 2017 07 04_cmmse_quantum_programming_v1
Page 3: 2017 07 04_cmmse_quantum_programming_v1

Introducing myself

Francisco Gálvez

BS in Experimental Physics (UV)Master in Advanced Physics (UV)

Cloud and Integrated Systems Expert

[email protected]

@fjgramirez

Francisco J. Galvez Ramirez

Page 4: 2017 07 04_cmmse_quantum_programming_v1

Agenda

Why Quantum Computation

The IBM Quantum Computer

Quantum Algorithms

How to Program a Quantum Computer

Tools for Quantum Computing

Page 5: 2017 07 04_cmmse_quantum_programming_v1

Why Quantum Computation ?

Page 6: 2017 07 04_cmmse_quantum_programming_v1

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

Page 7: 2017 07 04_cmmse_quantum_programming_v1

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?

Page 8: 2017 07 04_cmmse_quantum_programming_v1

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

Page 9: 2017 07 04_cmmse_quantum_programming_v1

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

Page 10: 2017 07 04_cmmse_quantum_programming_v1

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

Page 11: 2017 07 04_cmmse_quantum_programming_v1

The IBM Quantum Computer

Page 12: 2017 07 04_cmmse_quantum_programming_v1

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

Page 13: 2017 07 04_cmmse_quantum_programming_v1

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

Page 14: 2017 07 04_cmmse_quantum_programming_v1

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

Page 15: 2017 07 04_cmmse_quantum_programming_v1

IBM Superconducting Qubits Arquitecture

IBM's new 17-qubit quantum computer.

Page 16: 2017 07 04_cmmse_quantum_programming_v1

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

Page 17: 2017 07 04_cmmse_quantum_programming_v1

The Quantum Volume

Page 18: 2017 07 04_cmmse_quantum_programming_v1

The Dilution Refrigerator

A key piece of the Quantum Computer is the Dilution Refrigerator

Working Temperature 15 mK Dilution Refrigerator 3He + 4He

Page 19: 2017 07 04_cmmse_quantum_programming_v1
Page 20: 2017 07 04_cmmse_quantum_programming_v1

Some Quantum Algorithms

Page 21: 2017 07 04_cmmse_quantum_programming_v1

Quantum Algorithms

• Deusch Algorithm – Determines whether a funcion is balanced or unbalanced

• Shor Algorithm – Large numbers factorization

• Grover Algoritm – Search in unstructured spaces

Page 22: 2017 07 04_cmmse_quantum_programming_v1

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

Page 23: 2017 07 04_cmmse_quantum_programming_v1

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

Page 24: 2017 07 04_cmmse_quantum_programming_v1

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

Page 25: 2017 07 04_cmmse_quantum_programming_v1

How To Program A Quantum Computer?

Page 26: 2017 07 04_cmmse_quantum_programming_v1

Quantum Circuits

The Circuit Model

Gates execution time ~ 25 ns~25 ns~25 ns ~25 ns ... ... ... ... ...

Coherence time 100 ms

measurement

Page 27: 2017 07 04_cmmse_quantum_programming_v1

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.

Page 28: 2017 07 04_cmmse_quantum_programming_v1

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 GateC-NOT Gate

=

01

10

X - Gate

Page 29: 2017 07 04_cmmse_quantum_programming_v1

Quantum Operations

Quantum Gates Set

Page 30: 2017 07 04_cmmse_quantum_programming_v1

Tools For Quantum Programming

Page 31: 2017 07 04_cmmse_quantum_programming_v1

Tools for Quantum Programming

IBM Quantum ExperienceVisual interface, Drag and Drop for 5 qubits

QISKit OpenQASMAsembler Language for representing Quantum Circuits

QISKit APIPython API to create and execute Quantum Circuits

Page 32: 2017 07 04_cmmse_quantum_programming_v1

IBM Quantum Experience

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

Page 33: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (I)

A list of N item and there’s one item with a unique property that we wish to locate

1 2 3 4 ... ... N=2nω

A classical computation needs to check on average of this boxes 2N

On a quantum computer, using the Grover’s algorithm it can be done in aprox. steps N

Page 34: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (II)

∑−

=

=1

0

1 N

x

xN

s

At the beginning we have a uniform superposition

amplitu

de

N

1

Items1 2 3 ( .... )

Page 35: 2017 07 04_cmmse_quantum_programming_v1

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 xff

)(1−=

Applying the oracle reflection: If is an unmarked item, the oracle does nothing, otherwise: x

ωω −=fU

amplitu

de

N

1

Items1 2 3 ( .... )

Page 36: 2017 07 04_cmmse_quantum_programming_v1

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 −= ssU s

'tsU ψ

tfst UU ψψ =+1

amplitude

Items1 2 3 ( .... )

sU

Page 37: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (IV)

Page 38: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (V)

Page 39: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (VI)

Page 40: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (VII)

Page 41: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (VIII)

Page 42: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (IX)

Page 43: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – (X)

Getting the right oracle function :

For element

For element

For element

For element

00

fU

10

11

fU

Page 44: 2017 07 04_cmmse_quantum_programming_v1

Programming the Grover Algorithm – Results

asdf

Page 45: 2017 07 04_cmmse_quantum_programming_v1

QISKit OpenQASM

What is OpenQASM?

An intermediate representation for Quantun CircuitsHardware AgnosticOPENQASM, or “Quantum Assembly Language,” is a simple text representation that describes generic quantum circuits.OpenQASM submit batch jobs via HTTP API/PYTHON wrapper.

Page 46: 2017 07 04_cmmse_quantum_programming_v1

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;

Page 47: 2017 07 04_cmmse_quantum_programming_v1

QISKit OpenQASM

Predefined Gates

// These are the predefined gatesU(theta,phi,lambda) qubit|qreg;CX qubit|qreg,qubit|qreg;

New Gate Definition

// This is the definitiongate name(params) qargs{ body}// This is an examplegate 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];

Page 48: 2017 07 04_cmmse_quantum_programming_v1

QISKit OpenQASM

Example: Quantum Fourier Transform// quantum Fourier transformIBMQASM 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

Page 49: 2017 07 04_cmmse_quantum_programming_v1

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.

Page 50: 2017 07 04_cmmse_quantum_programming_v1

QISKit API

Basic program elements:

The Quantum ProgramQuantumProgram()

The Circuit.create_circuit()

The Quantum Register.create_quantum_registers()

The Classical Register.create_classical_registers()

Page 51: 2017 07 04_cmmse_quantum_programming_v1

QISKit API

The CircuitFirst, create the circuit

circuit = Q_program.get_circuit(“Circuit")

The Registers Quantum Registers

q2 = Q_program.create_quantum_registers("q2", 2)

Classical Registersc2 = Q_program.create_classical_registers("c2", 2)

Page 52: 2017 07 04_cmmse_quantum_programming_v1

QISKit API

The GatesAdding Gates to the circuit

Page 53: 2017 07 04_cmmse_quantum_programming_v1

QISKit APIExtracting QASM code

Page 54: 2017 07 04_cmmse_quantum_programming_v1

QISKit API

Creating an entangled Bell state

1.Create Quantum Registersq2 = Q_program.create_quantum_registers("q2", 2)

1.Create Classical Registersc2 = Q_program.create_classical_registers("c2", 2)

Page 55: 2017 07 04_cmmse_quantum_programming_v1

Thanks


Recommended