Quantum Programming in a nutshell
Quantum
Programming in a
nutshell
@RaduVunvulea
RADU VUNVULEA
Technology Enthusiast
Microsoft Azure MVP
Speaker & Trainer
Writer & Blogger
Idealist Software
Architecture Crafter
RADU VUNVULEA
- NO deep knowledge
on Quantum Computing
- You will not know to
write a real program in
Q#
- It’s all about probability
and vectors
Sneak preview on
quantum programming
concepts
Core concept of
Quantum theory
Energy, like matter, consists
of discrete units, rather than
solely as a continuous waves
Quantum computing takes advantage
of the strange ability of subatomic particles
to exist in more than one state at any time
Absolute values does not exists, just
an infinite values between 0 to 1
- superpositions -
GENESIS
Math
•Vectors
•Linear
Algebra
•Statistics
Particle
physics
• Photon
• Electron
Genesis
Schrödinger’s Cat
Dead or
Alive?
0.42342423423
• Absolute values like 0 or 1 does
not exist
• Statistics and multiple states is
what quantum defines
WHAT IS QUANTUM
COMPUTING?
BITS
Classical computer
ON OFF
Qubit
Qubit
ON
Qubit
Qubit
ON
Qubit
Qubit
ON
Bloch sphere
N qubits
2 𝑁
paths
QSPHERE
Superpositions
|0)
|1)
1 2(|0) + |1)) 1 2(|0) + |1))
|00000)
|00010)
|00110)
|01110)
|11111)
|11110)
|11010)
|01010)
BLOCK SPHERE QSPHERE
N qubits
2 𝑁
paths
QSPHERE
Superpositions
|0)
|1)
1 2(|0) + |1)) 1 2(|0) + |1))
|00000)
|00010)
|00110)
|01110)
|11111)
|11110)
|11010)
|01010)
BLOCK SPHERE QSPHERE
Number of calculation in
a single step
Nitrogen
fixation
100-200 qubits
Carbon
capture
100-200 qubits
Materials
science
100-1000qubits
Machine
Learning
100-1000qubits
Problems and Reqs
Classical
AND OR NOT Not-linear
Quantum
NOT
(Pauli-X)
Pauli-Z Hadamard CNOT Linear
Classical VS Quantum gates
Input Output
0 0 0 0
0 1 0 1
1 0 1 1
1 1 1 0
CNOT
• Quantum simulator
–2 𝑛
(n represents the no. of qubits)
–Multiple positions (superpositions)
• Traditional computer
–3 bits (2X2X2 – 8 combinations)
–7 bits (2X2X2X2X2X2X2 – 128 combinations)
How does the simulator works
• States
–30 qubits : 16 Gb on traditional computer
–31 qubits : 32 Gb
–70 qubits : 16 Zb
• Gate simulation
–30 qubits : 1s of normal computer
–40 qubits : 1s of super computer
–260 qubits : Age of Universe 
How does the simulator works
What we have now?
IBM: 50-qubit
Google: 72-qubit
Microsoft: 0-qubit
What we have now?
IBM: 50-qubit
Google: 72-qubit
Microsoft: 0-qubit
Hold the quantum
microstates 90
microseconds
• In the past:
–9 qubits (1 computational and 8 correctional)
• IBM breakthrough:
– 5 qubits (1 computational and 4 correctional)
Current problems
Current problems
Interfaces
Collapse
Error
correction
Output
observance
Quantum and
Microsoft
• Based on Majorana
particles
• Scalable
• Stable
• Error-prone
• Low cost
Microsoft Vision
Q#
Q#
Just another coprocessor like GPUs or
FPGAs
Windows,
Linux, maxOS
Development
libraries are
Open Source
Integrated with
Visual Studio
Interoperability
with Python
Q#
Application runs in a classical manner and when required a
sub-program runs inside quantum processor
Main concept
• Input data
• Setup
• Trigger quantum
processing
Classical
computation
• Run quantum
algorithm
Quantum
computation • Output data
• Present to the
user
Classical
computation
Domain Specific
Programming
Language
Used to write sub-
programs for
Quantum
processor
It is under control
of a classical host
Data type
• Primitive types
• Tuple
• Arrays
Basic Procedural
• Loops
• IF/ELSE
Q#
Q#
Int, Bool,
Qubit
Pauli (I,X,Y,Z)
Arrays []
Tuples ()
Result Zero One
User defined types
1. Int integer = 10;
2. Bool boolean = true;
3. Qubit qubit = Qubit[5];
4. Int[] array = Int[5];
5. (String, Qubit) tuple2 = (2, qubit[0]);
6. newtype event = (String, String);
1. set
2. newtype LogicalRegister = Qubit[]; //Callable expression
3. newtype EncodeOp = ((Qubit[], Qubit[]) =>
LogicalRegister);
4. // Range expression
5. 1..1..4; // 1234
6. 1..3..9; // 1369
7. 3..8..8; // 3
8. 1..-1..2; //Empty
9. array[1..2..5]; // Items on the index 1,3,5
1. let itcamp = 2018; // Immutable 'variable' /
symbol
2. mutable mutableValue = 200;
3. let imutableValue = mutableValue;
4. set mutableValue = 400;// imutableValue == 200
5. fail $"Exception occured";
6. return Zero;
Conclusion
• Quantum programming is all about vectors and
probabilities
• It is another programming paradigm
• Big potential for predictions and simulations
– AI, ML
Conclusion
Conclusion
• Quantum programming is all
about vectors and probabilities
• It is another programming
paradigm
• Big potential for predictions and
simulations
– AI, ML
Q & A
50
THANK YOU!
@RaduVunvulea
RADU VUNVULEA
 Quantum programming in a nutshell

Quantum programming in a nutshell

Editor's Notes

  • #33 https://whatis.techtarget.com/definition/quantum-computing