Dear Pennylane researchers,
First of all I would like to take the time to thank you for developing such a nice tool as well as working on comprehensive tutorials on many topics in QC.
I mainly focused on quantum chemistry and especially in qubit tapering where I have a question concerning the circuit Ansatz to be used. The only possible path I see would be to taper the operators associated to an Ansatz for untapered states and Hamiltonian, as it is also mentioned in the topic here excitations-for-tapered-hamiltonian/1849/6
After some digging I found that tapering operators will be available in the next version 27.0.0 of pennylane (PR #3002). As I am very unpatient I tried the proposed implementation for the HeH+ example molecule and applying VQE on it : it works like a charm. I also tried with LiH (see notebook). Of course it also works but slowly (much slower than untapered VQE), which brings me to my question.
When doing VQE, the circuit is reevaluated with different parameters, and based on the following proposition of implementation in pennylane/qchem/tapering.py file (PR#3002), it seems to me that the same circuit ansatz is retapered at each VQE iteration in addition to updating the parameter through the classical optimisation.
@qml.qnode(dev)
def circuit(params):
taper_operation(qml.DoubleExcitation(params[0], wires=[0,1,2,3]),
generators, paulixops, paulix_sector, H.wires)
Hopefully tapering the hamiltonian and basis state are only done once, but it is also time-costly to taper operators. There are some quickly done time benchmarks in the joint notebook. First of all, am I doing anything in the wrong or unoptimized way here ?
Taper_operator_test.py (20.4 KB) (it takes quite long to run, 5min overall)
I also found a very ugly workaround to « separate » the evaluation of the parameters from the tapering operation as you can see in the end of the notebook. Do you think such separation might be worth investigating in the future (for VQE or other) ?
Sorry for the long post (and the long py file, most of it are coming from the PR ), and have a nice day !
Cheers,
Brian