47 #include "Epetra_MultiVector.h"
48 #include "Epetra_Map.h"
49 #include "Epetra_Comm.h"
51 #include "Epetra_LinearProblem.h"
52 #include "Epetra_RowMatrix.h"
53 #include "Epetra_Time.h"
54 #include "Teuchos_ParameterList.hpp"
60 Matrix_(Teuchos::
rcp( Matrix_in,
false )),
63 IsInitialized_(
false),
71 ApplyInverseTime_(0.0),
73 ApplyInverseFlops_(0),
81 Matrix_(Teuchos::
rcp( &rhs.Matrix(),
false )),
84 IsInitialized_(
false),
86 NumInitialize_(rhs.NumInitialize()),
87 NumCompute_(rhs.NumCompute()),
88 NumApplyInverse_(rhs.NumApplyInverse()),
89 InitializeTime_(rhs.InitializeTime()),
90 ComputeTime_(rhs.ComputeTime()),
91 ApplyInverseTime_(rhs.ApplyInverseTime()),
92 ComputeFlops_(rhs.ComputeFlops()),
93 ApplyInverseFlops_(rhs.ApplyInverseFlops()),
94 Condest_(rhs.Condest())
143 if (
Comm().NumProc() != 1) {
144 cout <<
"Class Ifpack_Amesos must be used for serial runs;" << endl;
145 cout <<
"for parallel runs you should declare objects as:" << endl;
146 cout <<
"Ifpack_AdditiveSchwarz<Ifpack_Amesos> APrec(Matrix)" << endl;
156 if (
Matrix_->NumGlobalRows64() == 0) {
185 cerr <<
"IFPACK WARNING: In class Ifpack_Amesos:" << endl;
186 cerr <<
"IFPACK WARNING: Using LAPACK because other Amesos" << endl;
187 cerr <<
"IFPACK WARNING: solvers are not available. LAPACK" << endl;
188 cerr <<
"IFPACK WARNING: allocates memory to store the matrix as" << endl;
189 cerr <<
"IFPACK WARNING: dense, I hope you have enough memory..." << endl;
190 cerr <<
"IFPACK WARNING: (file " << __FILE__ <<
", line " << __LINE__
225 Time_->ResetStartTime();
271 if (X.NumVectors() != Y.NumVectors())
274 Time_->ResetStartTime();
278 Teuchos::RefCountPtr<const Epetra_MultiVector> Xcopy;
279 if (X.Pointers()[0] == Y.Pointers()[0])
303 return((
char*)
Label_.c_str());
327 return(
Matrix_->OperatorDomainMap());
333 return(
Matrix_->OperatorRangeMap());
338 const int MaxIters,
const double Tol,
356 if (!
Comm().MyPID()) {
358 os <<
"================================================================================" << endl;
359 os <<
"Ifpack_Amesos: " <<
Label () << endl << endl;
360 os <<
"Condition number estimate = " <<
Condest() << endl;
361 os <<
"Global number of rows = " <<
Matrix_->NumGlobalRows64() << endl;
363 os <<
"Phase # calls Total Time (s) Total MFlops MFlops/s" << endl;
364 os <<
"----- ------- -------------- ------------ --------" << endl;
367 <<
" 0.0 0.0" << endl;
374 os <<
" " << std::setw(15) << 0.0 << endl;
381 os <<
" " << std::setw(15) << 0.0 << endl;
382 os <<
"================================================================================" << endl;
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
double Condest_
Contains the estimated condition number.
virtual int SetParameters(Teuchos::ParameterList &List)
Sets all the parameters for the preconditioner.
bool UseTranspose_
If true, the preconditioner solves for the transpose of the matrix.
double ComputeTime_
Contains the time for all successful calls to Compute().
int NumApplyInverse_
Contains the number of successful call to ApplyInverse().
std::string Label_
Contains the label of this object.
int NumInitialize_
Contains the number of successful calls to Initialize().
T & get(ParameterList &l, const std::string &name)
Ifpack_Amesos(Epetra_RowMatrix *Matrix)
Constructor.
Teuchos::ParameterList List_
Contains a copy of the input parameter list.
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the matrix to an Epetra_MultiVector.
Teuchos::RefCountPtr< Amesos_BaseSolver > Solver_
Amesos solver, use to apply the inverse of the local matrix.
double InitializeTime_
Contains the time for all successful calls to Initialize().
virtual bool IsComputed() const
Returns true if the preconditioner has been successfully computed.
virtual const Teuchos::ParameterList & List() const
Teuchos::RefCountPtr< const Epetra_RowMatrix > Matrix_
Pointers to the matrix to be preconditioned.
Ifpack_CondestType
Ifpack_CondestType: enum to define the type of condition number estimate.
Ifpack_Amesos: a class to use Amesos' factorizations as preconditioners.
virtual int Compute()
Computes the preconditioners.
double ComputeFlops_
Contains the number of flops for Compute().
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual int Initialize()
Initializes the preconditioners.
virtual int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied (not implemented).
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
virtual const char * Label() const
Returns a character string describing the operator.
virtual double Condest() const
Returns the estimated condition number, never computes it.
Teuchos::RefCountPtr< Epetra_LinearProblem > Problem_
Linear problem required by Solver_.
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Applies the preconditioner to X, returns the result in Y.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
bool IsComputed_
If true, the preconditioner has been successfully computed.
bool IsInitialized_
If true, the preconditioner has been successfully initialized.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
double Ifpack_Condest(const Ifpack_Preconditioner &IFP, const Ifpack_CondestType CT, const int MaxIters, const double Tol, Epetra_RowMatrix *Matrix)
Amesos_BaseSolver * Create(const char *ClassType, const Epetra_LinearProblem &LinearProblem)
int NumCompute_
Contains the number of successful call to Compute().
virtual bool IsInitialized() const
Returns true is the preconditioner has been successfully initialized.
double ApplyInverseTime_
Contains the time for all successful calls to ApplyInverse().
bool IsEmpty_
If true, the linear system on this processor is empty, thus the preconditioner is null operation...
virtual double NormInf() const
Returns the infinity norm of the global matrix (not implemented)
#define IFPACK_CHK_ERR(ifpack_err)
double ApplyInverseFlops_
Contain sthe number of flops for ApplyInverse().
virtual const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
virtual std::ostream & Print(std::ostream &os) const
Prints on ostream basic information about this object.
Teuchos::RefCountPtr< Epetra_Time > Time_
Time object.