54 double tolerance = 1.0e-10;
65 while (iter==0 || (iter < niters && residual > tolerance)) {
67 q.Scale(1.0/normz, z);
70 if (iter%10==0 || iter+1==niters) {
72 resid.Update(1.0, z, -lambda, q, 0.0);
73 resid.Norm2(&residual);
74 if (q.Map().Comm().MyPID()==0)
75 std::cout <<
"Iter = " << iter <<
" Lambda = " << lambda
76 <<
" Two-norm of A*q - lambda*q = " 77 << residual << std::endl;
const Epetra_Map & RowMap() const
Returns the Epetra_Map object associated with the rows of this matrix.
int Random()
Set multi-vector values to random numbers.
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
Returns the result of a Epetra_CrsMatrix multiplied by a Epetra_Vector x in y.
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
int NumGlobalElements() const
Number of elements across all processors.
double power_method(const Epetra_CrsMatrix &A)