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);
75 std::cout <<
"Iter = " << iter <<
" Lambda = " << lambda
76 <<
" Two-norm of A*q - lambda*q = "
77 << residual << std::endl;
int NumGlobalElements() const
Number of elements across all processors.
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
virtual int MyPID() const =0
Return my process ID.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
const Epetra_Map & RowMap() const
Returns the Epetra_Map object associated with the rows of this matrix.
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.
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.
int Scale(double ScalarValue)
Scale the current values of a multi-vector, this = ScalarValue*this.
int Dot(const Epetra_MultiVector &A, double *Result) const
Computes dot product of each corresponding pair of vectors.
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
Update multi-vector values with scaled values of A, this = ScalarThis*this + ScalarA*A.
int Random()
Set multi-vector values to random numbers.
int Norm2(double *Result) const
Compute 2-norm of each vector in multi-vector.
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
double power_method(const Epetra_CrsMatrix &A)