visit
We have reached in an era where we can now implement basic AND, OR and XOR logics on quantum circuits similar to the classical computing and we call this era as Quantum Era.
This article is a simple introduction to Applied Quantum Computing (AQC) where we will code a Hello World program on real quantum chip š .
But waitĀ ā¦ I donāt have a quantum computer so how can I even do thatĀ ???
And there is a very simple solution for this, with companies like IBM and Google actually making quantum devices we can leverage them to build and test stuffs on real devices with ZERO setup of whatsoever.
So here is our tech stackĀ :So letās get our hands entangled. š
Quantum computers are based on quantum bits, also known as qubits. They have two possible values (states) as 0
and 1
, similar to the one we have in the classical computer. But the laws of quantum mechanics also allow other possibilities, which we call states.
A Quantum Computer created by IBM combining the quantum registers.
Quantum computing could enable exponential speedups for certain classes of problems by exploiting superposition and entanglement in the manipulation of quantum bits (qubits). One such example is using quantum computing in Artificial Intelligence space, we can implement an optimisation algorithm(s) which can use the properties of superposition and help in speeding up the optimisation problem which can eventually lead to better and faster learning algorithm(s).
Quantum Annealing OptimizerĀ : Computing multiple local and global minima at aĀ time.
Which can be a key towards Artificial General Intelligence (AGI).
Image SourceĀ : www.qilimanjaro.io
Colab linkĀ :
Github link:
To start with quantum programming we will use Open Source Quantum Information Science Kit (). Itās a rapidly growing open source community making efforts to bring quantum computing easily accessible for larger audience.
For more: pip install qiskitNow that we have the package setupāed lets get familiar with the programming paradigm in quantum world. There are 4 major components for quantum programming.
# Create a Quantum Register called "qr" with 2 qubits.qr = qp.create_quantum_register('qr',2)
# Create a Classical Register called "cr" with 2 bits.cr = qp.create_classical_register('cr',2)
We will connect to a real quantum chipset and execute quantum operations on our HelloWorldCircuit. Here I am using IBM-Q deployed chipsets which has various options like:
They are still in development phase and by the time you are reading this article they may get deprecated. So to get updated list look .To access these chipsets you will need an account on . And generate the token from .
Set the backend as ibmqx5, provide your token and setup the connection. If the token is valid and the backend is configured then you are all set to access the quantum power.
backend = 'ibmqx5' token = 'a7dbfb3cfc1252c4a7555020c32808cff17102a467c595801371f7b7f1f7c3a3355d565469aa4a37564df269f3710f33d7d13ba3c900ca947c1513598b64c5e7' qp.set_api(token,url=') Now its time to compose our circuit and execute the experiment. Steps to create our Hello World circuit:Our Hello WorldĀ circuit.
# Add the H gate in the Qubit 1, putting this qubit in superposition.qc.h(qr[1])
# Add the CX gate on control qubit 1 and target qubit 0, putting the qubits in a Bell state i.e entanglementqc.cx(qr[1], qr[0])
# Add a Measure gate to see the state.qc.measure(qr[0],cr[0])qc.measure(qr[1],cr[1])
# Compile and execute the Quantum Program in the ibmqx5results = qp.execute(['HelloWorldCircuit'] ,backend ,timeout=2400)print(results.get_counts('HelloWorldCircuit'))
Now when we examine the results you will see 4 quantum states 0000, 0001, 0010,0011 each having some probabilities associated with it.So this depicts that all the four states co-exists at a givenĀ time.{ā00ā: 488, ā01ā: 90, ā10ā: 58, ā11ā: 388}
CongratulationsĀ !!! š š You just experienced the 2 basic properties of quantum world i.e Superposition and Entanglement.