7.1 Working with two qubits in Qiskit
In order to work with two-qubit systems in Qiskit, we need to start by defining a quantum circuit that has a pair of qubits. In quantum computing jargon, these two qubits form what is called a quantum register . In fact, a register is nothing more than a bunch of qubits (or bits, if it is a classical register ) that are grouped together and that we can use for some purpose. In this chapter, we are going to work only with quantum registers of two qubits, but in Chapter 10 we will extend this to registers with an arbitrary number of qubits.
So, how can we define a quantum circuit with a two-qubit register in Qiskit? It couldn’t be easier. We just need to use the following piece of code:
from qiskit import QuantumCircuit
circuit = QuantumCircuit (2)
As you surely have noticed, this the exact same invocation that we used, back in Chapter 4, to define one-qubit circuits, but setting the argument in the call to the QuantumCircuit...