We recently released a major new version of the Quantum Information Science Kit, or Qiskit, which we have redesigned for greater flexibility and streamlined use. Qiskit 0.5 improves the overall user experience in three significant ways: 1. the user can more easily express quantum circuits; 2. the software interacts more cleanly with cloud based quantum computers; and 3. new end to end performance testing means Qiskit now runs on average seven times faster.
Compose Quantum Circuits
In Qiskit 0.5, we have greatly simplified the process of creating quantum circuits. You can now create anonymous registers and circuits, and work with those objects directly, without worrying about naming them. Let’s look at an example. We will build on this example throughout this post to highlight various features of the new release.
We can use the new circuit drawing features to plot publication-quality images of circuits. Here you see that the quantum register was automatically assigned the name
q0. You can change this by explicitly setting the name when defining a quantum register.
You can also combine circuits to grow them across both width and depth, making them reusable within larger circuits.
Simulate in Various Ways
A major aspect of the new release is a revamp of Qiskit’s simulators. Let’s see what simulators are available to execute our circuits:
These three simulators are all local, meaning they run on your own computer. They represent three different things you may want to do in a quantum simulation:
1) To execute a circuit for many shots and obtain a histogram of all measurement results, you can use the
local_qasm_simulator. This is similar to how an experiment is done, and can include all OpenQASM commands.
2) To execute a circuit once and see how the statevector evolves from the initial zero state, you can use the
local_statevector_simulator. In this simulator you are restricted to one shot, and cannot use measurements, reset, or conditional gates.
[0.70710678+0.j, 0.+0.j, 0.+0.j, 0.+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.70710678+0.j]
3) To see the equivalent unitary transformation of the circuit, you may use the
local_unitary_simulator, which has similar restrictions as the statevector simulator.
Finally, we have added the ability to snapshot the internal representation of simulators during the execution of a circuit. Users can therefore obtain the statevector or unitary up to arbitrary depths in the circuit, which is handy for debugging purposes.
[0.70710678+0.j, 0.+0.j, 0.+0.j, 0.70710678+0.j,
0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j]
Interact with Remote Devices
Qiskit 0.5 greatly improves the way users interact with remote backends by simplifying the authentication process, allowing for asynchronous jobs, and backend filtering.
Let’s first register our credentials for remote access, and see how the list of available backends grows to include IBM Q provided backends as well.
['ibmqx2', 'ibmqx4', 'ibmqx5', 'ibmq_qasm_simulator', 'local_qasm_simulator', 'local_statevector_simulator', 'local_unitary_simulator']
We can also filter these backends based on desired characteristics, for example:
Perhaps the most useful feature of the new release is the introduction of asynchronous jobs. This means that users can now launch the execution of one or more circuits on a backend, monitor the status of each job, see its position in the queue, and read the results when each completes, while the others are running. Users also have access to previously run jobs. This feature improves how Qiskit interacts with cloud-based quantum computers, which sometimes have high traffic.
Lastly, we have introduced end-to-end performance testing of the code, which reduces the time it takes for a set of circuits to go through the steps of translation, optimization, and simulation. We have given examples of tasks that introduce many circuits, such as iterative quantum chemistry and tomography algorithms. Compared to the previous major release, Qiskit 0.5 is on average seven times faster — a difference our users will notice.
Try it for yourself!
No need to install anything; if you want to see Qiskit in action, try out the Qiskit tutorials on Binder. You’ll see how Qiskit is used for quantum computation — then you can dive right in to writing some programs of your own.
You can install the latest version of Qiskit by doing
pip install -U qiskit .
We are grateful to the Qiskit community who helped us by giving feedback, finding bugs, and contributing code. This open-source project continues to grow with help from many in the community. We especially thank the following contributors for their work on the latest release: Eddie Schoute, Yukio Siraichi, Anton Karazeev, Pieter Eendebak, Luhang Yang, Pete Taylour, Eugene Dumitrescu, Yael Ben-Haim, Yehuda Naveh, Richard Chen, Peng Liu, Marco Pistoia, David McKay, Abdon Rodriguez Davila, Takashi Imamichi, Ismail Yunus Akhalwaya, Albert Frisch, Toshinari Itoko.