I am making a Lanczos type algorithm, and when I add two MPS' I am getting a segfault. The relevant code snippet is
V = std::vector<MPS>(actual_maxiter+2);
auto W = std::vector<MPS>(actual_maxiter+2);
auto WP = std::vector<MPS>(actual_maxiter+2);
T = CMatrix(actual_maxiter+2,actual_maxiter+2);
for(auto& el : T) el = Cplx(0,0);
V = psii;
WP = applyMPO(A,V,args);
T(0,0) = innerC(WP,V).real();
auto num = -1*T(0,0);
W = num*V;
psii is an MPS passed into the function, V and T are members of my class. I am getting the segfault from the last line. I have also tried using sum instead of plusEq, and also there is a segfault. What is going wrong?
Also if I shift the positions to match for W and WP, then I get the error "different index structure." Not sure if this last statement is useful information, but I figured I would share.