39 using namespace Teuchos;
 
   47   taucs_dccs_free( *taucs_ccs_matrix_in ); 
 
   51   taucs_supernodal_factor_free( *taucs_ccs_matrix_in ); 
 
   57 #define USE_REF_COUNT_PTR_FOR_A_AND_L 
   58 #ifdef USE_REF_COUNT_PTR_FOR_A_AND_L 
   62    taucs_ccs_matrix* A_ ;
 
   63    taucs_ccs_matrix* L_ ;
 
   79     taucs_supernodal_factor_free(L_);
 
  117     taucs_supernodal_factor_free(L_);
 
  132   if (
Comm().MyPID() == 0) 
 
  133     NumMyRows = NumGlobalRows;
 
  163   if (
Comm().MyPID() == 0) 
 
  167     int nnz_sym = (nnz) / 2 + n;
 
  169 #ifndef USE_REF_COUNT_PTR_FOR_A_AND_L 
  177 #ifdef USE_REF_COUNT_PTR_FOR_A_AND_L 
  179       rcp( taucs_ccs_create(n, n, nnz_sym, TAUCS_DOUBLE),
 
  188     std::vector<int>    Indices(MaxNumEntries);
 
  189     std::vector<double> Values(MaxNumEntries);
 
  193     for (
int i = 0 ; i < n ; ++i)
 
  196       int ierr, NumEntriesThisRow;
 
  199                                              &Values[0], &Indices[0]);
 
  203       for (
int j = 0 ; j < NumEntriesThisRow ; ++j)
 
  246   if (
Comm().MyPID() == 0)
 
  249 #ifdef USE_REF_COUNT_PTR_FOR_A_AND_L 
  274   if (
Comm().MyPID() == 0) 
 
  282       std::cerr << 
"Amesos_Taucs: error during numeric factorization (" 
  283         << ierr << 
")" << std::endl;
 
  298   if (
GetProblem()->GetOperator()->OperatorRangeMap().NumGlobalPoints() !=
 
  299       GetProblem()->GetOperator()->OperatorDomainMap().NumGlobalPoints() ) 
 
  309   if ( 
debug_ > 0 ) std::cout << __FILE__ << 
"::" << __LINE__ << 
" Entering SymbolicFactorization()" << std::endl ; 
 
  346   if ( 
debug_ > 0 ) std::cout << __FILE__ << 
"::" << __LINE__  << 
" Leaving SymbolicFactorization()" << std::endl ; 
 
  353   if ( 
debug_ > 0 ) std::cout << __FILE__ << 
"::" << __LINE__ << 
" Entering NumericFactorization()" << std::endl ; 
 
  369   if ( 
debug_ > 0 ) std::cout << __FILE__ << 
"::" << __LINE__
 
  370          << 
" Leaving NumericFactorization()" << std::endl ; 
 
  377   if ( 
debug_ > 0 ) std::cout << __FILE__ << 
"::" << __LINE__
 
  378          << 
" Entering Solve()" << std::endl ; 
 
  387   if ((X == 0) || (B == 0))
 
  390   int NumVectors = X->NumVectors();
 
  391   if (NumVectors != B->NumVectors())
 
  400   if (
Comm().NumProc() == 1) 
 
  402     SerialB = 
rcp(B,
false);
 
  403     SerialX = 
rcp(X,
false);
 
  417   if (
Comm().MyPID() == 0) 
 
  419     double* SerialXValues;
 
  420     double* SerialBValues;
 
  428     for (
int i = 0 ; i < NumVectors ; ++i)
 
  431                                             SerialXValues + i * LDA,
 
  432                                             SerialBValues + i * LDA);
 
  434       if (ierr != TAUCS_SUCCESS)
 
  436         std::cerr << 
"Error occurred in taucs_ccs_solve()" << std::endl;
 
  446   if (
Comm().NumProc() != 1) 
 
  457   if ( 
debug_ > 0 ) std::cout << __FILE__ << 
"::" << __LINE__
 
  458          << 
" Leaving Solve()" << std::endl ; 
 
  468   std::string p = 
"Amesos_Taucs : ";
 
  477   std::cout << p << 
"Matrix has " << n << 
" rows" 
  478        << 
" and " << nnz << 
" nonzeros" << std::endl;
 
  481     std::cout << p << 
"Nonzero elements per row = " 
  482          << 1.0 *  nnz / n << std::endl;
 
  483     std::cout << p << 
"Percentage of nonzero elements = " 
  484          << 100.0 * nnz /(pow(n,2.0)) << std::endl;
 
  513   std::string p = 
"Amesos_Taucs : ";
 
  516   std::cout << p << 
"Time to convert matrix to Taucs format = " 
  517        << ConTime << 
" (s)" << std::endl;
 
  518   std::cout << p << 
"Time to redistribute matrix = " 
  519        << MatTime << 
" (s)" << std::endl;
 
  520   std::cout << p << 
"Time to redistribute vectors = " 
  521        << VecTime << 
" (s)" << std::endl;
 
  522   std::cout << p << 
"Number of symbolic factorizations = " 
  524   std::cout << p << 
"Time for sym fact = " 
  525        << SymTime << 
" (s), avg = " << SymTime << 
" (s)" << std::endl;
 
  526   std::cout << p << 
"Number of numeric factorizations = " 
  528   std::cout << p << 
"Time for num fact = " 
  529        << NumTime << 
" (s), avg = " << NumTime << 
" (s)" << std::endl;
 
  530   std::cout << p << 
