Hi Jared and Miles,
thank you for offering help. Please find below the relevant code. It is a function based on gateTEvol with some minor changes. When leaving out the definition "itensor::Spectrum spctr;" and not using spctr later, the code compiles and runs properly. When trying to compile when using spctr, the first error message is "error: no match for ‘operator=’ (operand types are ‘itensor::Spectrum’ and ‘void’)
41 | spctr = rho.svdBond(i1,AA,Fromleft,args);"
Here is the code:
#include "itensor/mps/mpo.h"
#include "itensor/mps/bondgate.h"
#include "itensor/mps/TEvolObserver.h"
inline void gateTEvolMPO_spctr(std::vector<BondGate> const& gatelist,
Real ttotal,
Real tstep,
MPO & rho,
Args args)
{
const int nt = int(ttotal/tstep+(1e-9*(ttotal/tstep)));
itensor::Spectrum spctr;
rho.position(gatelist.front().i1());
int i1, i2, ni1, ni2;
ITensor AA;
for(auto tt : range1(nt))
{
auto g = gatelist.begin();
while(g != gatelist.end())
{
i1 = g->i1();
i2 = g->i2();
AA = rho(i1)*rho(i2)*prime(g->gate());
AA *= swapTags(conj(g->gate()),"Site,1","Site,0");
AA.replaceTags("Site,1","Site,0");
AA.replaceTags("Site,2","Site,1");
++g;
if(g != gatelist.end())
{
//Look ahead to next gate position
ni1 = g->i1();
ni2 = g->i2();
//SVD AA to restore MPO form
//before applying current gate
if(ni1 >= i2)
{
spctr = rho.svdBond(i1,AA,Fromleft,args);
rho.position(ni1); //does no work if position already ni1
}
else
{
spctr = rho.svdBond(i1,AA,Fromright,args);
rho.position(ni2); //does no work if position already ni2
}
}
else
{
//No next gate to analyze, just restore MPO form
spctr = rho.svdBond(i1,AA,Fromright,args);
}
}
}
} // gateTEvolMPO