# Improving applyExp()

Hi All,
could someone please tell me what kind of algorithm is used for the actual computation of the exponential? If I want to implement a new function for the actual calculation of the exponential where should I start from? I am asking this because I am facing some convergence issues for which I have to increase the number of iterations in the Krylov procedure to a very large number. Also what does the function expMatrix() returns just a vector or the full matrix exponential?
Maybe I could start from the expokit.f fortran code which have used in the past.

Any suggestion is very appreciated.

Thanks,
Raffaele

Hi Raffaele,

Thanks for reporting an issue. Could you elaborate more on your application? What matrix are you trying to exponentiate and what are you ultimately trying to calculate?

Right now, applyExp uses a pretty standard Krylov-based method for calculating the exponential of an operator applied to a vector (i.e. it builds the Krylov basis and then the Krylov matrix is exponentiated, you can see the implementation here: https://github.com/ITensor/ITensor/blob/7abb7b2760d0608713f846f6bc85f6b6b8c7e509/itensor/iterativesolvers.h#L970).

The current implementation does not have restarts, so it may be limited in the timestep you can input (i.e. if you are calculating exp(-t*H)*v, for large t it may have convergence issues). We would be happy to add in restarts if there is a compelling use case, but we were waiting for a concrete example where that is necessary. For example, in the main use case for us (TDVP), the time step can be taken smaller by doing more sweeps of the MPS, and we have found that the current implementation is sufficient.

Also right now, consider that you can split up your timestep and do multiple calls of applyExp, for example you can try:

auto expHv = applyExp(H,v,-t/2);
expHv = applyExp(H,expHv,-t/2);


auto expHv = applyExp(H,v,-t);


if your timestep t is too large for convergence. For a fixed ErrGoal you of course accumulate the error of both calls of applyExp.

Cheers,
Matt

commented by (310 points)
It would be great to have restart capabilities in the Lanczos procedure, meanwhile I will run the calculations with a shorter timestep.
commented by (260 points)
Hi Lello,

Have you solved the problem? or modified the applyExp() function with your zgexpv() function? Because I have met a similar question recently that my MPO is non-Hermite, So I need a generalized function to do this.

Best,
Meng
commented by (310 points)
Hi,
I solved the problem by reducing the time step but I didn't modify the applyExp() function.
It shouldn't be too difficult though.
(BTW, I also work on the use of TT to solve HEOM.)
commented by (260 points)
Hi Lello,

That's cool to hear that you apply TT solve HEOM. I have some experience in developing HEOM approach that may provide some help if you need it. Actually, I am currently trying to apply ITensor to rewrite HEOM.

Best,
Meng
commented by (260 points)
I just realize that you are  Raffaele Borrelli! I always focus on your works related to HEOM/tensor network since 2019 and very enjoy your recently tAMEn applications!