James L. Weaver
Developer Advocate


jweaver@pivotal.io
JavaFXpert.com

@JavaFXpert

Dr. Johan Vos
Co-founder & CTO


johan.vos@gluonhq.com
gluonhq.com

@JohanVos

Quantum Computing

Hacking into Nature's Computer

About Presenter James Weaver

Java Champion, JavaOne Rockstar, plays well with others, etc :-)

Author of several Java/JavaFX/RaspPi books

Developer Advocate & International Speaker for Pivotal

Mission: "Transform how the world builds software"

Mission: "Transform how the world builds software"

About Presenter Dr. Johan Vos

Developer / Physicist / Writer / Speaker -  Gluon

About Gluon

Gluon CloudLink

Concepts we'll address today

Introduction to quantum computing

Axioms of quantum mechanics (with cats)

  • Superposition principle
  • Measurement
  • Unitary evolution

Abstracting cats with qubits

Quantum computing gates and circuits

Java and quantum computing

History repeating itself

massive hardware, limited bits, software infancy

Quantum computers make direct use of quantum-mechanical phenomena, such as superposition and entanglement, to perform operations on data.

Some QC proofs of concept

University of Sussex

Professor Winfried Hensinger spoke at Devoxx/UK

mini-universe in your garage

Don't try this at home, kids!

Why use a quantum computer?

Feasible on classical computers

Feasible on quantum computers

Solutions to problems

some problems may be solved exponentially faster

Transistors can't get much smaller

the quantum tunneling struggle is real

Breaking RSA crypto

someday maybe, using Shor's algorithm

“If you start factoring 10-digit numbers then it’s going to start getting scary”

Dr. Peter Shor, 2013

Related paper published 25 Jan 1997 by Dr. Shor:

Note: Shor's algorithm was formulated in 1994

Quickly searching unsorted data

using Grover's algorithm

"Programming a quantum computer is particularly interesting since there are multiple things happening in the same hardware simultaneously.  One needs to think like both a theoretical physicist and a computer scientist."

Dr. Lov Grover, 2002

Related paper published 17 Jul 1997 by Dr. Grover:

Simulating nature

complex chemical reactions, for example

“Nature isn't classical, dammit, and if you want to make a simulation of nature, you'd better make it quantum mechanical, and by golly it's a wonderful problem, because it doesn't look so easy.”

Dr. Richard Feynman, 1981

Leveraging quantum computing for chemistry

Quantum communication and cryptography

Machine learning

estimating gradients using quantum computing

Concepts we'll address today

Introduction to quantum computing

Axioms of quantum mechanics (with cats)

  • Superposition principle
  • Measurement
  • Unitary evolution

Abstracting cats with qubits

Quantum computing gates and circuits

Java and quantum computing

Axioms of Quantum Mechanics

\vert\space\space\space\rangle
   \vert\space\space\space\rangle

featuring grumpy cat (or is it grumpy ket)? 

My microscopic cat is often grumpy

\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle

sometimes he is actually happy

but I've never observed him in-between those states

Axiom 1: Superposition principle

my cat can be in any combination of grumpy and happy

\vert\space\space\space\rangle
   \vert\space\space\space\rangle
= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
=[10]= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
= \begin{bmatrix} 0 \\ 1 \end{bmatrix}
=[01]= \begin{bmatrix} 0 \\ 1 \end{bmatrix}
= \begin{bmatrix} \sqrt{\frac{1}{3}} \\ \sqrt{\frac{2}{3}} \end{bmatrix}
=[1323]= \begin{bmatrix} \sqrt{\frac{1}{3}} \\ \sqrt{\frac{2}{3}} \end{bmatrix}
\sqrt{\frac{1}{3}}
13\sqrt{\frac{1}{3}}
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
+
++
\sqrt{\frac{2}{3}}
23\sqrt{\frac{2}{3}}
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle

Representing quantum states

geometrically, ket notation, and vectors

