Skip to content

Python software development kit for writing quantum computing experiments, programs, and applications

License

Notifications You must be signed in to change notification settings

pacomf/qiskit-sdk-py

 
 

Repository files navigation

Quantum Information Software Kit (QISKit)

Build Status

The Quantum Information Software Kit (QISKit for short) is a software development kit (SDK) for working with OpenQASM and the IBM Quantum Experience (QX).

Use QISKit to create quantum computing programs, compile them, and execute them on one of several backends (online Real Quantum Processors, online Simulators, and local Simulators). For the online backends, QISKit uses our python API client to connect to the IBM Quantum Experience.

We use GitHub issues for tracking requests and bugs. Please see the IBM Q Experience community for questions and discussion. If you'd like to contribute to QISKit, please take a look at our contribution guidelines.

Links to Sections:

Installation and setup

Dependencies

To use QISKit Python version you'll need to have installed Python 3 or later and Jupyter Notebooks (recommended to interact with tutorials). For this reason we recomend to use Anaconda 3 python distribution, install all of this dependencies for you.

In addition, a basic understanding of quantum information is very helpful when interacting with QISKit. If you're new to quantum, Start with our User Guides!

install QISKit

For those more familiar with python, follow the QISKit install process below:

PIP Installation

The fast way to install QISKit is using PIP tool (Python package manager):

    pip install qiskit

Source Installation

And alternative method is clone the QISKit SDK repository and navigate to its folder on your local machine:

Download the code

Select the "Clone or download" button at the top of this webpage (or from URL shown in the git clone command), unzip the file if needed, and navigate to qiskit-sdk-py folder in a terminal window.

Clone the repository

If you have Git installed, run the following commands:

    git clone https://github.com/QISKit/qiskit-sdk-py
    cd qiskit-sdk-py

Setup you enviroment

We recomend that you use python virtual enviroments to improve your experience. Setup the environment

Creating your first Quantum Program

Now that the SDK is installed, it's time to begin working with QISKit. First, get your API token:

  • Create an IBM Quantum Experience <https://quantumexperience.ng.bluemix.net>__ account if you haven't already done so
  • Get an API token from the Quantum Experience website under “My Account” > “Personal Access Token”

This API token allows to you to execute your programs in the IBM Quantum Experience backends.

After, try out some example QASM, which runs via the local simulator.

This is a simple superpesition example.

from qiskit import QuantumProgram

# Set your API Token
QX_TOKEN = "API_TOKEN"
QX_URL = "https://quantumexperience.ng.bluemix.net/api"

# Creating Programs create your first QuantumProgram object instance.
Q_program = QuantumProgram()

# Set up the API and execute the program.
# You need the API Token and the QX URL. 
# Q_program.set_api(QX_TOKEN, QX_URL)

# Creating Registers create your first Quantum Register called "qr" with 2 qubits
qr = Q_program.create_quantum_register("qr", 2)
# create your first Classical Register called "cr" with 2 bits
cr = Q_program.create_classical_register("cr", 2)
# Creating Circuits create your first Quantum Circuit called "qc" involving your Quantum Register "qr" # and your Classical Register "cr"
qc = Q_program.create_circuit("superposition", [qr], [cr])

# add the H gate in the Qubit 0, we put this Qubit in superposition
qc.h(qr[0])

# add measure to see the state
qc.measure(qr, cr)

# Compiled  and execute in the local_qasm_simulator

result = Q_program.execute(["superposition"], backend='local_qasm_simulator', shots=1024)

# Show the results
print(result)
print(result.get_data("superposition"))

in this case the output will be:

COMPLETED
{'00': 509, '11': 515} 

You can execute your code in a real Quantum Chips.

More details in the Qiskit documentation.

Next Steps

Now you're set up and ready to check out some of our other examples in the Tutorials repository! Our tutorials are developed using Jupyter Notebooks, but can be accessed as read-only from the github web page. To install it like part of QISKit read installation details installation details

Start with the index and the ‘Getting Started’ example. If you have Jupyter Notebooks installed, can copy and modify the notebooks to create experiments of your own.

The qiskit directory is the main module of the SDK. and in the doc directory you can find the complete SDK documentation.

More Information

For more information on how to use QISKit, tutorial examples, and other helpful links, check out:

QISKit was originally developed by researchers and developers on the IBM-Q Team within IBM Research, in order to offer a high level development kit to work with quantum computers.

Visit the IBM Q Experience community for questions and discussion on QISKit and quantum computing more broadly. If you'd like to contribute to QISKit, please take a look at our contribution guidelines.

Authors (alphabetical)

Jim Challenger, Andrew Cross, Ismael Faro, Jay Gambetta, Juan Gomez, Paco Martin, Antonio Mezzacapo, Jesus Perez, and John Smolin, Erick Winston, Chris Wood.

In future releases, anyone who contributes code to this project can include their name here.

License

This project uses the Apache License Version 2.0 software license.

About

Python software development kit for writing quantum computing experiments, programs, and applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.2%
  • Other 1.8%