Qiskit Tutorials

Welcome Qiskitters.

These tutorials aim to explain how to use Qiskit. We assume you have installed Qiskit; if not, please look at qiskit.org or the install documentation.

We've collected a core reference set of notebooks in this section outlining the features of Qiskit. We will be keeping them up to date with the latest Qiskit version, currently 0.12. The focus of these notebooks is not on learning quantum computing. Instead we will focus on how to use Qiskit, and will go into details only when needed. For those interested in learning about quantum computing we recommend the awesome educational material we and the community have put together.

Qiskit is made up of four elements: Terra, Aer, Ignis, and Aqua. Each element has its own goal, and together they make the full Qiskit framework.

Getting started with Qiskit

This section gives you the tools to make your first circuits, run them on real quantum systems and simulators, and view the data.

  1. Getting started with Qiskit - How to use Qiskit.

  2. Plotting data in Qiskit - Illustrates the different ways of plotting data in Qiskit.

  3. The IBM Q Account - Understanding the IBM Q account.

  4. Circuit Properties - Important properties of quantum circuits.

  5. Using the Transpiler - Mapping and optimizing circuits using the Qiskit transpiler.

  6. Jupyter Tools - Qiskit functionality for Jupyter notebooks.

  7. Summary of quantum operations - List of quantum operations (gates, reset, measurements) in Qiskit Terra

2 Qiskit Terra

Terra, the ‘earth’ element, is the foundation on which the rest of the software lies. Terra provides a bedrock for composing quantum programs at the level of circuits and pulses, to optimize them for the constraints of a particular device, and to manage the execution of batches of experiments on remote-access devices. Terra defines the interfaces for a desirable end-user experience, as well as the efficient handling of layers of optimization, pulse scheduling and backend communication.

  1. Advanced circuits - Circuit building tools added including registerless declarations, composite gate updates and parameterized circuits.
  2. Operators overview - Gives a summary of the features and uses of the Operator class.
  3. Advanced circuit visualization - Details on drawing your quantum circuits.
  4. Transpiler passes and passmanager - How to use the transpiler passes, passmanger, and extend the transpiler with a new pass.
  5. Pulse schedules - An introduction to working with pulse schedules.
  6. Creating a new provider - A guide to integration of a new provider with Qiskit structures and interfaces

3 Qiskit Aer

Aer, the ‘air’ element, permeates all Qiskit elements. To really speed up development of quantum computers, we need better simulators with the ability to model realistic noise processes that occur during computation on actual devices. Aer provides a high-performance simulator framework for studying quantum computing algorithms and applications in the noisy intermediate-scale quantum regime.

  1. Aer provider - Gives a summary of the Qiskit Aer provider containing the Qasm, statevector, and unitary simulator
  2. Device noise simulation - Shows how to use the Qiskit Aer noise module to automatically generate a basic noise model for simulating hardware backends
  3. Building noise models - Shows how to use Qiskit Aer noise module to construct custom noise models for noisy simulations
  4. Custom gate noise - Shows to implement simulations using custom noisy gates.
  5. Noise transformations - Demonstrates the noise approximation utility functions to construct approximate Clifford noise models out of a general noise model
  6. Extended stabilizer tutorial - Gives an overview of the extended stabilizer Qasm Simulator method
  7. Matrix Product State simulator - Gives an overview of the matrix product state Simulator method

4 Qiskit Ignis

