0 votes
asked by (250 points)


I stumbled upon some very unexpected behavior when doing time evolution with ITensors or IQTensors. I am trying to make use of a symmetry and hence a conserved quantity with IQTensors to speed up the calculations. However, what I found is the complete opposite!
Time evolution with IQTensors is slower than with ITensors.

I originally asked this in the comments in the thread http://itensor.org/support/1391/conserving-difference-of-two-bosonic-species but I have now reproduced the problem with a different SiteSet (one provided with ITensor) so it seems that it is a more generic problem and warrants its own thread.

Here is a minimal example that exhibits the problem. It is a simple chain of spin-1/2 that conserves the total @@Sz@@, and I start with a state with a well-defined @@Sz@@.

#include "itensor/all.h"
#include <iostream>

using namespace itensor;

int main(int argc, char* argv[])
int N = 100;
auto sites = SpinHalf(N);

auto ampo = AutoMPO(sites);
for(int j = 1; j < N; ++j)
    ampo += "S+",j,"S-",j+1;
    ampo += "S-",j,"S+",j+1;

int spin_up = 50;

auto state = InitState(sites);
for(int i = 1; i <= N; ++i)
    if(i == spin_up) state.set(i,"Up");
    else   state.set(i,"Dn");
//auto psi = MPS(state);
auto psi = IQMPS(state);

double tstep = 0.01;
double tcutoff = 1E-12;
int tmaxm = 15;
double ttime = 100;
double tau = 1;

//Real time evolution
//auto expH1 = toExpH<ITensor>(ampo,Cplx_i*tstep*0.5*(1+Cplx_i));
//auto expH2 = toExpH<ITensor>(ampo,Cplx_i*tstep*0.5*(1-Cplx_i));

auto expH1 = toExpH<IQTensor>(ampo,Cplx_i*tstep*0.5*(1+Cplx_i));
auto expH2 = toExpH<IQTensor>(ampo,Cplx_i*tstep*0.5*(1-Cplx_i));

auto args = Args("Cutoff=",tcutoff,"Maxm=",tmaxm);
auto nt = int(ttime/tstep+(1e-9*(ttime/tstep)));
for(int n = 0; n < nt; ++n)
    psi = exactApplyMPO(expH1,psi,args);
    psi = exactApplyMPO(expH2,psi,args);

    if (n % int(tau/tstep) == 0){

return 0;


1 Answer

0 votes
answered by (31.7k points)

Hi, thanks for raising this issue. So this is actually expected when tensors are sufficiently small. In that case the non-trivial overhead of book keeping the QNs can have a noticeable effect. Could you try making the MPS bond dimension bigger and see if the difference persists?


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.