33 #include "Trilinos_Util.h" 
   46 #ifdef HAVE_AMESOS_SUPERLU 
   49 #ifdef HAVE_AMESOS_SUPERLUDIST 
   52 #ifdef HAVE_AMESOS_SLUD 
   55 #ifdef HAVE_AMESOS_SLUS 
   58 #ifdef HAVE_AMESOS_SLUD2 
   64 #ifdef HAVE_AMESOS_DSCPACK 
   67 #ifdef HAVE_AMESOS_LAPACK 
   70 #ifdef HAVE_AMESOS_UMFPACK 
   73 #ifdef HAVE_AMESOS_KLU 
   76 #ifdef HAVE_AMESOS_SCALAPACK 
   79 #ifdef HAVE_AMESOS_TAUCS 
   82 #ifdef HAVE_AMESOS_PARDISO 
   85 #ifdef HAVE_AMESOS_PARAKLETE 
   88 #if defined(HAVE_AMESOS_MUMPS) && defined(HAVE_MPI) 
  131   std::string FileName = matrix_file ;
 
  132   int FN_Size = FileName.size() ; 
 
  133   std::string LastFiveBytes = FileName.substr( 
EPETRA_MAX(0,FN_Size-5), FN_Size );
 
  134   std::string LastFourBytes = FileName.substr( 
EPETRA_MAX(0,FN_Size-4), FN_Size );
 
  135   bool NonContiguousMap = 
false; 
 
  137   if ( LastFiveBytes == 
".triU" ) { 
 
  139     NonContiguousMap = 
true; 
 
  140     EPETRA_CHK_ERR( Trilinos_Util_ReadTriples2Epetra( matrix_file, 
false, Comm, readMap, readA, readx, 
 
  141                   readb, readxexact, NonContiguousMap ) );
 
  143     if ( LastFiveBytes == 
".triS" ) { 
 
  144       NonContiguousMap = 
true; 
 
  146       EPETRA_CHK_ERR( Trilinos_Util_ReadTriples2Epetra( matrix_file, 
true, Comm, readMap, readA, readx, 
 
  147               readb, readxexact, NonContiguousMap ) );
 
  149       if (  LastFourBytes == 
".mtx" ) { 
 
  150   EPETRA_CHK_ERR( Trilinos_Util_ReadMatrixMarket2Epetra( matrix_file, Comm, readMap, 
 
  151                      readA, readx, readb, readxexact) );
 
  154   Trilinos_Util_ReadHb2Epetra( matrix_file, Comm, readMap, readA, readx, 
 
  165     serialA = &transposeA ; 
 
  181   if( NonContiguousMap ) {
 
  186     int NumMyElements = map.NumMyElements();
 
  187     int MyFirstElement = map.MinMyGID();
 
  188     std::vector<int> MapMap_( NumGlobalElements );
 
  190     Comm.
Broadcast( &MapMap_[0], NumGlobalElements, 0 ) ; 
 
  191     map_ = 
new Epetra_Map( NumGlobalElements, NumMyElements, &MapMap_[MyFirstElement], 0, Comm);
 
  201   assert( OriginalMap.
SameAs(*readMap) ); 
 
  217   if ( distribute_matrix ) { 
 
  222     x.Export(*readx, exporter, 
Add);
 
  223     b.Export(*readb, exporter, 
Add);
 
  224     xexact.Export(*readxexact, exporter, 
Add);
 
  227     A.Export(*serialA, exporter, 
Add);
 
  236     passxexact = &xexact;
 
  245     passxexact = readxexact;
 
  246     passresid = &readresid;
 
  253   double Anorm = passA->
NormInf() ; 
 
  261   for ( 
int i = 0; i < 1+special ; i++ ) { 
 
  266 #ifdef HAVE_AMESOS_SUPERLUDIST 
  269   ParamList.
set( 
"MaxProcs", -3 );
 
  275   ParamList.
set( 
"MaxProcs", -3 );
 
  283 #ifdef HAVE_AMESOS_DSCPACK 
  284     } 
else if ( SparseSolver == 
DSCPACK ) {
 
  287       ParamList.
set( 
"MaxProcs", -3 );
 
  295 #ifdef HAVE_AMESOS_SCALAPACK 
  296     } 
else if ( SparseSolver == 
SCALAPACK ) {
 
  300       ParamList.
set( 
"MaxProcs", -3 );
 
  308 #ifdef HAVE_AMESOS_TAUCS 
  309     } 
else if ( SparseSolver == 
TAUCS ) {
 
  313       ParamList.
set( 
"MaxProcs", -3 );
 
  321 #ifdef HAVE_AMESOS_PARDISO 
  322     } 
else if ( SparseSolver == 
PARDISO ) {
 
  326       ParamList.
set( 
"MaxProcs", -3 );
 
  334 #ifdef HAVE_AMESOS_PARAKLETE 
  335     } 
else if ( SparseSolver == 
PARAKLETE ) {
 
  339       ParamList.
set( 
"MaxProcs", -3 );
 
  347 #if defined(HAVE_AMESOS_MUMPS) && defined(HAVE_MPI) 
  348     } 
else if ( SparseSolver == 
MUMPS ) {
 
  352       ParamList.
set( 
"MaxProcs", -3 );
 
  360 #ifdef HAVE_AMESOS_SUPERLU 
  361     } 
else if ( SparseSolver == 
SUPERLU ) {
 
  365       ParamList.
set( 
"MaxProcs", -3 );
 
  373 #ifdef HAVE_AMESOS_LAPACK 
  374     } 
else if ( SparseSolver == 
LAPACK ) {
 
  378       ParamList.
set( 
"MaxProcs", -3 );
 
  385 #ifdef HAVE_AMESOS_UMFPACK 
  386     } 
else if ( SparseSolver == 
UMFPACK ) {
 
  390       ParamList.
set( 
"MaxProcs", -3 );
 
  397 #ifdef HAVE_AMESOS_KLU 
  398     } 
else if ( SparseSolver == 
KLU ) {
 
  401       using namespace Teuchos;
 
  404       int setupTimePtr = -1, symTimePtr = -1, numTimePtr = -1, refacTimePtr = -1, solveTimePtr = -1;
 
  411       ParamList.set( 
"MaxProcs", -3 );
 
  412       ParamList.set( 
"TrustMe", 
false );
 
  416       setupTimePtr = AT.AddTime(
"Setup", setupTimePtr, 0);
 
  418       symTimePtr = AT.AddTime(
"Symbolic", symTimePtr, 0);
 
  420       numTimePtr = AT.AddTime(
"Numeric", numTimePtr, 0);
 
  422       refacTimePtr = AT.AddTime(
"Refactor", refacTimePtr, 0);
 
  425       solveTimePtr = AT.AddTime(
"Solve", solveTimePtr, 0);
 
  427       double SetupTime = AT.GetTime(setupTimePtr);
 
  428       double SymbolicTime = AT.GetTime(symTimePtr);
 
  429       double NumericTime = AT.GetTime(numTimePtr);
 
  430       double RefactorTime = AT.GetTime(refacTimePtr);
 
  431       double SolveTime = AT.GetTime(solveTimePtr);
 
  433       std::cout << __FILE__ << 
"::"  << __LINE__ << 
" SetupTime = " << SetupTime << std::endl ; 
 
  434       std::cout << __FILE__ << 
"::"  << __LINE__ << 
" SymbolicTime = " << SymbolicTime - SetupTime << std::endl ; 
 
  435       std::cout << __FILE__ << 
"::"  << __LINE__ << 
" NumericTime = " << NumericTime - SymbolicTime<< std::endl ; 
 
  436       std::cout << __FILE__ << 
"::"  << __LINE__ << 
" RefactorTime = " << RefactorTime - NumericTime << std::endl ; 
 
  437       std::cout << __FILE__ << 
"::"  << __LINE__ << 
" SolveTime = " << SolveTime - RefactorTime << std::endl ; 
 
  442       std::cerr << 
"\n\n####################  Requested solver not available on this platform ##################### ATS\n" << std::endl ;
 
  443       std::cout << 
" SparseSolver = " << SparseSolver << std::endl ; 
 
  444       std::cerr << 
" SparseSolver = " << SparseSolver << std::endl ; 
 
  454   passresid->Update(1.0, *passx, -1.0, *passxexact, 0.0);
 
  456   passresid->Norm2(&error);
 
  467   passA->
Multiply( transpose, *passx, *passtmp);
 
  468   passresid->Update(1.0, *passtmp, -1.0, *passb, 0.0); 
 
  470   passresid->Norm2(&residual);
 
  475   passb->Norm2( &bnorm ) ; 
 
  479   passx->Norm2( &xnorm ) ; 
 
int SetUseTranspose(bool UseTranspose)
SetUseTranpose(true) is more efficient in Amesos_Scalapack. 
 
int NumGlobalElements() const 
 
Amesos_Klu: A serial, unblocked code ideal for getting started and for very sparse matrices...
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int SetUseTranspose(bool UseTranspose_in)
If set true, X will be set to the solution of AT X = B (not A X = B) 
 
int Solve()
Solves A X = B (or AT x = B) 
 
int Solve()
Solves A X = B (or AT x = B) 
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
Amesos_Paraklete: A serial, unblocked code ideal for getting started and for very sparse matrices...
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
bool SameAs(const Epetra_BlockMap &Map) const 
 
Amesos_Superludist: An object-oriented wrapper for Superludist. 
 
int Solve()
Solves A X = B (or AT x = B) 
 
Amesos_Mumps: An object-oriented wrapper for the double precision version of MUMPS. 
 
int Solve()
Solves A X = B (or AT x = B) 
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int MyGlobalElements(int *MyGlobalElementList) const 
 
int Solve()
Solves A X = B (or AT x = B) 
 
void Set_Total_Time(double Total_Time_in)
 
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
 
double ElapsedTime(void) const 
 
Amesos_Dscpack: An object-oriented wrapper for Dscpack. 
 
void Set_Anorm(double anorm_in)
 
int SetUseTranspose(bool UseTranspose)
SetUseTranpose() 
 
const Epetra_Map & RowMatrixRowMap() const 
 
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
 
int CrsMatrixTranspose(Epetra_CrsMatrix *In, Epetra_CrsMatrix *Out)
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
void CreateTimer(const Epetra_Comm &Comm, int size=1)
Initializes the Time object. 
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
virtual void Barrier() const =0
 
Amesos_Pardiso: Interface to the PARDISO package. 
 
Amesos_Superlu: Amesos interface to Xioye Li's SuperLU 3.0 serial code. 
 
int Solve()
Solves A X = B (or AT X = B) 
 
int FillComplete(bool OptimizeDataStorage=true)
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
void Set_Error(double error_in)
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int SetUseTranspose(bool UseTranspose_in)
SetUseTranpose() 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
int SetUseTranspose(bool UseTranspose_in)
If set true, X will be set to the solution of AT X = B (not A X = B) 
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int Amesos_TestSolver(Epetra_Comm &Comm, char *matrix_file, SparseSolverType SparseSolver, bool transpose, int special, AMESOS_MatrixType matrix_type)
 
int SetUseTranspose(bool UseTranspose_in)
If set true, X will be set to the solution of AT X = B (not A X = B) 
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Set parameters from the input parameters list, returns 0 if successful. 
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
virtual double NormInf() const =0
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
#define EPETRA_CHK_ERR(xxx)
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
void Set_Xnorm(double xnorm_in)
 
Amesos_Time: Container for timing information. 
 
int SetUseTranspose(bool useTheTranspose)
If set true, X will be set to the solution of AT X = B (not A X = B) 
 
int Solve()
Solves A X = B (or AT x = B) 
 
virtual int Broadcast(double *MyVals, int Count, int Root) const =0
 
int SetUseTranspose(bool UseTranspose_in)
SetUseTranpose(true) is more efficient in Amesos_Klu. 
 
int SetUseTranspose(bool UseTranspose)
Amesos_Taucs supports only symmetric matrices, hence transpose is irrelevant, but harmless...
 
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
 
Amesos_Lapack: an interface to LAPACK. 
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Deprecated - Sets parameters. 
 
int SetUseTranspose(bool UseTranspose)
Amesos_Superludist does not support transpose at this time. 
 
int Solve()
Solves A X = B (or AT x = B) 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
void Set_Residual(double residual_in)
 
int Solve()
Solves A X = B (or AT x = B) 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
static std::ofstream log_file
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
static SparseSolverResult SS_Result
 
int Solve()
Solves A X = B (or AT X = B) 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
Class Amesos_Umfpack: An object-oriented wrapper for UMFPACK. 
 
int Solve()
Solves A X = B (or AT x = B) 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
void Set_Bnorm(double bnorm_in)
 
Amesos_Scalapack: A serial and parallel dense solver. For now, we implement only the unsymmetric ScaL...
 
Amesos_Taucs: An interface to the TAUCS package. 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A.