Programming a quantum computer
Evan
Contents
What happens when I run a line of code?
Classical language hierarchy
Y := 3
X := Y + 2
My code:
8-BIT ADDER
CLOCK
My hardware:
Wires carrying 0 V / 2 V
Y := 3
X := Y + 2
My code:
8-BIT ADDER
CLOCK
My hardware:
MOV AX,DATA
MOV DS,AX
LEA DX,MSG1
MOV AH,9
INT 21H
MOV AH,1
INT 21H
Y := 3
X := Y + 2
My code:
8-BIT ADDER
CLOCK
My hardware:
MOV AX,DATA
MOV DS,AX
LEA DX,MSG1
MOV AH,9
INT 21H
MOV AH,1
INT 21H
0x 60 00 00 80
0x A4 00 00 00
0x 60 01 00 84
0x A4 01 01 00
0x 60 02 00 00
0x 60 03 00 04
0x 60 04 00 00
0x 60 05 00 01
0x 08 00 00 02
0x 20 00 00 03
0x 20 04 04 05
0x 11 20 04 01
Quantum language hierarchy
My code:
My hardware:
DC / AC microwave lines
q0, q1 = GridQubit.rect(1, 2)
Circuit += Rx(pi/2).on(q0)
Circuit += SWAP(q0, q1)
Engine.run(Circuit)
Cirq
Google software hierarchy
Transmon qubit
My code:
Transmon qubit
My hardware:
DC / AC microwave lines
q0, q1 = GridQubit.rect(1, 2)
Circuit += Rx(pi/2).on(q0)
Circuit += SWAP(q0, q1)
Engine.run(Circuit)
Circuit serialization & parsing & ???
Google software hierarchy
My code:
My hardware:
q0, q1 = GridQubit.rect(1, 2)
Circuit += Rx(pi/2).on(q0)
Circuit += SWAP(q0, q1)
Engine.run(Circuit)
0x 60 00 00 80
0x A4 00 00 00
0x 60 01 00 84
0x A4 01 01 00
0x 60 02 00 00
0x 60 03 00 04
0x 60 04 00 00
0x 60 05 00 01
0x 08 00 00 02
0x 20 00 00 03
0x 20 04 04 05
0x 11 20 04 01
Circuit serialization & parsing & ???
Transmon qubit
Google software hierarchy
My code:
My hardware:
DC / AC microwave lines
RX(PI/2) 0
SWAP 0 1
MEASURE 0 [0]
MEASURE 1 [1]
0x 60 00 00 80
0x 60 04 00 00
0x 60 05 00 01
0x 08 00 00 02
0x 20 00 00 03
0x A4 00 00 00
0x 20 04 04 05
0x 11 20 04 01 0x 60 01 00 84
0x 60 03 00 04
0x A4 01 01 00
0x 60 02 00 00
<qiskit code>
IBM software hierarchy
Transmon qubit
QASM: “Quantum Assembly Language”
My code:
My hardware:
DC / AC microwave lines
Qreg q[2];
Creg c[2];
RX q[0];
SWAP q[0],q[1];
measure q -> c;
0x 60 00 00 80
0x A4 00 00 00
0x 60 01 00 84
0x A4 01 01 00
0x 60 02 00 00
0x 60 03 00 04
0x 60 04 00 00
0x 60 05 00 01
0x 08 00 00 02
0x 20 00 00 03
0x 20 04 04 05
0x 11 20 04 01
<pyquil code>
Rigetti software hierarchy
Transmon qubit
QUIL: “Quantum Instruction Language”
Many quantum circuit libraries have similar scope
Some circuit libraries have different aims
Quantum programming languages are more specific
Another layer in the language hierarchy?
Transmon qubit
DC / AC microwave lines
<Quantum assembly language / lower language>
<Hardware instructions>
<High level quantum language/library>
<Logical Encoding>
Logical qubits are error-resistant encodings
Devitt, Simon J, William J Munro, and Kae Nemoto. “Quantum Error Correction for Beginners.” Reports on Progress in Physics 76.7 (2013): 076001.
Code Example