Generate a circuit, using no more than 10 qubits, that approximates the unitary
The “distance” between the approximated circuit and the real unitary operator is defined by the operator norm of the difference between the two operators
where operator norm is defined as the maximal eigenvalue of the operator
This is done by setting the phase of the first non-zero element to 0.
The circuit should be composed of the CX and single-qubit gates only.
Since there was a restriction on using only two-qubit CX gates along with any single-qubit gates, we decided to pick our universal gate set to be ['u3', 'cx']
. u3
gates are standard three-parameter single-qubit gates that are available in qasm.
A u3
gate takes in three parameters and applies the following operation [source: qiskit documentation]
This gate is a universal single-qubit gate that can represent any other single-qubit unitary transformation. This allows us to compress down a stream of single-qubit gates into a single gate.
An example slice of a circuit will look like the following:
circuit:
┌──────────────────┐
q_0: ┤ U3(0,0,-0.44686) ├──■──────────────────────────
├──────────────────┤ │
q_1: ┤ U3(0,0,-0.44686) ├──┼────■─────────────────────
├─────────────────┬┘┌─┴─┐ │ ┌─────────────────┐
q_2: ┤ U3(0,0,0.34283) ├─┤ X ├──┼──┤ U3(0,0,0.24125) ├
├─────────────────┤ └───┘┌─┴─┐├─────────────────┤
q_3: ┤ U3(0,0,0.34283) ├──────┤ X ├┤ U3(0,0,0.24125) ├
└─────────────────┘ └───┘└─────────────────┘
Our goal is to implement
Using the Lie-Trotter formula we can approximate our target unitary
which is equivalent to applying the trotter approximation for small time-steps of
- Suzuki Trotter
- Lie Trotter
- Randomized Trotter
Both Suzuki Trotter and Lie Trotter are well known. Since the required error rate was 0.1, there was no necessity of increasing the repetitions, the required error rate was achieved in one repetition. It is also well known that Suzuki Trotter performs well only for even orders, it is often the case that there is a trade-off between order and repetition required for a low error rate but as the required error rate was achieved in single repetition there was no necessity to go beyond Suzuki order 2.
A different approach was taken through the QDRIFT algorithm that is given below. Note that this algorithm did not perform well compared to standard Trotterization.
A good approach is an approach that also comes with an explanation of the failed methods, in this section we will be presenting the methods we experimented with that did not work out. Since qchem
on the H2.xyz
file present here.
Apart from the standard three Trotter methods mentioned above, we also tried using circuit approximation of a target unitary.
Comparing Trotter against each other, we obtained the following plot:
It is clear that Randomized Trotter performance is much worse compared to the other methods. This is due to a lack of terms, ideally, we require the number of terms to be
Note that we terminate the number of repetitions the moment the error rate goes below 0.1, this is because more repetitions will only increase the circuit depth and provide us with lesser error.
There was a hard limit of 5 for the number of repetitions which is why QDRIFT stopped without trying with more repetitions.
Using the approximate quantum compiler present in qiskit, we tried generating a circuit for the target unitary, i.e.
The above result leads us to the conclusion that circuit approximation is not worth attempting for the larger target molecule as it is quite resource-demanding and performs sub-optimal when compared to standard Trotter methods.
Using the vast library of qiskit, we made a class for circuit optimization that will run multiple passes over the decomposed circuit and tries to further reduce the circuit depth. We used the following in-built passes [refer qiskit documentation for all passes here] which are under circuit optimization only.
simple_commutation_pass
cancel_cx_pass
commutative_analysis_pass
commutative_cancellation_pass
Any other passes did not seem useful apart from this, the following plot will show how effective these circuit optimizations were:
Note that the effectiveness is limited since the circuit is unrolled on a constrained basis. There is very little scope for circuit optimization.
We started with the first-order trotter simulation with a single repetition. Using this we got an error
Using the LiH strings (in the exact order that they were provided), without performing any form or lexical analysis or changes in the ordering of terms, we obtained a circuit depth of
We then optimized the circuit by changing the order of the terms to maximize gate cancellation. Here, by terms, we mean the
Our main motto at this phase of circuit optimization was to come up with the best possible ordering of the Pauli strings.
Several ordering techniques we used are:
- Lexicographic Term Ordering
- Interleave Term Ordering
- Magnitude Term Ordering
The best result we obtained at this stage was:
We also grouped the terms based on their coefficients and tried ordering amongst groups (inter-group order) as well as the ordering terms within a given group (intra-group order).
After grouping the best result we obtained was a depth of
We simplified the Hamiltonian heuristically to search for the group of terms removing which change the Hamiltonian only slightly. This reduced the depth to
Upon deleting some group of terms, we observed an increase in error which could be mitigated by increasing or decreasing the coefficients of certain terms which have common substrings with the deleted ones. We used binary search to obtain the amount by which the coefficient had to be increased or decreased.
Using re-calibration, we arrived at a depth of
After all the optimizations (described above) we got the following result:
Circuit Depth:
$1311$ Error:$0.0989012190291026$