Ignis, the ‘fire’ element, is dedicated to fighting noise and errors and to forging a new path. This includes better characterization of errors, improving gates, and computing in the presence of noise. Ignis is meant for those who want to design quantum error correction codes, or who wish to study ways to characterize errors through methods such as tomography and randomized benchmarking, or even to find a better way for using gates by exploring dynamical decoupling and optimal control. Ignis tutorials are found here and include:

  1. Calibrating a qubit:
    • a. Calibrating a qubit - Using pulse to calibrate a "pi-pulse" gate by fitting a Rabi oscillation on a qubit. Using the "pi-pulse" measure the single-shot analog voltages that are returned by an experiment.
    • b. [Calibrating a two-qubit gate](advanced/ignis/1b_calibrating_a_two_qubit_gate.ipynb -
  2. Hamiltonian and gate characterizations - Sequences to measure ZZ rates between qubits and to measure rotation and angle errors in the gates.
  3. Relaxation and decoherence - How to measure coherence times on the real quantum hardware
  4. Measurement error mitigation - How to peform calibration experiments for measurement errors and fed those calibrations into a "filter" that can be utilized to mitigate errors in subsequent experiments.
  5. Randomized Benchmarking:
    • a. Randomized benchmarking - Randomized benchmarking (RB) is a technique used to measure the average gate error by measuring the outcomes of random Clifford circuits. This is used internally to report gate errors on our systems.
    • b. Interleaved RB - A variant of RB used to measure the error of a specific gate.
    • c. Purity RB - A variant of RB used to measure the incoherent error per gate.
  6. Tomography:
    • a. Quantum state tomography - How to identify a quantum state using state tomography, in which the state is prepared repeatedly and measured in different bases.
    • b. Quantum process tomography - A method to reconstruct the quantum process matrix by preparing certain states, applying a gate, and then measuring the outcome in different bases.
  7. Quantum volume - How to run quantum volume measurements on the quantum hardware.
  8. Repetition Code - How to run a simple error correction code, known as the repetition code. This can be used to characterize bit flip errors in the hardware.
  9. Logging - An introduction to some of the logging features in Ignis, intended to be used to track characterization parameters.

5 Qiskit Aqua

Aqua, the ‘water’ element, is the element of life. To make quantum computing live up to its expectations, we need to find real-world applications. Aqua is where algorithms for NISQ computers are built. These algorithms can be used to build applications for quantum computing.

  • Amplitude Estimation - Illustrates amplitude estimation, for a simple case, where the (assumed to be unknown) success probability p of a Bernoulli random variable is estimated
  • HHL - Solving linear systems of equations with the HHL algorithm
  • Creating an Aqua algorithm - Building an algorithm within the framework of Aqua
  • Generating Random Variates - Illustrates ways of generating random variates of several popular distributions on IBM Q

Aqua is accessible to domain experts in Machine Learning, Chemistry, Finance or Optimization, who want to explore the benefits of using quantum computers as accelerators for specific computational tasks, without needing to worry about how to translate the problem into the language of quantum machines:

5.1 Qiskit Machine Learning

Qiskit ML - demonstrates using quantum computers to tackle problems in the machine learning domain. These include using a quantum-enhanced support vector machine to experiment with classification problems on a quantum computer.

5.2 Qiskit Chemistry

Qiskit Chemistry - applications in the domain of quantum chemistry on quantum computers, including ground state energy, dipole moments and dissociation plots.

5.3 Qiskit Finance

Qiskit Finance - provides a collection of applications of quantum algorithms to use cases relevant in finance. This includes use cases like portfolio management, derivative pricing, or credit risk analysis.

5.4 Qiskit Optimization

Qiskit Optimization - using VQE (Variational Quantum Eigensolver) to experiment with optimization problems (max-cut and traveling salesman problem) on a quantum computer. This includes optimization problem modelling, using docplex, which can be automatically translated to input suitable for VQE.

In [2]:
import qiskit.tools.jupyter

Version Information

Qiskit SoftwareVersion
IBM Q Provider0.3.1
System information
Python3.7.3 (default, Mar 27 2019, 16:54:48) [Clang 4.0.1 (tags/RELEASE_401/final)]
Memory (Gb)16.0
Fri Aug 09 11:31:26 2019 EDT

This code is a part of Qiskit

© Copyright IBM 2017, 2019.

This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.

Any modifications or derivative works of this code must retain this
copyright notice, and modified files need to carry a notice indicating
that they have been altered from the originals.

In [ ]: