30 #include "Epetra_Map.h" 31 #include "Epetra_Import.h" 32 #include "Epetra_RowMatrix.h" 33 #include "Epetra_Vector.h" 34 #include "Epetra_Util.h" 35 #include "Epetra_LAPACK.h" 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) 164 const Epetra_Map &rhsMap = switchDomainRangeMaps ?
Matrix()->OperatorDomainMap() :
Matrix()->OperatorRangeMap();
169 const Epetra_Map &solutionMap = switchDomainRangeMaps ?
Matrix()->OperatorRangeMap() :
Matrix()->OperatorDomainMap();
211 Epetra_MultiVector* X =
Problem_->GetLHS();
212 const Epetra_MultiVector*
B =
Problem_->GetRHS();
216 if (X->NumVectors() !=
B->NumVectors())
231 const Epetra_MultiVector&
B)
235 int NumVectors = X.NumVectors();
237 Epetra_SerialDenseMatrix DenseX(static_cast<int>(
NumGlobalRows64()),NumVectors);
238 Epetra_SerialDenseMatrix DenseB(static_cast<int>(
NumGlobalRows64()),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);
260 const Epetra_MultiVector&
B)
264 int NumVectors = X.NumVectors();
268 Epetra_MultiVector SerialVector(
SerialMap(),NumVectors);
276 Epetra_SerialDenseMatrix DenseX(static_cast<int>(
NumGlobalRows64()),NumVectors);
277 Epetra_SerialDenseMatrix DenseB(static_cast<int>(
NumGlobalRows64()),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);
317 std::vector<double> Values(Length);
318 std::vector<int> Indices(Length);
323 int ierr =
SerialMatrix().ExtractMyRowCopy(j, Length, NumEntries,
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,
437 Er.Import(*LocalEr, Epetra_Import(Er.Map(),
SerialMap()), Insert);
438 Ei.Import(*LocalEi, Epetra_Import(Ei.Map(),
SerialMap()), Insert);
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.
double GetTime(const std::string what) const
Gets the cumulative time using the string.
int SerialToDense()
Converts a serial matrix to dense format.
bool MatrixShapeOK() const
Returns true if the solver can handle this matrix shape.
Teuchos::RCP< Epetra_CrsMatrix > SerialCrsMatrix_
Epetra_SerialDenseMatrix DenseMatrix_
Dense matrix.
Epetra_SerialDenseSolver DenseSolver_
Linear problem for dense matrix and vectors.
long long NumGlobalRows64() const
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.
bool UseTranspose() const
Returns the current UseTranspose setting.
const Epetra_Import & SolutionImporter()
Returns a reference to the solution importer (to domain map from serial map).
bool isSublist(const std::string &name) const
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="")
void CreateTimer(const Epetra_Comm &Comm, int size=1)
Initializes the Time object.
int DenseToFactored()
Factors the matrix using LAPACK.
const Epetra_LinearProblem * GetProblem() const
Returns the Epetra_LinearProblem.
int NumNumericFact_
Number of numeric factorization phases.
Teuchos::RCP< Teuchos::ParameterList > ParameterList_
int NumSolve_
Number of solves.
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int GEEV(Epetra_Vector &Er, Epetra_Vector &Ei)
Computes the eigenvalues of the linear system matrix using DGEEV.
Teuchos::RCP< Epetra_Export > RhsExporter_
void SetStatusParameters(const Teuchos::ParameterList &ParameterList)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void SetControlParameters(const Teuchos::ParameterList &ParameterList)
#define AMESOS_CHK_ERR(a)
void PrintStatus() const
Print information about the factorization and solution phases.
void PrintTiming() const
Print timing information.
bool UseTranspose_
If true, the linear system with the transpose will be solved.
void GEEV(const char JOBVL, const char JOBVR, const OrdinalType n, ScalarType *A, const OrdinalType lda, MagnitudeType *WR, MagnitudeType *WI, ScalarType *VL, const OrdinalType ldvl, ScalarType *VR, const OrdinalType ldvr, ScalarType *WORK, const OrdinalType lwork, MagnitudeType *RWORK, OrdinalType *info) const
bool PrintTiming_
If true, prints timing information in the destructor.
const Epetra_RowMatrix * Matrix() const
Returns a pointer to the linear system matrix.
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).
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.
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
int SetParameters(Teuchos::ParameterList &ParameterList)
Deprecated - Sets parameters.
Teuchos::RCP< Epetra_Map > SerialMap_
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.
const int NumericallySingularMatrixError
bool isParameter(const std::string &name) const
void ResetTimer(const int timerID=0)
Resets the internally stored time object.
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.
Teuchos::RCP< Epetra_Import > SolutionImporter_
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 PrintLine() const
Prints line on std::cout.
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.