36 using namespace Teuchos;
67 bool Equilibrate = LAPACKParams.
get(
"Equilibrate",
true);
92 bool Equilibrate =
true;
96 Equilibrate = LAPACKParams.
get<
bool>(
"Equilibrate");
106 if (
GetProblem()->GetOperator()->OperatorRangeMap().NumGlobalPoints64() !=
107 GetProblem()->GetOperator()->OperatorDomainMap().NumGlobalPoints64()) {
152 #if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
216 if (X->NumVectors() != B->NumVectors())
235 int NumVectors = X.NumVectors();
241 for (
int j = 0 ; j < NumVectors ; ++j)
242 DenseB(i,j) = B[j][i];
249 for (
int j = 0 ; j < NumVectors ; ++j)
250 X[j][i] = DenseX(i,j);
264 int NumVectors = X.NumVectors();
280 for (
int j = 0 ; j < NumVectors ; ++j)
281 DenseB(i,j) = SerialVector[j][i];
288 for (
int j = 0 ; j < NumVectors ; ++j)
289 SerialVector[j][i] = DenseX(i,j);
297 VecRedistTime_ =
AddTime(
"Total vector redistribution time", VecRedistTime_);
317 std::vector<double> Values(Length);
318 std::vector<int> Indices(Length);
324 &Values[0], &Indices[0]);
328 for (
int k = 0 ; k < NumEntries ; ++k) {
333 for (
int k = 0 ; k < NumEntries ; ++k) {
340 if (Indices[k] == j) {
412 std::vector<double> work(1);
416 LocalEr->Values(), LocalEi->Values(), NULL,
421 lwork = (int)work[0];
424 LocalEr->Values(), LocalEi->Values(), NULL,
465 std::string p =
"Amesos_Lapack : ";
475 std::cout << p <<
"Nonzero elements per row = "
477 std::cout << p <<
"Percentage of nonzero elements = "
478 << 100.0 * percentage << std::endl;
480 std::cout << p <<
"Use transpose = " <<
UseTranspose_ << std::endl;
508 std::string p =
"Amesos_Lapack : ";
511 std::cout << p <<
"Time to convert matrix to Klu format = "
512 << ConTime <<
" (s)" << std::endl;
513 std::cout << p <<
"Time to redistribute matrix = "
514 << MatTime <<
" (s)" << std::endl;
515 std::cout << p <<
"Time to redistribute vectors = "
516 << VecTime <<
" (s)" << std::endl;
517 std::cout << p <<
"Number of symbolic factorizations = "
519 std::cout << p <<
"Time for sym fact = "
520 << SymTime <<
" (s), avg = " << SymTime <<
" (s)" << std::endl;
521 std::cout << p <<
"Number of numeric factorizations = "
523 std::cout << p <<
"Time for num fact = "
524 << NumTime <<
" (s), avg = " << NumTime <<
" (s)" << std::endl;
525 std::cout << p <<
"Number of solve phases = "
527 std::cout << p <<
"Time for solve = "
528 << SolTime <<
" (s), avg = " << SolTime <<
" (s)" << std::endl;
int NumSymbolicFact_
Number of symbolic factorization phases.
Amesos_Lapack(const Epetra_LinearProblem &LinearProblem)
Amesos_Lapack Constructor.
int SerialToDense()
Converts a serial matrix to dense format.
Teuchos::RCP< Epetra_CrsMatrix > SerialCrsMatrix_
void PrintLine() const
Prints line on std::cout.
Epetra_SerialDenseMatrix DenseMatrix_
Dense matrix.
Epetra_MultiVector * GetLHS() const
Epetra_SerialDenseSolver DenseSolver_
Linear problem for dense matrix and vectors.
Epetra_MultiVector * GetRHS() const
void PrintStatus() const
Print information about the factorization and solution phases.
bool IsSymbolicFactorizationOK_
If true, SymbolicFactorization() has been successfully called.
T & get(ParameterList &l, const std::string &name)
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const ¶mList)
Use this parameter list to read values from.
long long NumGlobalNonzeros_
int SolveDistributed(Epetra_MultiVector &X, const Epetra_MultiVector &B)
Solves the linear system, when more than one process is used.
const Epetra_Import & SolutionImporter()
Returns a reference to the solution importer (to domain map from serial map).
bool AddZeroToDiag_
Adds zero to diagonal of redistributed matrix (some solvers choke on a matrix with a partly empty dia...
Teuchos::RCP< Teuchos::ParameterList > pl_
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
virtual const Epetra_Map & OperatorDomainMap() const =0
void CreateTimer(const Epetra_Comm &Comm, int size=1)
Initializes the Time object.
int DenseToFactored()
Factors the matrix using LAPACK.
int SetVectors(Epetra_SerialDenseMatrix &X, Epetra_SerialDenseMatrix &B)
void SolveWithTranspose(bool Flag)
int NumNumericFact_
Number of numeric factorization phases.
virtual int MyPID() const =0
const Epetra_LinearProblem * GetProblem() const
Returns the Epetra_LinearProblem.
Teuchos::RCP< Teuchos::ParameterList > ParameterList_
int NumSolve_
Number of solves.
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
bool isParameter(const std::string &name) const
int GEEV(Epetra_Vector &Er, Epetra_Vector &Ei)
Computes the eigenvalues of the linear system matrix using DGEEV.
virtual int MaxNumEntries() const =0
virtual const Epetra_Map & OperatorRangeMap() const =0
Teuchos::RCP< Epetra_Export > RhsExporter_
void SetStatusParameters(const Teuchos::ParameterList &ParameterList)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual bool UseTranspose() const =0
void SetControlParameters(const Teuchos::ParameterList &ParameterList)
#define AMESOS_CHK_ERR(a)
bool isSublist(const std::string &name) const
virtual const Epetra_BlockMap & Map() const =0
bool UseTranspose_
If true, the linear system with the transpose will be solved.
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
bool PrintTiming_
If true, prints timing information in the destructor.
virtual int NumMyRows() const =0
Teuchos::RCP< Epetra_RowMatrix > SerialMatrix_
bool PrintStatus_
If true, print additional information in the destructor.
~Amesos_Lapack(void)
Amesos_Lapack Destructor.
#define AMESOS_RETURN(amesos_err)
int AddTime(const std::string what, int dataID, const int timerID=0)
Adds to field what the time elapsed since last call to ResetTimer().
const Epetra_Export & RhsExporter()
Returns a reference to the rhs exporter (from range map to serial map).
virtual long long NumGlobalNonzeros64() const =0
const Epetra_Map & SerialMap()
Returns a reference to serial map (that with all elements on process 0).
int MtxRedistTime_
Quick access ids for the individual timings.
int SetMatrix(Epetra_SerialDenseMatrix &A)
int SetParameters(Teuchos::ParameterList &ParameterList)
Deprecated - Sets parameters.
Teuchos::RCP< Epetra_Map > SerialMap_
virtual int NumProc() const =0
bool MatrixShapeOK() const
Returns true if the solver can handle this matrix shape.
Epetra_RowMatrix & SerialMatrix()
Returns a reference to serial matrix (that with all rows on process 0).
Teuchos::RCP< Epetra_Import > MatrixImporter_
const Epetra_LinearProblem * Problem_
Pointer to the linear problem.
void FactorWithEquilibration(bool Flag)
const int NumericallySingularMatrixError
void ResetTimer(const int timerID=0)
Resets the internally stored time object.
void GEEV(const char JOBVL, const char JOBVR, const int N, double *A, const int LDA, double *WR, double *WI, double *VL, const int LDVL, double *VR, const int LDVR, double *WORK, const int LWORK, int *INFO) const
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const =0
int DistributedToSerial()
Converts a distributed matrix to serial matrix.
Epetra_CrsMatrix & SerialCrsMatrix()
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int verbose_
Toggles the output level.
double GetTime(const std::string what) const
Gets the cumulative time using the string.
long long NumGlobalRows64() const
int Shape(int NumRows, int NumCols)
Teuchos::RCP< Epetra_Import > SolutionImporter_
const Epetra_RowMatrix * Matrix() const
Returns a pointer to the linear system matrix.
bool IsNumericFactorizationOK_
If true, NumericFactorization() has been successfully called.
int Solve()
Solves A X = B (or AT x = B)
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
This is an empty stub.
int SolveSerial(Epetra_MultiVector &X, const Epetra_MultiVector &B)
Solves the linear system, when only one process is used.
void PrintTiming() const
Print timing information.
virtual long long NumGlobalRows64() const =0
bool UseTranspose() const
Returns the current UseTranspose setting.
const Epetra_Import & MatrixImporter()
Returns a reference to the matrix importer (from row map to serial map).
double AddToDiag_
Add this value to the diagonal.