Hello Quantum world


Posted on September 10, 2020

Tags: qiskit, ibm

Lets start with quantum programming!

I will create a simple quantum circuit with two quantum and two classical qubits, and add Hadamard gate whose H representation will be a shortened version of "Hello world" string. :)

First step is to import qiskit library.

In [1]:
from qiskit import *

I will create a two qubit quantum and classical registers.

In [2]:
qr = QuantumRegister(2)
cr = ClassicalRegister(2)

Now I will create a quantum circuit using those two registers.

In [3]:
circuit = QuantumCircuit(qr, cr)

I will draw it to see how it looks like.

In [4]:
%matplotlib inline
In [5]:
circuit.draw()
Out[5]:
         
q0_0: |0>
         
q0_1: |0>
         
 c0_0: 0 
         
 c0_1: 0 
         

I will add a Hadamard (H) gate on first quantum qubit.

In [6]:
circuit.h(qr[0])
Out[6]:

I will draw circuit again but this time in a different way

In [10]:
circuit.draw(output='mpl')
Out[10]:

And, that's it for now. Hope I will make some other notebooks soon.