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

+1 vote
asked Sep 1 by greg (150 points)


When using fitApplyMPO to perform some unitary time-evolution, exactly as in, 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 !


1 Answer

+1 vote
answered Sep 8 by miles (16,940 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/

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.


commented Sep 13 by greg (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.
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.