53 int niters =
A.RowMap().NumGlobalElements()*10;
54 double tolerance = 1.0e-10;
65 while (iter==0 || (iter < niters && residual > tolerance)) {
67 q.Scale(1.0/normz, z);
68 A.Multiply(
false, q, 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;
int Random()
Set multi-vector values to random numbers.
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...
double power_method(const Epetra_CrsMatrix &A)