"Number of solve phases = " 
  532   std::cout << p << 
"Time for solve = " 
  533        << SolTime << 
" (s), avg = " << SolTime << 
" (s)" << std::endl;
 
int NumSymbolicFact_
Number of symbolic factorization phases. 
 
Epetra_Import & Importer()
Returns a reference to the already allocated Importer. 
 
const Epetra_RowMatrix & Matrix() const 
Returns a reference to the linear system matrix. 
 
virtual const Epetra_Map & RowMatrixRowMap() const =0
 
void PrintLine() const 
Prints line on std::cout. 
 
Epetra_MultiVector * GetLHS() const 
 
Epetra_MultiVector * GetRHS() const 
 
bool IsSymbolicFactorizationOK_
If true, SymbolicFactorization() has been successfully called. 
 
int PerformSymbolicFactorization()
Performs the symbolic factorization. 
 
int Solve()
Solves A X = B (or AT x = B) 
 
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables. 
 
void CreateTimer(const Epetra_Comm &Comm, int size=1)
Initializes the Time object. 
 
int MtxConvTime_
Quick accessor pointer to internal timing data. 
 
int NumNumericFact_
Number of numeric factorization phases. 
 
virtual int NumGlobalNonzeros() const =0
 
virtual int MyPID() const =0
 
bool MatrixShapeOK() const 
Returns true if the solver can handle this matrix shape. 
 
int NumSolve_
Number of solves. 
 
const Epetra_LinearProblem * GetProblem() const 
Returns the Epetra_LinearProblem. 
 
virtual int MaxNumEntries() const =0
 
Amesos_Taucs(const Epetra_LinearProblem &LinearProblem)
Default constructor. 
 
void SetStatusParameters(const Teuchos::ParameterList &ParameterList)
 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
 
Teuchos::RCP< Epetra_Import > Importer_
 
bool ComputeVectorNorms_
If true, prints the norms of X and B in Solve(). 
 
Teuchos::RCP< taucs_ccs_matrix > A_
 
void SetControlParameters(const Teuchos::ParameterList &ParameterList)
 
void taucs_supernodal_factor_free_ptr(taucs_ccs_matrix **taucs_ccs_matrix_in)
 
#define AMESOS_CHK_ERR(a)
 
int ConvertToSerial()
Constructs a matrix with all rows on processor 0. 
 
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A. 
 
Epetra_CrsMatrix & SerialCrsMatrix()
Returns a reference to the already SerialMatrix as Crs (if allocated). 
 
bool PrintTiming_
If true, prints timing information in the destructor. 
 
~Amesos_Taucs(void)
Default destructor. 
 
virtual int NumMyRows() const =0
 
const Epetra_LinearProblem * Problem_
Pointer to the linear system problem. 
 
void PrintTiming() const 
Prints timing information. 
 
int PerformNumericFactorization()
Performs the numeric factorization. 
 
const Epetra_RowMatrix * Matrix_
 
bool PrintStatus_
If true, print additional information in the destructor. 
 
int AddTime(const std::string what, int dataID, const int timerID=0)
Adds to field what the time elapsed since last call to ResetTimer(). 
 
void PrintStatus() const 
Prints status information. 
 
Epetra_Map & SerialMap()
Returns a reference to the already allocated SerialMap. 
 
int ConvertToTaucs()
Converts the Epetra_RowMatrix into TAUCS format. 
 
Teuchos::RCP< Amesos_Taucs_Pimpl > PrivateTaucsData_
 
Teuchos::RCP< Epetra_Map > SerialMap_
 
void taucs_dccs_free_ptr(taucs_ccs_matrix **taucs_ccs_matrix_in)
 
const Epetra_Map & Map() const 
Returns a reference to the RowMatrixRowMap(). 
 
int NumericFactorization()
Performs NumericFactorization on the matrix A. 
 
virtual int NumProc() const =0
 
void ComputeTrueResidual(const Epetra_RowMatrix &Matrix, const Epetra_MultiVector &X, const Epetra_MultiVector &B, const bool UseTranspose, const std::string prefix) const 
Computes the true residual, B - Matrix * X, and prints the results. 
 
const Epetra_Comm & Comm() const 
Returns a pointer to the Epetra_Comm communicator associated with this operator. 
 
void ResetTimer(const int timerID=0)
Resets the internally stored time object. 
 
Epetra_RowMatrix & SerialMatrix()
Returns a reference to the SerialMatrix. 
 
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const =0
 
Epetra_Operator * GetOperator() const 
 
Teuchos::RCP< Epetra_RowMatrix > SerialMatrix_
 
int verbose_
Toggles the output level. 
 
double GetTime(const std::string what) const 
Gets the cumulative time using the string. 
 
int debug_
Sets the level of debug_ output. 
 
bool IsNumericFactorizationOK_
If true, NumericFactorization() has been successfully called. 
 
Teuchos::RCP< Epetra_CrsMatrix > SerialCrsMatrix_
 
virtual int NumGlobalRows() const =0
 
virtual int NumMyNonzeros() const =0
 
Teuchos::RCP< taucs_ccs_matrix > L_
 
void ComputeVectorNorms(const Epetra_MultiVector &X, const Epetra_MultiVector &B, const std::string prefix) const 
Computes the norms of X and B and print the results. 
 
bool ComputeTrueResidual_
If true, computes the true residual in Solve(). 
 
double AddToDiag_
Add this value to the diagonal.