eigenvalue = origEigenvalue * Math.pow(val,i/2+1);
SpecializedOps.addIdentity(A,M,-eigenvalue);
} else {
// otherwise assume that it was so accurate that the matrix was singular
// and return that result
return new Eigenpair(eigenvalue,b);
}
} else {
hasWorked = true;
b.set(x);
NormOps.normalizeF(b);
// compute the residual
CommonOps.mult(M,b,x);
double error = NormOps.normPInf(x);
if( error-prevError > UtilEjml.EPS*10) {
// if the error increased it is probably converging towards a different
// eigenvalue
// CommonOps.set(b,1);
prevError = Double.MAX_VALUE;
hasWorked = false;
double val = i % 2 == 0 ? 1.0-perp : 1.0 + perp;
eigenvalue = origEigenvalue * Math.pow(val,1);
} else {
// see if it has converged
if(error <= threshold || Math.abs(prevError-error) <= UtilEjml.EPS)
return new Eigenpair(eigenvalue,b);
// update everything
prevError = error;
eigenvalue = VectorVectorMult.innerProdA(b,A,b);
}