00001 #ifndef IFPACK_CHEBYSHEV_H
00002 #define IFPACK_CHEBYSHEV_H
00003
00004 #include "Ifpack_ConfigDefs.h"
00005 #ifdef HAVE_IFPACK_TEUCHOS
00006 #include "Ifpack_Preconditioner.h"
00007 namespace Teuchos {
00008 class ParameterList;
00009 }
00010
00011 class Epetra_MultiVector;
00012 class Epetra_Vector;
00013 class Epetra_Map;
00014 class Epetra_Comm;
00015 class Epetra_Time;
00016 class Epetra_Vector;
00017 class Epetra_Operator;
00018 class Epetra_RowMatrix;
00019
00021
00057 class Ifpack_Chebyshev : public Ifpack_Preconditioner {
00058
00059 public:
00060
00062
00063
00068 Ifpack_Chebyshev(const Epetra_Operator* Matrix);
00069
00071
00076 Ifpack_Chebyshev(const Epetra_RowMatrix* Matrix);
00077
00079 virtual ~Ifpack_Chebyshev();
00080
00082
00089 virtual inline int SetUseTranspose(bool UseTranspose)
00090 {
00091 UseTranspose_ = UseTranspose;
00092 return(0);
00093 }
00094
00096
00098
00100
00108 virtual inline int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00109
00111
00121 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00122
00124 virtual double NormInf() const
00125 {
00126 return(-1.0);
00127 }
00129
00131
00132 virtual const char * Label() const
00133 {
00134 return(Label_.c_str());
00135 }
00136
00138 virtual bool UseTranspose() const
00139 {
00140 return(UseTranspose_);
00141 }
00142
00144 virtual bool HasNormInf() const
00145 {
00146 return(false);
00147 }
00148
00150 virtual const Epetra_Comm & Comm() const;
00151
00153 virtual const Epetra_Map & OperatorDomainMap() const;
00154
00156 virtual const Epetra_Map & OperatorRangeMap() const;
00157
00158 virtual int Initialize();
00159
00160 virtual bool IsInitialized() const
00161 {
00162 return(IsInitialized_);
00163 }
00164
00166 virtual inline bool IsComputed() const
00167 {
00168 return(IsComputed_);
00169 }
00170
00172 virtual int Compute();
00173
00175
00177
00178 virtual const Epetra_RowMatrix& Matrix() const
00179 {
00180 return(*Matrix_);
00181 }
00182
00184 virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00185 const int MaxIters = 1550,
00186 const double Tol = 1e-9,
00187 Epetra_RowMatrix* Matrix = 0);
00188
00190 virtual double Condest() const
00191 {
00192 return(Condest_);
00193 }
00194
00196 virtual int SetParameters(Teuchos::ParameterList& List);
00197
00199 virtual ostream& Print(ostream & os) const;
00200
00202
00204
00206 virtual int NumInitialize() const
00207 {
00208 return(NumInitialize_);
00209 }
00210
00212 virtual int NumCompute() const
00213 {
00214 return(NumCompute_);
00215 }
00216
00218 virtual int NumApplyInverse() const
00219 {
00220 return(NumApplyInverse_);
00221 }
00222
00224 virtual double InitializeTime() const
00225 {
00226 return(InitializeTime_);
00227 }
00228
00230 virtual double ComputeTime() const
00231 {
00232 return(ComputeTime_);
00233 }
00234
00236 virtual double ApplyInverseTime() const
00237 {
00238 return(ApplyInverseTime_);
00239 }
00240
00242 virtual double InitializeFlops() const
00243 {
00244 return(0.0);
00245 }
00246
00248 virtual double ComputeFlops() const
00249 {
00250 return(ComputeFlops_);
00251 }
00252
00254 virtual double ApplyInverseFlops() const
00255 {
00256 return(ApplyInverseFlops_);
00257 }
00258
00259
00260
00261
00263 static int PowerMethod(const Epetra_Operator& Operator,
00264 const Epetra_Vector& InvPointDiagonal,
00265 const int MaximumIterations,
00266 double& LambdaMax);
00267
00269 static int CG(const Epetra_Operator& Operator,
00270 const Epetra_Vector& InvPointDiagonal,
00271 const int MaximumIterations,
00272 double& lambda_min, double& lambda_max);
00273
00274 private:
00275
00276
00277
00278
00280 virtual void SetLabel();
00281
00283 Ifpack_Chebyshev(const Ifpack_Chebyshev& rhs)
00284 {}
00285
00287 Ifpack_Chebyshev& operator=(const Ifpack_Chebyshev& rhs)
00288 {
00289 return(*this);
00290 }
00291
00292
00294 bool IsInitialized_;
00296 bool IsComputed_;
00298 int NumInitialize_;
00300 int NumCompute_;
00302 mutable int NumApplyInverse_;
00304 double InitializeTime_;
00306 double ComputeTime_;
00308 mutable double ApplyInverseTime_;
00310 double ComputeFlops_;
00312 mutable double ApplyInverseFlops_;
00313
00314
00315
00317 int PolyDegree_;
00319 bool UseTranspose_;
00321 double Condest_;
00323 bool ComputeCondest_;
00326 double EigRatio_;
00328 string Label_;
00330 double LambdaMin_;
00332 double LambdaMax_;
00334 double MinDiagonalValue_;
00335
00336
00337
00339 int NumMyRows_;
00341 int NumMyNonzeros_;
00343 int NumGlobalRows_;
00345 int NumGlobalNonzeros_;
00347 const Epetra_Operator* Operator_;
00349 const Epetra_RowMatrix* Matrix_;
00351 mutable Epetra_Vector* InvDiagonal_;
00353 bool IsRowMatrix_;
00355 Epetra_Time* Time_;
00357 bool ZeroStartingSolution_;
00358
00359
00360 };
00361
00362
00363 #endif // HAVE_IFPACK_TEUCHOS
00364 #endif // IFPACK_CHEBYSHEV_H