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[0] = psii;
WP[0] = applyMPO(A,V[0],args);
T(0,0) = innerC(WP[0],V[0]).real();
auto num = -1*T(0,0);
W[0] = num*V[0];
W[0].plusEq(WP[0]);
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[0] and WP[0], then I get the error "different index structure." Not sure if this last statement is useful information, but I figured I would share.