This is the third internship lecture. Finally, we are going to start quantum computation.
Quantum States and State Vectors
Unlike today's computers, the data used in a quantum computer is handled differently: a single qubit is represented using a sphere. A qubit has a |0> state and a |1> state, which can be represented by a vector.
The following conditions are satisfied
Polar coordinate representation of quantum states
The Bloch sphere is a notation for representing quantum states on the unit sphere that can be expressed as a superposition of two orthogonal pure states.
You can also use angle-based parameter notation, such as Remember that quantum data is expressed in terms of angles.
Manipulating state vectors and quantum gates
To manipulate state vectors, quantum gates are used. The basic Pauli gate, arbitrary rotation gate, and Hadamar gate are mainly used in variational algorithms.
There are three types of Pauli gates, XYZ, each of which implies a 180-degree rotation around the XYZ axis in the Bloch sphere, and the corresponding matrices are
Also, arbitrary rotation around the XYZ axes is made with the RX, RY, and RZ gates, and
$$
X
\begin{bmatrix}
1 \
0
\end{bmatrix}
The quantum state can be changed by acting these quantum gates on the state vector.
0&1 \
1&0
\end{bmatrix}
\begin{bmatrix}
1 \
0
\end{bmatrix}
\begin{bmatrix}\begin{bmatrix}
0 \
1
\end{bmatrix}
$$
The Hadamar gate is a convenient gate that rotates around the XZ axis.
Eigenvalue and eigenvector problems
Various problems can be solved if eigenvalues and eigenvectors for a given matrix can be found. For a given matrix
The objective is to find
Most quantum computer problems correspond to this eigenvalue problem. We set the problem on the matrix H and look for the eigenvalues E.
Quantum Variational Principle
Finding eigenvalues is the main optimization used in NISQ. We learned how to use numerical optimization on the seconde lecture.
Since it is tough to find the eigenvalues directly, we drop indirectly into an optimization calculation that brings us as close as possible to the expected value of the eigenvalues. Since the Hamiltonian
Hamiltonian and its expectation value
The Hamiltonian
As an example of a single qubit, from any quantum state
Find the expected value of the Hamiltonian Z
The expected value of the Hamiltonian at any state vector when
The expected value of the Hamiltonian
but this value cannot be obtained by ordinary measurement, so the solution is obtained through a deformation of the Hamiltonian.
Transformation of Hamiltonian
If the Hamiltonian
In the case of Y, this can be handled by transforming the state vector as in
These can be used to calculate the expected values by putting the above H and RX gates in the measurement just before the quantum circuit measurement.
Linear Combining
In fact, the Hamiltonian
Let's see an example
Expectation value is,
can be calculated by doing the calculations individually and finding the sum, as in the example.
Quantum adiabatic computation
Quantum adiabatic calculation is a theory that allows time evolution while keeping the ground state by intermittently changing the state vector.
Let
Then
The time evolution is aquired by,
The challenge is where the ground state and the first excited state are closest, but we can keep the ground state by paying attention to the energy difference between
QAOA circuit
QAOA is the time evolution calculation of the above quantum adiabatic calculation applied to a variational algorithm as ansatz.
|0> --H-- --RZZ--RZ-- --RX-- --RZZ--RZ-- --RX--
| |
|0> --H-- --RZZ--RZ-- --RX-- --RZZ--RZ-- --RX--
The overall structure can be divided into two main parts
1.Selecting a mixer determines the initial state
2. create a formulation in QUBO or Z
The second formulation is automatically time evolved.
The leftmost formulation creates the initial eigenstate|+>. The corresponding Hamiltonian X comes out in Rx in the form of a time evolution. Usually the mixer chooses X by default, and
Also, CX-Rz-CX (orRZZ) corresponds to the weight of the Hamiltonian in the problem setup, and the next Rz corresponds to the bias of the Hamiltonian.
blueqat's QaoaAnsatz will automatically construct this time evolution ansatz for you if you decide on the Hamiltonian and the number of step divisions. Since the library does the appropriate calculations for us, all we have to do is formulate the Hamiltonian and select the mixer. Let's solve a simple formulation.
Ising Formulation
A physical model called the Ising model is used to solve combinatorial optimization problems. In the Ising model, the problem is usually formulated using up and down spins. The formulation uses Z as the operator, where Z has the expected value of +1 and -1.
QUBO
Next, we will check QUBO, which is derived from the Hamiltonian Z formulation above and formulated in terms of 0s and 1s. QUBO is a rewriting of the Z formulation, but blueqat has a tool that automatically converts it.
The formulation is
from blueqat import Circuit
from blueqat.utils import qaoa
from blueqat.pauli import qubo_bit as q
from blueqat.pauli import X,Y,Z,I
hamiltonian = 2*q(1)-4*q(0)*q(1)
step = 1
result = qaoa(hamiltonian, step)
result.circuit.run(shots=100)
Counter({'11': 47, '00': 36, '10': 17})