Building multiple qubit quantum circuits
In this section, we will build the matrix math for a full circuit that contains multiple qubits and then show how the results match the output from a quantum gate circuit. So far, we have used matrix multiplication and the @
symbol to multiply the original state with a series of matrices that represent unitary operators or quantum gates on one qubit. When we are dealing with multiple qubits, the vector space of each will have to be multiplied together using the tensor product, which is typically represented by the ⊗ symbol. We will use the NumPy kron()
function to calculate this:
Figure 6.14 – Matrix multiplication of a quantum gate circuit
The preceding diagram shows a sample quantum circuit with various gates (squares) each representing a 2x2 matrix. The initial state on each qubit is going to be the |0⟩ state. To represent this quantum circuit using matrix multiplication, we can use the tensor...