\vert\space\space\space\space\rangle
    \vert\space\space\space\space\rangle
\vert\space\space\space\space\rangle
    \vert\space\space\space\space\rangle
\vert\space\space\space\space\rangle
    \vert\space\space\space\space\rangle
\vert\space\space\space\space\rangle
    \vert\space\space\space\space\rangle
\vert\space\space\space\space\rangle
    \vert\space\space\space\space\rangle
\vert\space\space\space\space\rangle
    \vert\space\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle

Axiom 2: Unitary evolution

gates modeled as matrices

X

\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
[0110][10]=[01]\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}

NOT gate (Pauli/X, bit-flip)

\vert\space\space\space\rangle
   \vert\space\space\space\rangle

Hadamard gate

great for putting cats in equal superpositions

H

\begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix}
[12121212][10]=[1212]\begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix}

Hadamard gate

\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
+
++
\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\sqrt{\frac{1}{3}}
13\sqrt{\frac{1}{3}}
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
+
++
\sqrt{\frac{2}{3}}
23\sqrt{\frac{2}{3}}
\vert\space\space\space\rangle
   \vert\space\space\space\rangle

Axiom 3: Measurement

probability is amplitude squared

When observed there is a:

\frac{1}{3}
13\frac{1}{3}
\frac{2}{3}
23\frac{2}{3}

probability of being grumpy

probability of being happy

Multiple cats

\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
=
==
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
=[10]= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
\otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix}
[10] \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix}

Composite quantum states

= \begin{bmatrix} 1 \\ \\ \\ \end{bmatrix}
=[1]= \begin{bmatrix} 1 \\ \\ \\ \end{bmatrix}
= \begin{bmatrix} 1 \\ 0 \\ \\ \end{bmatrix}
=[10]= \begin{bmatrix} 1 \\ 0 \\ \\ \end{bmatrix}
= \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix}
=[100]= \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix}
= \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}
=[1000]= \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}

Multiple cats

\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
=
==
= \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}
=[0100]= \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}
= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
=[10]= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
\otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}
[01] \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}

Composite quantum states

\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle

Multiple cats

\vert\space\space\space\space\space\space\space\space\space\space\space\rangle
           \vert\space\space\space\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
=
==
= \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix}
=[00010000]= \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix}
= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
=[10]= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
\otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}
[01] \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}

Composite quantum states

\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}
[01] \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}
\vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
            \vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
            \vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
            \vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
            \vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
            \vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
            \vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
            \vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
            \vert\space\space\space\space\space\space\space\space\space\space\space\space\rangle
\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}
+
++

Superpositions, evolution & measurement

putting the three axioms together

\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}
\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}
+
++
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\sqrt{\frac{1}{6}}
16\sqrt{\frac{1}{6}}
+
++
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\sqrt{\frac{1}{3}}
13\sqrt{\frac{1}{3}}
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle

quantum gates

quantum gates

measure

\downarrow
\downarrow
\downarrow
\downarrow
\downarrow
\downarrow
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle

with 1/2 probability

with 1/6 probability

with 1/3 probability

\vert\space\space\space\rangle
   \vert\space\space\space\rangle

Quantum entanglement

spooky actions at a distance

H

Hadamard gate

\vert\space\space\space\rangle
   \vert\space\space\space\rangle

CNOT gate

\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}
+
++
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}
\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}
+
++
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\sqrt{\frac{1}{2}}
12\sqrt{\frac{1}{2}}

Mars - ESA

Alice Cat

Bob Cat

Venus - NASA

\vert\space\space\rangle
  \vert\space\space\rangle
=
==

Concepts we'll address today

Introduction to quantum computing

Axioms of quantum mechanics (with cats)

  • Superposition principle
  • Measurement
  • Unitary evolution

Abstracting cats with qubits

Quantum computing gates and circuits

Java and quantum computing

Hardware representation of qubits

