# How to get the "discarded weight" when using fitApplyMPO ?

+1 vote

Hi,

When using fitApplyMPO to perform some unitary time-evolution, exactly as in http://itensor.org/docs.cgi?page=formulas/tevol_mps_mpo, what would be the simplest way to get the "discarded weight" after one time step ? (assuming that Cutoff is sufficiently small, so that the new bond dimension is actually set by Maxm).

Thanks a lot !

G.

+1 vote
answered Sep 8 by (19,400 points)

Hi, good question about this. Currently it's not a feature the present code offers. The truncation happens deep inside a set of function calls and I didn't put in the chain of return values to pass the discarded weight values back out. Also it's a bit complicated to define a single discarded weight value on each bond because the truncation is done block-by-block looping over blocks of quantum number conserving tensors.

But a simple fix for your purposes could be to modify the code to print out the discarded weigh at each bond, combined or averaged in some way over the blocks.

Here's what you could do: the relevant function is compressMPO, defined near line 1143 of the file itensor/mps/autompo.cc

There is a loop on line 1184 over QN-Matrix pairs called "qb" (quantum number & block). Each block is converted to a Matrix object and a non-truncating SVD is performed on it (the call to SVD on line 1196). Then the singular values are truncated by the call to truncate on line 1200.

The truncate function on line 1200 returns a std::tuple<Real,Real>, the first entry of which is the truncation error. So you can grab this truncation error as follows:

Real truncerr=0, docut=0;
std::tie(truncerr,docut) = truncate(D,maxm,minm,cutoff);

and then you could either print all the truncerr values or take a max or average of them at each bond, say.

I hope that helps - please let me know if you have a suggestion about how this could be improved in the library in a more permanent way that people could use in the future.

Miles

commented Sep 13 by (150 points)
Miles, thank you *very much* for this detailed answer. For the moment I will implement  your suggestion (some prints in compressMPO), but I will of course let you know if I come with some other idea that could be added in the library.