43 #ifndef IFPACK_POLYNOMIAL_H 44 #define IFPACK_POLYNOMIAL_H 46 #include "Ifpack_ConfigDefs.h" 47 #include "Ifpack_Preconditioner.h" 48 #include "Teuchos_RefCountPtr.hpp" 49 #include "Teuchos_LAPACK.hpp" 50 #include "Teuchos_SerialDenseMatrix.hpp" 56 class Epetra_MultiVector;
62 class Epetra_Operator;
63 class Epetra_RowMatrix;
65 #ifdef HAVE_IFPACK_EPETRAEXT 66 class EpetraExt_PointToBlockDiagPermute;
133 UseTranspose_ = UseTranspose_in;
150 virtual inline int Apply(
const Epetra_MultiVector& X, Epetra_MultiVector& Y)
const;
163 virtual int ApplyInverse(
const Epetra_MultiVector& X, Epetra_MultiVector& Y)
const;
174 virtual const char * Label()
const 176 return(Label_.c_str());
182 return(UseTranspose_);
192 virtual const Epetra_Comm &
Comm()
const;
204 return(IsInitialized_);
218 virtual const Epetra_RowMatrix&
Matrix()
const 224 virtual double Condest(
const Ifpack_CondestType CT = Ifpack_Cheap,
225 const int MaxIters = 1550,
226 const double Tol = 1e-9,
227 Epetra_RowMatrix* Matrix_in = 0);
239 virtual std::ostream&
Print(std::ostream & os)
const;
248 return(NumInitialize_);
260 return(NumApplyInverse_);
266 return(InitializeTime_);
272 return(ComputeTime_);
278 return(ApplyInverseTime_);
290 return(ComputeFlops_);
296 return(ApplyInverseFlops_);
303 static int PowerMethod(
const Epetra_Operator& Operator,
304 const Epetra_Vector& InvPointDiagonal,
305 const int MaximumIterations,
309 static int CG(
const Epetra_Operator& Operator,
310 const Epetra_Vector& InvPointDiagonal,
311 const int MaximumIterations,
312 double& lambda_min,
double& lambda_max);
314 #ifdef HAVE_IFPACK_EPETRAEXT 317 int CG(
const int MaximumIterations,
318 double& lambda_min,
double& lambda_max);
321 int PowerMethod(
const int MaximumIterations,
double& lambda_max);
325 int GMRES(
const Epetra_Operator& Operator,
326 const Epetra_Vector& InvPointDiagonal,
327 const int MaximumIterations,
328 double& lambda_real_min,
double& lambda_real_max,
329 double& lambda_imag_min,
double& lambda_imag_max);
337 virtual void SetLabel();
363 mutable int NumApplyInverse_;
365 double InitializeTime_;
369 mutable double ApplyInverseTime_;
371 double ComputeFlops_;
373 mutable double ApplyInverseFlops_;
380 int LSPointsReal_, LSPointsImag_;
389 bool ComputeCondest_;
391 double RealEigRatio_, ImagEigRatio_;
399 double LambdaRealMin_, LambdaRealMax_, LambdaImagMin_, LambdaImagMax_;
401 double MinDiagonalValue_;
403 std::vector<double> coeff_;
411 long long NumGlobalRows_;
413 long long NumGlobalNonzeros_;
415 Teuchos::RefCountPtr<const Epetra_Operator> Operator_;
417 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
419 mutable Teuchos::RefCountPtr<Epetra_Vector> InvDiagonal_;
422 #ifdef HAVE_IFPACK_EPETRAEXT 423 Teuchos::ParameterList BlockList_;
425 Teuchos::RefCountPtr<EpetraExt_PointToBlockDiagPermute> InvBlockDiagonal_;
430 bool SolveNormalEquations_;
435 Teuchos::RefCountPtr<Epetra_Time> Time_;
437 bool ZeroStartingSolution_;
444 #endif // IFPACK_POLYNOMIAL_H 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 IsComputed() const
Returns true if the preconditioner has been successfully computed.
virtual double ApplyInverseFlops() const
Returns the number of flops for the application of the preconditioner.
virtual double ApplyInverseTime() const
Returns the time spent in ApplyInverse().
virtual std::ostream & Print(std::ostream &os) const
Prints object to an output stream.
virtual int Initialize()
Computes all it is necessary to initialize the preconditioner.
virtual double InitializeTime() const
Returns the time spent in Initialize().
virtual int SetUseTranspose(bool UseTranspose_in)
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the preconditioner to X, returns the result in Y.
virtual bool IsInitialized() const
Returns true if the preconditioner has been successfully initialized, false otherwise.
virtual double ComputeFlops() const
Returns the number of flops in the computation phase.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the matrix to an Epetra_MultiVector.
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 ~Ifpack_Polynomial()
Destructor.
virtual int Compute()
Computes the preconditioners.
virtual int NumApplyInverse() const
Returns the number of calls to ApplyInverse().
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.
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.
Ifpack_Polynomial(const Epetra_Operator *Matrix)
Ifpack_Polynomial constructor with given Epetra_Operator/Epetra_RowMatrix.
virtual const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
virtual int SetParameters(Teuchos::ParameterList &List)
Sets all the parameters for the preconditioner.
virtual double InitializeFlops() const
Returns the number of flops in the initialization phase.
virtual double ComputeTime() const
Returns the time spent in Compute().
Ifpack_Polynomial: class for preconditioning with least squares polynomials in Ifpack.
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
virtual int NumInitialize() const
Returns the number of calls to Initialize().
static int PowerMethod(const Epetra_Operator &Operator, const Epetra_Vector &InvPointDiagonal, const int MaximumIterations, double &LambdaMax)
Simple power method to compute lambda_max.
virtual int NumCompute() const
Returns the number of calls to Compute().
virtual double NormInf() const
Returns the infinity norm of the global matrix (not implemented)
virtual const Epetra_RowMatrix & Matrix() const
Returns a pointer to the matrix to be preconditioned.