Initialize variables
In the next line of code, you initialize two qubits in the zero state, and two classical bits in the zero state, in the quantum circuit called circuit.
Build a simple Quantum Circuit using IBM Qiskit in Python
Qiskit is an open source framework for quantum computing. It provides tools for creating and manipulating quantum programs and running them on prototype quantum devices on IBM Q Experience or on simulators on a local computer. Let’s see how we can create simple Quantum circuit and test it on a real Quantum computer or simulate in our computer locally. Python is a must prerequisite for understanding Quantum programs as Qiskit itself is developed using Python.
First and foremost part before entering into the subject is installation of Qiskit and Anaconda. Refer to the below articles for step by step guide for anaconda installation.
Installation
To install qiskit follow the below steps:
- Open Anaconda Prompt and type
pip install qiskit
- That’s it, this will install all necessary packages.
- Next, open Jupyter Notebook.
- Import qiskit using the following command.
import qiskit
To get access to IBM Quantum Systems:
- Create a free IBM Quantum Experience Account.
- Navigate to My Account.
- Click on Copy Token to copy the token to the clipboard(Token represents the API to access IBM Quantum devices).
- Run the following commands(Jupyter Notebook) to store your API token locally for later use in a configuration file called qiskitrc. Replace MY_API_TOKEN with the API token.
from qiskit import IBMQ IBMQ.save_account('MY_API_TOKEN')