43 #include "Ifpack_ConfigDefs.h" 45 #include "Epetra_Operator.h" 46 #include "Epetra_RowMatrix.h" 47 #include "Epetra_Comm.h" 48 #include "Epetra_Map.h" 49 #include "Epetra_MultiVector.h" 50 #include "Epetra_Vector.h" 51 #include "Epetra_Time.h" 52 #include "Ifpack_Polynomial.h" 54 #include "Ifpack_Condest.h" 55 #include "Teuchos_LAPACK.hpp" 56 #include "Teuchos_SerialDenseMatrix.hpp" 58 #ifdef HAVE_IFPACK_AZTECOO 59 #include "Ifpack_DiagPreconditioner.h" 63 #ifdef HAVE_IFPACK_EPETRAEXT 64 #include "Epetra_CrsMatrix.h" 65 #include "EpetraExt_PointToBlockDiagPermute.h" 69 #define ABS(x) ((x)>0?(x):-(x)) 72 inline void Apply_Transpose(Teuchos::RCP<const Epetra_Operator> Operator_,
const Epetra_MultiVector &X,Epetra_MultiVector &Y){
73 Epetra_Operator * Operator=
const_cast<Epetra_Operator*
>(&*Operator_);
74 Operator->SetUseTranspose(
true);
76 Operator->SetUseTranspose(
false);
87 IsInitialized_(false),
96 ApplyInverseTime_(0.0),
98 ApplyInverseFlops_(0.0),
102 UseTranspose_(false),
104 ComputeCondest_(false),
109 LambdaRealMax_(-1.0),
112 MinDiagonalValue_(0.0),
116 NumGlobalNonzeros_(0),
117 Operator_(
Teuchos::rcp(Operator,false)),
118 UseBlockMode_(false),
119 SolveNormalEquations_(false),
121 ZeroStartingSolution_(true)
136 IsInitialized_(false),
138 IsIndefinite_(false),
143 InitializeTime_(0.0),
145 ApplyInverseTime_(0.0),
147 ApplyInverseFlops_(0.0),
151 UseTranspose_(false),
153 ComputeCondest_(false),
159 LambdaRealMax_(-1.0),
162 MinDiagonalValue_(0.0),
166 NumGlobalNonzeros_(0),
167 Operator_(
Teuchos::rcp(Operator,false)),
168 Matrix_(
Teuchos::rcp(Operator,false)),
169 UseBlockMode_(false),
170 SolveNormalEquations_(false),
172 ZeroStartingSolution_(true)
180 RealEigRatio_ = List.get(
"polynomial: real eigenvalue ratio", RealEigRatio_);
181 ImagEigRatio_ = List.get(
"polynomial: imag eigenvalue ratio", ImagEigRatio_);
182 LambdaRealMin_ = List.get(
"polynomial: min real part", LambdaRealMin_);
183 LambdaRealMax_ = List.get(
"polynomial: max real part", LambdaRealMax_);
184 LambdaImagMin_ = List.get(
"polynomial: min imag part", LambdaImagMin_);
185 LambdaImagMax_ = List.get(
"polynomial: max imag part", LambdaImagMax_);
186 PolyDegree_ = List.get(
"polynomial: degree",PolyDegree_);
187 LSPointsReal_ = List.get(
"polynomial: real interp points",LSPointsReal_);
188 LSPointsImag_ = List.get(
"polynomial: imag interp points",LSPointsImag_);
189 IsIndefinite_ = List.get(
"polynomial: indefinite",IsIndefinite_);
190 IsComplex_ = List.get(
"polynomial: complex",IsComplex_);
191 MinDiagonalValue_ = List.get(
"polynomial: min diagonal value",
193 ZeroStartingSolution_ = List.get(
"polynomial: zero starting solution",
194 ZeroStartingSolution_);
196 Epetra_Vector* ID = List.get(
"polynomial: operator inv diagonal",
198 EigMaxIters_ = List.get(
"polynomial: eigenvalue max iterations",EigMaxIters_);
200 #ifdef HAVE_IFPACK_EPETRAEXT 202 UseBlockMode_ = List.get(
"polynomial: use block mode",UseBlockMode_);
203 if(!List.isParameter(
"polynomial: block list")) UseBlockMode_=
false;
205 BlockList_ = List.get(
"polynomial: block list",BlockList_);
209 Teuchos::ParameterList Blist;
210 Blist=BlockList_.get(
"blockdiagmatrix: list",Blist);
211 string dummy(
"invert");
212 string ApplyMode=Blist.get(
"apply mode",dummy);
213 if(ApplyMode==
string(
"multiply")){
214 Blist.set(
"apply mode",
"invert");
215 BlockList_.set(
"blockdiagmatrix: list",Blist);
220 SolveNormalEquations_ = List.get(
"polynomial: solve normal equations",SolveNormalEquations_);
224 InvDiagonal_ = Teuchos::rcp(
new Epetra_Vector(*ID) );
235 return(Operator_->Comm());
241 return(Operator_->OperatorDomainMap());
247 return(Operator_->OperatorRangeMap());
252 Apply(
const Epetra_MultiVector& X, Epetra_MultiVector& Y)
const 257 if (X.NumVectors() != Y.NumVectors())
266 IFPACK_CHK_ERR(Operator_->Apply(X,Y));
275 IsInitialized_ =
false;
277 if (Operator_ == Teuchos::null)
280 if (Time_ == Teuchos::null)
281 Time_ = Teuchos::rcp(
new Epetra_Time(
Comm()) );
285 if (
Matrix().NumGlobalRows() !=
Matrix().NumGlobalCols())
288 NumMyRows_ = Matrix_->NumMyRows();
289 NumMyNonzeros_ = Matrix_->NumMyNonzeros();
290 NumGlobalRows_ = Matrix_->NumGlobalRows();
291 NumGlobalNonzeros_ = Matrix_->NumGlobalNonzeros();
295 if (Operator_->OperatorDomainMap().NumGlobalElements() !=
296 Operator_->OperatorRangeMap().NumGlobalElements())
301 InitializeTime_ += Time_->ElapsedTime();
302 IsInitialized_ =
true;
312 Time_->ResetStartTime();
318 if (PolyDegree_ <= 0)
321 #ifdef HAVE_IFPACK_EPETRAEXT 323 if(IsRowMatrix_ && InvDiagonal_ == Teuchos::null && UseBlockMode_){
324 const Epetra_CrsMatrix *CrsMatrix=
dynamic_cast<const Epetra_CrsMatrix*
>(&*Matrix_);
327 if(!CrsMatrix) UseBlockMode_=
false;
330 InvBlockDiagonal_=Teuchos::rcp(
new EpetraExt_PointToBlockDiagPermute(*CrsMatrix));
331 if(InvBlockDiagonal_==Teuchos::null) IFPACK_CHK_ERR(-6);
333 ierr=InvBlockDiagonal_->SetParameters(BlockList_);
334 if(ierr) IFPACK_CHK_ERR(-7);
336 ierr=InvBlockDiagonal_->Compute();
337 if(ierr) IFPACK_CHK_ERR(-8);
341 if (IsRowMatrix_ && InvDiagonal_ == Teuchos::null && !UseBlockMode_)
343 InvDiagonal_ = Teuchos::rcp(
new Epetra_Vector(
Matrix().Map()) );
345 if (InvDiagonal_ == Teuchos::null)
348 IFPACK_CHK_ERR(
Matrix().ExtractDiagonalCopy(*InvDiagonal_));
352 for (
int i = 0 ; i < NumMyRows_ ; ++i) {
353 double diag = (*InvDiagonal_)[i];
354 if (IFPACK_ABS(diag) < MinDiagonalValue_)
355 (*InvDiagonal_)[i] = MinDiagonalValue_;
357 (*InvDiagonal_)[i] = 1.0 / diag;
362 double lambda_real_min, lambda_real_max, lambda_imag_min, lambda_imag_max;
363 if (LambdaRealMax_ == -1) {
365 GMRES(
Matrix(), *InvDiagonal_, EigMaxIters_, lambda_real_min, lambda_real_max, lambda_imag_min, lambda_imag_max);
366 LambdaRealMin_=lambda_real_min; LambdaImagMin_=lambda_imag_min;
367 LambdaRealMax_=lambda_real_max; LambdaImagMax_=lambda_imag_max;
378 std::complex<double> zero(0.0,0.0);
379 std::complex<double> one(1.0,0.0);
382 double lenx = LambdaRealMax_-LambdaRealMin_;
383 int nx = ceil(lenx*((
double) LSPointsReal_));
384 if (nx<2) { nx = 2; }
385 double hx = lenx/((double) nx);
386 std::vector<double> xs;
387 if(abs(lenx)>1.0e-8) {
388 for(
int pt=0; pt<=nx; pt++ ) {
389 xs.push_back(hx*pt+LambdaRealMin_);
393 xs.push_back(LambdaRealMax_);
396 double leny = LambdaImagMax_-LambdaImagMin_;
397 int ny = ceil(leny*((
double) LSPointsImag_));
398 if (ny<2) { ny = 2; }
399 double hy = leny/((double) ny);
400 std::vector<double> ys;
401 if(abs(leny)>1.0e-8) {
402 for(
int pt=0; pt<=ny; pt++ ) {
403 ys.push_back(hy*pt+LambdaImagMin_);
407 ys.push_back(LambdaImagMax_);
410 std::vector< std::complex<double> > cpts;
411 for(
int jj=0; jj<ny; jj++ ) {
412 for(
int ii=0; ii<nx; ii++ ) {
413 std::complex<double> cpt(xs[ii],ys[jj]);
417 cpts.push_back(zero);
419 #ifdef HAVE_TEUCHOS_COMPLEX 422 Teuchos::SerialDenseMatrix< int,std::complex<double> > Vmatrix(cpts.size(),PolyDegree_+1);
423 Vmatrix.putScalar(zero);
424 for(
int jj=0; jj<=PolyDegree_; jj++) {
425 for(
int ii=0; ii<cpts.size()-1; ii++) {
427 Vmatrix(ii,jj)=pow(cpts[ii],jj);
434 Vmatrix(cpts.size()-1,0)=one;
437 Teuchos::SerialDenseMatrix< int,std::complex<double> > RHS(cpts.size(),1);
439 RHS(cpts.size()-1,0)=one;
442 Teuchos::LAPACK< int, std::complex<double> > lapack;
443 const int N = Vmatrix.numCols();
444 Teuchos::Array<double> singularValues(N);
445 Teuchos::Array<double> rwork(1);
446 rwork.resize (std::max (1, 5 * N));
447 std::complex<double> lworkScalar(1.0,0.0);
449 lapack.GELS(
'N', Vmatrix.numRows(), Vmatrix.numCols(), RHS.numCols(),
450 Vmatrix.values(), Vmatrix.numRows(), RHS.values(), RHS.numRows(),
451 &lworkScalar, -1, &info);
452 TEUCHOS_TEST_FOR_EXCEPTION(info != 0, std::logic_error,
453 "_GELSS workspace query returned INFO = " 454 << info <<
" != 0.");
455 const int lwork =
static_cast<int> (real(lworkScalar));
456 TEUCHOS_TEST_FOR_EXCEPTION(lwork < 0, std::logic_error,
457 "_GELSS workspace query returned LWORK = " 458 << lwork <<
" < 0.");
460 Teuchos::Array< std::complex<double> > work (std::max (1, lwork));
462 lapack.GELS(
'N', Vmatrix.numRows(), Vmatrix.numCols(), RHS.numCols(),
463 Vmatrix.values(), Vmatrix.numRows(), RHS.values(), RHS.numRows(),
464 &work[0], lwork, &info);
466 coeff_.resize(PolyDegree_+1);
467 std::complex<double> c0=RHS(0,0);
468 for(
int ii=0; ii<=PolyDegree_; ii++) {
473 coeff_[ii]=real(RHS(ii,0)/c0);
480 Teuchos::SerialDenseMatrix< int, double > Vmatrix(xs.size()+1,PolyDegree_+1);
481 Vmatrix.putScalar(0.0);
482 for(
int jj=0; jj<=PolyDegree_; jj++) {
483 for(
int ii=0; ii<xs.size(); ii++) {
485 Vmatrix(ii,jj)=pow(xs[ii],jj);
492 Vmatrix(xs.size(),0)=1.0;
495 Teuchos::SerialDenseMatrix< int, double > RHS(xs.size()+1,1);
497 RHS(xs.size(),0)=1.0;
500 Teuchos::LAPACK< int, double > lapack;
501 const int N = Vmatrix.numCols();
502 Teuchos::Array<double> singularValues(N);
503 Teuchos::Array<double> rwork(1);
504 rwork.resize (std::max (1, 5 * N));
505 double lworkScalar(1.0);
507 lapack.GELS(
'N', Vmatrix.numRows(), Vmatrix.numCols(), RHS.numCols(),
508 Vmatrix.values(), Vmatrix.numRows(), RHS.values(), RHS.numRows(),
509 &lworkScalar, -1, &info);
510 TEUCHOS_TEST_FOR_EXCEPTION(info != 0, std::logic_error,
511 "_GELSS workspace query returned INFO = " 512 << info <<
" != 0.");
513 const int lwork =
static_cast<int> (lworkScalar);
514 TEUCHOS_TEST_FOR_EXCEPTION(lwork < 0, std::logic_error,
515 "_GELSS workspace query returned LWORK = " 516 << lwork <<
" < 0.");
518 Teuchos::Array< double > work (std::max (1, lwork));
520 lapack.GELS(
'N', Vmatrix.numRows(), Vmatrix.numCols(), RHS.numCols(),
521 Vmatrix.values(), Vmatrix.numRows(), RHS.values(), RHS.numRows(),
522 &work[0], lwork, &info);
524 coeff_.resize(PolyDegree_+1);
526 for(
int ii=0; ii<=PolyDegree_; ii++) {
531 coeff_[ii]=RHS(ii,0)/c0;
536 #ifdef IFPACK_FLOPCOUNTERS 537 ComputeFlops_ += NumMyRows_;
541 ComputeTime_ += Time_->ElapsedTime();
551 double MyMinVal, MyMaxVal;
552 double MinVal, MaxVal;
555 InvDiagonal_->MinValue(&MyMinVal);
556 InvDiagonal_->MaxValue(&MyMaxVal);
557 Comm().MinAll(&MyMinVal,&MinVal,1);
558 Comm().MinAll(&MyMaxVal,&MaxVal,1);
561 if (!
Comm().MyPID()) {
563 os <<
"================================================================================" << endl;
564 os <<
"Ifpack_Polynomial" << endl;
565 os <<
"Degree of polynomial = " << PolyDegree_ << endl;
566 os <<
"Condition number estimate = " <<
Condest() << endl;
567 os <<
"Global number of rows = " << Operator_->OperatorRangeMap().NumGlobalElements() << endl;
569 os <<
"Minimum value on stored inverse diagonal = " << MinVal << endl;
570 os <<
"Maximum value on stored inverse diagonal = " << MaxVal << endl;
572 if (ZeroStartingSolution_)
573 os <<
"Using zero starting solution" << endl;
575 os <<
"Using input starting solution" << endl;
577 os <<
"Phase # calls Total Time (s) Total MFlops MFlops/s" << endl;
578 os <<
"----- ------- -------------- ------------ --------" << endl;
579 os <<
"Initialize() " << std::setw(5) << NumInitialize_
580 <<
" " << std::setw(15) << InitializeTime_
581 <<
" 0.0 0.0" << endl;
582 os <<
"Compute() " << std::setw(5) << NumCompute_
583 <<
" " << std::setw(15) << ComputeTime_
584 <<
" " << std::setw(15) << 1.0e-6 * ComputeFlops_;
585 if (ComputeTime_ != 0.0)
586 os <<
" " << std::setw(15) << 1.0e-6 * ComputeFlops_ / ComputeTime_ << endl;
588 os <<
" " << std::setw(15) << 0.0 << endl;
589 os <<
"ApplyInverse() " << std::setw(5) << NumApplyInverse_
590 <<
" " << std::setw(15) << ApplyInverseTime_
591 <<
" " << std::setw(15) << 1.0e-6 * ApplyInverseFlops_;
592 if (ApplyInverseTime_ != 0.0)
593 os <<
" " << std::setw(15) << 1.0e-6 * ApplyInverseFlops_ / ApplyInverseTime_ << endl;
595 os <<
" " << std::setw(15) << 0.0 << endl;
596 os <<
"================================================================================" << endl;
606 const int MaxIters,
const double Tol,
607 Epetra_RowMatrix* Matrix_in)
614 Condest_ = Ifpack_Condest(*
this, CT, MaxIters, Tol, Matrix_in);
620 void Ifpack_Polynomial::SetLabel()
622 Label_ =
"IFPACK (Least squares polynomial), degree=" +
Ifpack_toString(PolyDegree_);
633 if (PolyDegree_ == 0)
636 int nVec = X.NumVectors();
637 if (nVec != Y.NumVectors())
640 Time_->ResetStartTime();
642 Epetra_MultiVector Xcopy(X);
643 if(ZeroStartingSolution_==
true) {
647 #ifdef HAVE_IFPACK_EPETRAEXT 648 EpetraExt_PointToBlockDiagPermute* IBD=0;
649 if (UseBlockMode_) IBD=&*InvBlockDiagonal_;
652 Y.Update(-coeff_[1], Xcopy, 1.0);
653 for(
int ii=2; ii<coeff_.size(); ii++) {
654 const Epetra_MultiVector V(Xcopy);
655 Operator_->Apply(V,Xcopy);
656 Xcopy.Multiply(1.0, *InvDiagonal_, Xcopy, 0.0);
658 Y.Update(-coeff_[ii], Xcopy, 1.0);
663 ApplyInverseTime_ += Time_->ElapsedTime();
670 const Epetra_Vector& InvPointDiagonal,
671 const int MaximumIterations,
676 double RQ_top, RQ_bottom, norm;
677 Epetra_Vector x(Operator.OperatorDomainMap());
678 Epetra_Vector y(Operator.OperatorRangeMap());
681 if (norm == 0.0) IFPACK_CHK_ERR(-1);
685 for (
int iter = 0; iter < MaximumIterations; ++iter)
687 Operator.Apply(x, y);
688 IFPACK_CHK_ERR(y.Multiply(1.0, InvPointDiagonal, y, 0.0));
689 IFPACK_CHK_ERR(y.Dot(x, &RQ_top));
690 IFPACK_CHK_ERR(x.Dot(x, &RQ_bottom));
691 lambda_max = RQ_top / RQ_bottom;
692 IFPACK_CHK_ERR(y.Norm2(&norm));
693 if (norm == 0.0) IFPACK_CHK_ERR(-1);
694 IFPACK_CHK_ERR(x.Update(1.0 / norm, y, 0.0));
702 CG(
const Epetra_Operator& Operator,
703 const Epetra_Vector& InvPointDiagonal,
704 const int MaximumIterations,
705 double& lambda_min,
double& lambda_max)
707 #ifdef HAVE_IFPACK_AZTECOO 708 Epetra_Vector x(Operator.OperatorDomainMap());
709 Epetra_Vector y(Operator.OperatorRangeMap());
713 Epetra_LinearProblem LP(const_cast<Epetra_Operator*>(&Operator), &x, &y);
715 solver.SetAztecOption(AZ_solver, AZ_cg_condnum);
716 solver.SetAztecOption(AZ_output, AZ_none);
719 Operator.OperatorRangeMap(),
721 solver.SetPrecOperator(&diag);
722 solver.Iterate(MaximumIterations, 1e-10);
724 const double* status = solver.GetAztecStatus();
726 lambda_min = status[AZ_lambda_min];
727 lambda_max = status[AZ_lambda_max];
731 cout <<
"You need to configure IFPACK with support for AztecOO" << endl;
732 cout <<
"to use the CG estimator. This may require --enable-aztecoo" << endl;
733 cout <<
"in your configure script." << endl;
739 #ifdef HAVE_IFPACK_EPETRAEXT 741 PowerMethod(
const int MaximumIterations,
double& lambda_max)
744 if(!UseBlockMode_) IFPACK_CHK_ERR(-1);
747 double RQ_top, RQ_bottom, norm;
748 Epetra_Vector x(Operator_->OperatorDomainMap());
749 Epetra_Vector y(Operator_->OperatorRangeMap());
750 Epetra_Vector z(Operator_->OperatorRangeMap());
753 if (norm == 0.0) IFPACK_CHK_ERR(-1);
757 for (
int iter = 0; iter < MaximumIterations; ++iter)
759 Operator_->Apply(x, z);
760 InvBlockDiagonal_->ApplyInverse(z,y);
761 if(SolveNormalEquations_){
762 InvBlockDiagonal_->ApplyInverse(y,z);
763 Apply_Transpose(Operator_,z, y);
766 IFPACK_CHK_ERR(y.Dot(x, &RQ_top));
767 IFPACK_CHK_ERR(x.Dot(x, &RQ_bottom));
768 lambda_max = RQ_top / RQ_bottom;
769 IFPACK_CHK_ERR(y.Norm2(&norm));
770 if (norm == 0.0) IFPACK_CHK_ERR(-1);
771 IFPACK_CHK_ERR(x.Update(1.0 / norm, y, 0.0));
779 #ifdef HAVE_IFPACK_EPETRAEXT 781 CG(
const int MaximumIterations,
782 double& lambda_min,
double& lambda_max)
787 if(!UseBlockMode_) IFPACK_CHK_ERR(-1);
789 #ifdef HAVE_IFPACK_AZTECOO 790 Epetra_Vector x(Operator_->OperatorDomainMap());
791 Epetra_Vector y(Operator_->OperatorRangeMap());
794 Epetra_LinearProblem LP(const_cast<Epetra_RowMatrix*>(&*Matrix_), &x, &y);
797 solver.SetAztecOption(AZ_solver, AZ_cg_condnum);
798 solver.SetAztecOption(AZ_output, AZ_none);
800 solver.SetPrecOperator(&*InvBlockDiagonal_);
801 solver.Iterate(MaximumIterations, 1e-10);
803 const double* status = solver.GetAztecStatus();
805 lambda_min = status[AZ_lambda_min];
806 lambda_max = status[AZ_lambda_max];
810 cout <<
"You need to configure IFPACK with support for AztecOO" << endl;
811 cout <<
"to use the CG estimator. This may require --enable-aztecoo" << endl;
812 cout <<
"in your configure script." << endl;
820 GMRES(
const Epetra_Operator& Operator,
821 const Epetra_Vector& InvPointDiagonal,
822 const int MaximumIterations,
823 double& lambda_real_min,
double& lambda_real_max,
824 double& lambda_imag_min,
double& lambda_imag_max)
826 #ifdef HAVE_IFPACK_AZTECOO 827 Epetra_Vector x(Operator_->OperatorDomainMap());
828 Epetra_Vector y(Operator_->OperatorRangeMap());
831 Epetra_LinearProblem LP(const_cast<Epetra_RowMatrix*>(&*Matrix_), &x, &y);
833 solver.SetAztecOption(AZ_solver, AZ_gmres_condnum);
834 solver.SetAztecOption(AZ_output, AZ_none);
836 Operator.OperatorRangeMap(),
838 solver.SetPrecOperator(&diag);
839 solver.Iterate(MaximumIterations, 1e-10);
840 const double* status = solver.GetAztecStatus();
841 lambda_real_min = status[AZ_lambda_real_min];
842 lambda_real_max = status[AZ_lambda_real_max];
843 lambda_imag_min = status[AZ_lambda_imag_min];
844 lambda_imag_max = status[AZ_lambda_imag_max];
847 cout <<
"You need to configure IFPACK with support for AztecOO" << endl;
848 cout <<
"to use the GMRES estimator. This may require --enable-aztecoo" << endl;
849 cout <<
"in your configure script." << endl;
int GMRES(const Epetra_Operator &Operator, const Epetra_Vector &InvPointDiagonal, const int MaximumIterations, double &lambda_real_min, double &lambda_real_max, double &lambda_imag_min, double &lambda_imag_max)
Uses AztecOO's GMRES to estimate the height and width of the spectrum.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
virtual ostream & Print(ostream &os) const
Prints object to an output stream.
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the preconditioner to X, returns the result in Y.
virtual int Initialize()
Computes all it is necessary to initialize the preconditioner.
Ifpack_DiagPreconditioner: a class for diagonal preconditioning.
string Ifpack_toString(const int &x)
Convertes an integer to string.
static int CG(const Epetra_Operator &Operator, const Epetra_Vector &InvPointDiagonal, const int MaximumIterations, double &lambda_min, double &lambda_max)
Uses AztecOO's CG to estimate lambda_min and lambda_max.
virtual int Compute()
Computes the preconditioners.
virtual bool IsInitialized() const
Returns true if the preconditioner has been successfully initialized, false otherwise.
Ifpack_Polynomial(const Epetra_Operator *Matrix)
Ifpack_Polynomial constructor with given Epetra_Operator/Epetra_RowMatrix.
virtual int SetParameters(Teuchos::ParameterList &List)
Sets all the parameters for the preconditioner.
virtual bool IsComputed() const
Returns true if the preconditioner has been successfully computed.
virtual const Epetra_RowMatrix & Matrix() const
Returns a pointer to the matrix to be preconditioned.
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the matrix to an Epetra_MultiVector.
static int PowerMethod(const Epetra_Operator &Operator, const Epetra_Vector &InvPointDiagonal, const int MaximumIterations, double &LambdaMax)
Simple power method to compute lambda_max.
virtual const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
virtual double Condest() const
Returns the condition number estimate, or -1.0 if not computed.