Category Archives: Quantum Computing

Quantum Circuit Computation

For computation of quantum circuit I always try to use matrix calculations, which is quite tedious. Recently, I finally had a better understanding of tensor and got to know a much simpler way to compute the circuit. Take the following circuit as an example:

Where q0, q1, and q2 from top to bottom with q2 the MSB (most significant bit) and q0 the LSB (least significant bit). And the three-qubit state vector |ψ⟩ will be q2q1q0, with the MSB on the left.

The computation can be done by simply applying one of the followings to the individual qubit and then just expanding it.

Please note that the position of MSB matters, that means q2q1q0 and q0q1q2 are different. In this particular example, however, they are actually same, but this is just a coincidence. Whether the MSB is the leftmost or rightmost qubit is the individual’s choice as long as the same convention is consistent throughout the computation process. In this example I choose to put the MSB on the left to be consistent with the classical computer.