Chapter 5. Quantum Information

The first three letters in the name Qiskit stand for quantum information science, which is the study of how quantum systems may be used to represent, process, and transmit information. The quantum_info module of Qiskit contains classes and functions that focus on those capabilities.

Using Quantum Information States

The qiskit.quantum_info module contains a few classes, shown in Table 5-1, that represent quantum information states.

Table 5-1. Classes that represent states in the qiskit.quantum⁠_​info module
Class name Description

Statevector

Represents a statevector

DensityMatrix

Represents a density matrix

StabilizerState

Simulation of stabilizer circuits

We’ll focus on the two most commonly used of these, namely the Statevector and DensityMatrix classes.

Using the Statevector Class

The Statevector class represents a quantum statevector and contains functionality for initializing and operating on the statevector. For example, as shown in the following code snippet, a Statevector may be instantiated by passing in a QuantumCircuit instance:

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)

statevector = Statevector(qc)
print(statevector.data)

output:
  [0.70710678+0.j 0.+0.j 0.+0.j 0.7071+0.j]

Notice that instead of running the circuit on a quantum simulator to get the statevector (as shown in the code in “Using the AerSimulator to calculate and hold a statevector” ...

Get Qiskit Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.