Physical support Type
Microscopic cats Mood Grumpy Happy
Photon Polarization Horizontal Vertical
Electrons Spin Up Down
Superconductor Energy levels Ground Excited
\vert0\rangle
0\vert0\rangle
\vert1\rangle
1\vert1\rangle

Classical bits vs. qubits

two discrete states vs. infinite superpositions 

Qubit geometry

Representing qubits

ket notation, vectors, and geometrically

Superconducting qubits on a chip

Concepts we'll address today

Introduction to quantum computing

Axioms of quantum mechanics (with cats)

  • Superposition principle
  • Measurement
  • Unitary evolution

Abstracting cats with qubits

Quantum computing gates and circuits

Java and quantum computing

Classic logic gates

a quick review for comparison to quantum gates

Some quantum gates

matrix operations model quantum mechanical behavior

Quantum gate hardware

sending pulses to superconducting qubits

Quantum software development

  • Classic computing -> classic algorithms (classic gates)
  • Quantum computing -> quantum algorithms (quantum gates)
    • Operations on a single qubit may affect other qubits
    • Qubits can in different states at the same moment

Quantum software development

  • In many cases, the best approach to a problem is a combination of classic algorithms and quantum algorithms
  • Quantum algorithms leverage quantum gates, taking into account entanglement

Shor’s algorithm

  • “IT WILL BREAK ALL ENCRYPTION”
  • It allows faster integer factorization (52 = 2 * 2 * 13)
    • quantum: polynomial time
    • classic: sub-exponential time
  • The problem is decomposed in a number of steps, including finding the periodicity of a function f(x) = f(x + r)
  • This problem can relatively fast be solved using a quantum algorithm

Shor's algorithm

Multiple cats

\vert\space\space\space\space\space\space\space\rangle
       \vert\space\space\space\space\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
\vert\space\space\space\rangle
   \vert\space\space\space\rangle
=
==
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
\vert\space\space\space\space\space\space\space\space\rangle
        \vert\space\space\space\space\space\space\space\space\rangle
= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
=[10]= \begin{bmatrix} 1 \\ 0 \end{bmatrix}
\otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix}
[10] \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix}

Composite quantum states

= \begin{bmatrix} 1 \\ \\ \\ \end{bmatrix}
=[1]= \begin{bmatrix} 1 \\ \\ \\ \end{bmatrix}
= \begin{bmatrix} 1 \\ 0 \\ \\ \end{bmatrix}
=[10]= \begin{bmatrix} 1 \\ 0 \\ \\ \end{bmatrix}
= \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix}
=[100]= \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix}
= \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}
=[1000]= \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}

Exploring the quantum simulator

e.g. visualize states of multiple qubits: |00>

Exploring the quantum simulator

e.g. visualize states of multiple qubits: |01>

Simple quantum circuit

collapses to 8 random states with equal probability

Quantum entanglement

basic circuit

Quantum superpositions

and observability

Measuring qubits

collapses to a basis state, discarding superposition

Measuring quantum state

a Java analogy

Concepts we'll address today

Introduction to quantum computing

Axioms of quantum mechanics (with cats)

  • Superposition principle
  • Measurement
  • Unitary evolution

Abstracting cats with qubits

Quantum computing gates and circuits

Java and quantum computing

Quantum Computer simulators

  • With some matrix algebra, a quantum computer can be simulated by a classic computer
    • This requires heaps of memory, increasing with increasing number of qubits
  • Cloud-based quantum simulators can deal with more qubits
  • Different languages:

Quantum Computing simulators in Java

StrangeFX

Java-based quantum simulator by Gluon / Johan Vos

James L. Weaver
Developer Advocate


jweaver@pivotal.io
JavaFXpert.com

@JavaFXpert

Dr. Johan Vos
Co-founder & CTO


johan.vos@gluonhq.com
gluonhq.com

@JohanVos

Quantum Computing

Hacking into Nature's Computer