# Difference between "Fit" and "DensityMatrix" for ApplyMPO

+1 vote

Hi,

I was wondering the difference between these two methods? I am writing code that implements a Lanczos algorithm, and thus I need to multiply an MPS by an MPO many times. However, I noticed that using the Fit method, I actually get the wrong answer, while with DensityMatrix I get the correct answer. Any idea why?

commented by (35.1k points)
http://itensor.org/docs.cgi?vers=cppv3&page=classes/mps_mpo_algs
commented by (360 points)
Wonderful, thank you Miles!

+1 vote

Hello,

The "DensityMatrix" algorithm is described here:

http://tensornetwork.org/mps/algorithms/denmat_mpo_mps/

It is a direct method (in that it only requires one sweep over the system), and is very reliable. However, it's accuracy may be limited to around 1e-8, because it relies on forming the density matrix which involves squaring the singular values, which can decrease the precision (but that is only an issue if you need very high precision).

The "Fit" algorithm involves variationally optimizing the overlap between an initial guess MPS and the MPO*MPS you are interesting in approximating with a sweeping algorithm similar to DMRG. It is known to get "stuck" (i.e. not find the correct MPS approximation) if the initial guess is not very good, or may take a lot of sweeps to converge (so you may want to try increasing the number of sweeps). This algorithm scales better with the bond dimensions of the input MPS/MPO compared to the "DensityMatrix" method.

If in your code applying the MPO to the MPS is not a performance bottleneck, and you do not need very high precision for your final MPS, then the "DensityMatrix" method is better to use. Otherwise, you will need to use the "Fit" method (and possibly play around with finding a better initial guess in order to get it to converge properly).

Cheers,
Matt

commented by (360 points)
Hi Matt,

Thank you for the answer. The MPO MPS products is essentially my entire calculation, so efficiency is ideal. I was unaware that it is known to get stuck, so I will play around with the options!

Best,
Nick