Amesos Package Browser (Single Doxygen Collection)  Development
Amesos_Umfpack.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Amesos: Direct Sparse Solver Package
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
25 //
26 // ***********************************************************************
27 // @HEADER
28 
29 #include "Amesos_Umfpack.h"
30 extern "C" {
31 #include "umfpack.h"
32 }
33 #include "Epetra_Map.h"
34 #include "Epetra_Import.h"
35 #include "Epetra_Export.h"
36 #include "Epetra_RowMatrix.h"
37 #include "Epetra_CrsMatrix.h"
38 #include "Epetra_Vector.h"
39 #include "Epetra_Util.h"
40 
41 //
42 // Hack to deal with Bug #1418 - circular dependencies in amesos, umfpack and amd libraries
43 //
44 #include "Amesos_Klu.h"
45 extern "C" {
46 #include "amd.h"
47 }
48 
49 //=============================================================================
51  Symbolic(0),
52  Numeric(0),
53  SerialMatrix_(0),
54  UseTranspose_(false),
55  Problem_(&prob),
56  Rcond_(0.0),
57  RcondValidOnAllProcs_(true),
58  MtxConvTime_(-1),
59  MtxRedistTime_(-1),
60  VecRedistTime_(-1),
61  SymFactTime_(-1),
62  NumFactTime_(-1),
63  SolveTime_(-1),
64  OverheadTime_(-1)
65 {
66 
67  // MS // move declaration of Problem_ above because I need it
68  // MS // set up before calling Comm()
69  Teuchos::ParameterList ParamList ;
70  SetParameters( ParamList ) ;
71 
72  //
73  // Hack to deal with Bug #1418 - circular dependencies in amesos, umfpack and amd libraries
74  // This causes the amd files to be pulled in from libamesos.a
75  //
76  if ( UseTranspose_ ) {
77  double control[3];
78  // This should never be called
79  Amesos_Klu Nothing(*Problem_);
80  amd_defaults(control);
81  }
82 
83 }
84 
85 //=============================================================================
87 {
88  if (Symbolic) umfpack_di_free_symbolic (&Symbolic);
89  if (Numeric) umfpack_di_free_numeric (&Numeric);
90 
91  // print out some information if required by the user
92  if ((verbose_ && PrintTiming_) || verbose_ == 2) PrintTiming();
93  if ((verbose_ && PrintStatus_) || verbose_ == 2) PrintStatus();
94 
95 }
96 
97 //=============================================================================
98 // If FirstTime is true, then build SerialMap and ImportToSerial,
99 // otherwise simply re-ship the matrix, so that the numerical values
100 // are updated.
101 int Amesos_Umfpack::ConvertToSerial(const bool FirstTime)
102 {
103  ResetTimer(0);
104  ResetTimer(1);
105 
106  const Epetra_Map &OriginalMap = Matrix()->RowMatrixRowMap() ;
107 
110  assert (NumGlobalElements_ == Matrix()->NumGlobalCols());
111 
112  int NumMyElements_ = 0 ;
113  if (MyPID_ == 0) NumMyElements_ = NumGlobalElements_;
114 
115  IsLocal_ = ( OriginalMap.NumMyElements() ==
116  OriginalMap.NumGlobalElements() )?1:0;
117 
118  // if ( AddZeroToDiag_ ) IsLocal_ = 0 ; // bug # Umfpack does not support AddZeroToDiag_
119 
120  Comm().Broadcast( &IsLocal_, 1, 0 ) ;
121 
122  // Convert Original Matrix to Serial (if it is not already)
123  //
124  if (IsLocal_== 1) {
125  SerialMatrix_ = Matrix();
126  }
127  else
128  {
129  if (FirstTime)
130  {
131  SerialMap_ = rcp(new Epetra_Map(NumGlobalElements_,NumMyElements_,
132  0,Comm()));
133 
134  if (SerialMap_.get() == 0)
135  AMESOS_CHK_ERR(-1);
136 
137  ImportToSerial_ = rcp(new Epetra_Import (SerialMap(),OriginalMap));
138 
139  if (ImportToSerial_.get() == 0)
140  AMESOS_CHK_ERR(-1);
141  }
142 
144 
145  if (SerialCrsMatrixA_.get() == 0)
146  AMESOS_CHK_ERR(-1);
147 
149 
150 #if 0
151 
152  I was not able to make this work - 11 Feb 2006
153 
154  if (AddZeroToDiag_ ) {
155  int OriginalTracebackMode = SerialCrsMatrix().GetTracebackMode() ;
156  SerialCrsMatrix().SetTracebackMode( EPETRA_MIN( OriginalTracebackMode, 0) ) ; // ExportToSerial is called both by PerformSymbolicFactorization() and PerformNumericFactorization(). When called by the latter, the call to insertglobalvalues is both unnecessary and illegal. Fortunately, Epetra allows us to ignore the error message by setting the traceback mode to 0.
157 
158  //
159  // Add 0.0 to each diagonal entry to avoid empty diagonal entries;
160  //
161  double zero = 0.0;
162  for ( int i = 0 ; i < SerialMap_->NumGlobalElements(); i++ )
163  if ( SerialCrsMatrix().LRID(i) >= 0 )
164  SerialCrsMatrix().InsertGlobalValues( i, 1, &zero, &i ) ;
165  SerialCrsMatrix().SetTracebackMode( OriginalTracebackMode ) ;
166  }
167 #endif
170  assert( numentries_ == SerialMatrix_->NumGlobalNonzeros()); // This should be set to an assignment if AddToZeroDiag is non -zero
171  }
172 
173 
174  MtxRedistTime_ = AddTime("Total matrix redistribution time", MtxRedistTime_, 0);
175  OverheadTime_ = AddTime("Total Amesos overhead time", OverheadTime_, 1);
176 
177  return(0);
178 }
179 
180 //=============================================================================
182 {
183  ResetTimer(0);
184  ResetTimer(1);
185 
186  // Convert matrix to the form that Umfpack expects (Ap, Ai, Aval),
187  // only on processor 0. The matrix has already been assembled in
188  // SerialMatrix_; if only one processor is used, then SerialMatrix_
189  // points to the problem's matrix.
190 
191  if (MyPID_ == 0)
192  {
193  Ap.resize( NumGlobalElements_+1 );
196 
197  int NumEntries = SerialMatrix_->MaxNumEntries();
198 
199  int NumEntriesThisRow;
200  int Ai_index = 0 ;
201  int MyRow;
202  for (MyRow = 0 ; MyRow < NumGlobalElements_; MyRow++)
203  {
204  int ierr;
205  Ap[MyRow] = Ai_index ;
206  ierr = SerialMatrix_->ExtractMyRowCopy(MyRow, NumEntries,
207  NumEntriesThisRow,
208  &Aval[Ai_index], &Ai[Ai_index]);
209  if (ierr)
210  AMESOS_CHK_ERR(-1);
211 
212 #if 1
213  // MS // added on 15-Mar-05 and KSS restored 8-Feb-06
214  if (AddToDiag_ != 0.0) {
215  for (int i = 0 ; i < NumEntriesThisRow ; ++i) {
216  if (Ai[Ai_index+i] == MyRow) {
217  Aval[Ai_index+i] += AddToDiag_;
218  break;
219  }
220  }
221  }
222 #endif
223  Ai_index += NumEntriesThisRow;
224  }
225 
226  Ap[MyRow] = Ai_index ;
227  }
228 
229  MtxConvTime_ = AddTime("Total matrix conversion time", MtxConvTime_, 0);
230  OverheadTime_ = AddTime("Total Amesos overhead time", OverheadTime_, 1);
231 
232  return 0;
233 }
234 
235 //=============================================================================
237 {
238  // ========================================= //
239  // retrive UMFPACK's parameters from list. //
240  // default values defined in the constructor //
241  // ========================================= //
242 
243  // retrive general parameters
246 
247  return 0;
248 }
249 
250 //=============================================================================
252 {
253  // MS // no overhead time in this method
254  ResetTimer(0);
255 
256  double *Control = (double *) NULL, *Info = (double *) NULL;
257 
258  if (Symbolic)
259  umfpack_di_free_symbolic (&Symbolic) ;
260  if (MyPID_== 0) {
261  (void) umfpack_di_symbolic (NumGlobalElements_, NumGlobalElements_, &Ap[0],
262  &Ai[0], &Aval[0],
263  &Symbolic, Control, Info) ;
264  }
265 
266  SymFactTime_ = AddTime("Total symbolic factorization time", SymFactTime_, 0);
267 
268  return 0;
269 }
270 
271 //=============================================================================
273 {
274  // MS // no overhead time in this method
275  ResetTimer(0);
276 
277  RcondValidOnAllProcs_ = false ;
278  if (MyPID_ == 0) {
279  std::vector<double> Control(UMFPACK_CONTROL);
280  std::vector<double> Info(UMFPACK_INFO);
281  umfpack_di_defaults( &Control[0] ) ;
282  if (Numeric) umfpack_di_free_numeric (&Numeric) ;
283  int status = umfpack_di_numeric (&Ap[0],
284  &Ai[0],
285  &Aval[0],
286  Symbolic,
287  &Numeric,
288  &Control[0],
289  &Info[0]) ;
290  Rcond_ = Info[UMFPACK_RCOND];
291 
292 #if NOT_DEF
293  std::cout << " Rcond_ = " << Rcond_ << std::endl ;
294 
295  int lnz1 = 1000 ;
296  int unz1 = 1000 ;
297  int n = 4;
298  int * Lp = (int *) malloc ((n+1) * sizeof (int)) ;
299  int * Lj = (int *) malloc (lnz1 * sizeof (int)) ;
300  double * Lx = (double *) malloc (lnz1 * sizeof (double)) ;
301  int * Up = (int *) malloc ((n+1) * sizeof (int)) ;
302  int * Ui = (int *) malloc (unz1 * sizeof (int)) ;
303  double * Ux = (double *) malloc (unz1 * sizeof (double)) ;
304  int * P = (int *) malloc (n * sizeof (int)) ;
305  int * Q = (int *) malloc (n * sizeof (int)) ;
306  double * Dx = (double *) NULL ; /* D vector not requested */
307  double * Rs = (double *) malloc (n * sizeof (double)) ;
308  if (!Lp || !Lj || !Lx || !Up || !Ui || !Ux || !P || !Q || !Rs)
309  {
310  assert( false ) ;
311  }
312  int do_recip;
313  status = umfpack_di_get_numeric (Lp, Lj, Lx, Up, Ui, Ux,
314  P, Q, Dx, &do_recip, Rs, Numeric) ;
315  if (status < 0)
316  {
317  assert( false ) ;
318  }
319 
320  printf ("\nL (lower triangular factor of C): ") ;
321  (void) umfpack_di_report_matrix (n, n, Lp, Lj, Lx, 0, &Control[0]) ;
322  printf ("\nU (upper triangular factor of C): ") ;
323  (void) umfpack_di_report_matrix (n, n, Up, Ui, Ux, 1, &Control[0]) ;
324  printf ("\nP: ") ;
325  (void) umfpack_di_report_perm (n, P, &Control[0]) ;
326  printf ("\nQ: ") ;
327  (void) umfpack_di_report_perm (n, Q, &Control[0]) ;
328  printf ("\nScale factors: row i of A is to be ") ;
329 
330 #endif
331 
332  assert( status == 0 ) ;
333  }
334 
335  NumFactTime_ = AddTime("Total numeric factorization time", NumFactTime_, 0);
336 
337  return 0;
338 }
339 
340 //=============================================================================
342 {
343  if ( !RcondValidOnAllProcs_ ) {
344  Comm().Broadcast( &Rcond_, 1, 0 ) ;
345  RcondValidOnAllProcs_ = true;
346  }
347  return(Rcond_);
348 }
349 
350 //=============================================================================
352 {
353  bool OK = true;
354 
355  if ( GetProblem()->GetOperator()->OperatorRangeMap().NumGlobalPoints() !=
356  GetProblem()->GetOperator()->OperatorDomainMap().NumGlobalPoints() ) OK = false;
357  return OK;
358 }
359 
360 
361 //=============================================================================
363 {
364  // MS // NOTE: If you change this method, also change
365  // MS // NumericFactorization(), because it performs part of the actions
366  // MS // of this method. This is to avoid to ship the matrix twice
367  // MS // (once for the symbolic factorization, and once for the numeric
368  // MS // factorization) when it is not necessary.
369 
372 
373  CreateTimer(Comm(), 2);
374  // MS // Initialize two timers:
375  // MS // timer 1: this will track all time spent in Amesos most
376  // MS // important functions, *including* UMFPACK functions
377  // MS // timer 2: this will track all time spent in this function
378  // MS // that is not due to UMFPACK calls, and therefore it
379  // MS // tracks down how much Amesos costs. The timer starts
380  // MS // and ends in *each* method, unless the method does not
381  // MS // perform any real operation. If a method calls another
382  // MS // method, the timer will be stopped before the called
383  // MS // method, then restared.
384  // MS // All the time of this timer goes into "overhead"
385 
386  MyPID_ = Comm().MyPID();
387  NumProcs_ = Comm().NumProc();
388 
391 
393 
395 
396  NumSymbolicFact_++;
397 
398  return 0;
399 }
400 
401 //=============================================================================
403 {
405 
406  if (IsSymbolicFactorizationOK_ == false)
407  {
408  // Call here what is needed, to avoid double shipping of the matrix
409  CreateTimer(Comm(), 2);
410 
411  MyPID_ = Comm().MyPID();
412  NumProcs_ = Comm().NumProc();
413 
416 
418 
420 
421  NumSymbolicFact_++;
422 
424  }
425  else
426  {
427  // need to reshuffle and reconvert because entry values may have changed
430 
432  }
433 
434  NumNumericFact_++;
435 
437 
438  return 0;
439 }
440 
441 //=============================================================================
443 {
444  // if necessary, perform numeric factorization.
445  // This may call SymbolicFactorization() as well.
448 
449  ResetTimer(1);
450 
451  Epetra_MultiVector* vecX = Problem_->GetLHS();
452  Epetra_MultiVector* vecB = Problem_->GetRHS();
453 
454  if ((vecX == 0) || (vecB == 0))
455  AMESOS_CHK_ERR(-1);
456 
457  int NumVectors = vecX->NumVectors();
458  if (NumVectors != vecB->NumVectors())
459  AMESOS_CHK_ERR(-1);
460 
461  Epetra_MultiVector *SerialB, *SerialX;
462 
463  // Extract Serial versions of X and B
464  //
465  double *SerialXvalues ;
466  double *SerialBvalues ;
467 
468  Epetra_MultiVector* SerialXextract = 0;
469  Epetra_MultiVector* SerialBextract = 0;
470 
471  // Copy B to the serial version of B
472  //
473  ResetTimer(0);
474 
475  if (IsLocal_ == 1) {
476  SerialB = vecB ;
477  SerialX = vecX ;
478  } else {
479  assert (IsLocal_ == 0);
480  SerialXextract = new Epetra_MultiVector(SerialMap(),NumVectors);
481  SerialBextract = new Epetra_MultiVector(SerialMap(),NumVectors);
482 
483  SerialBextract->Import(*vecB,Importer(),Insert);
484  SerialB = SerialBextract;
485  SerialX = SerialXextract;
486  }
487 
488  VecRedistTime_ = AddTime("Total vector redistribution time", VecRedistTime_, 0);
489 
490  // Call UMFPACK to perform the solve
491  // Note: UMFPACK uses a Compressed Column Storage instead of compressed row storage,
492  // Hence to compute A X = B, we ask UMFPACK to perform A^T X = B and vice versa
493 
494  OverheadTime_ = AddTime("Total Amesos overhead time", OverheadTime_, 1);
495 
496  ResetTimer(0);
497 
498  int SerialBlda, SerialXlda ;
499  int UmfpackRequest = UseTranspose()?UMFPACK_A:UMFPACK_At ;
500  int status = 0;
501 
502  if ( MyPID_ == 0 ) {
503  int ierr;
504  ierr = SerialB->ExtractView(&SerialBvalues, &SerialBlda);
505  assert (ierr == 0);
506  ierr = SerialX->ExtractView(&SerialXvalues, &SerialXlda);
507  assert (ierr == 0);
508  assert( SerialBlda == NumGlobalElements_ ) ;
509  assert( SerialXlda == NumGlobalElements_ ) ;
510 
511  for ( int j =0 ; j < NumVectors; j++ ) {
512  double *Control = (double *) NULL, *Info = (double *) NULL ;
513 
514  status = umfpack_di_solve (UmfpackRequest, &Ap[0],
515  &Ai[0], &Aval[0],
516  &SerialXvalues[j*SerialXlda],
517  &SerialBvalues[j*SerialBlda],
518  Numeric, Control, Info) ;
519  }
520  }
521 
522  if (status) AMESOS_CHK_ERR(status);
523 
524  SolveTime_ = AddTime("Total solve time", SolveTime_, 0);
525 
526  // Copy X back to the original vector
527 
528  ResetTimer(0);
529  ResetTimer(1);
530 
531  if ( IsLocal_ == 0 ) {
532  vecX->Export(*SerialX, Importer(), Insert ) ;
533  if (SerialBextract) delete SerialBextract ;
534  if (SerialXextract) delete SerialXextract ;
535  }
536 
537  VecRedistTime_ = AddTime("Total vector redistribution time", VecRedistTime_, 0);
538 
540  {
542  dynamic_cast<Epetra_RowMatrix*>(Problem_->GetOperator());
543  ComputeTrueResidual(*Matrix, *vecX, *vecB, UseTranspose(), "Amesos_Umfpack");
544  }
545 
546  if (ComputeVectorNorms_) {
547  ComputeVectorNorms(*vecX, *vecB, "Amesos_Umfpack");
548  }
549 
550  NumSolve_++;
551 
552  OverheadTime_ = AddTime("Total Amesos overhead time", OverheadTime_, 1); // Amesos overhead
553 
554  return(0);
555 }
556 
557 // ======================================================================
559 {
560  if (MyPID_ != 0) return;
561 
562  PrintLine();
563 
564  std::cout << "Amesos_Umfpack : Matrix has " << NumGlobalElements_ << " rows"
565  << " and " << numentries_ << " nonzeros" << std::endl;
566  std::cout << "Amesos_Umfpack : Nonzero elements per row = "
567  << 1.0*numentries_/NumGlobalElements_ << std::endl;
568  std::cout << "Amesos_Umfpack : Percentage of nonzero elements = "
569  << 100.0*numentries_/(pow(double(NumGlobalElements_),double(2.0))) << std::endl;
570  std::cout << "Amesos_Umfpack : Use transpose = " << UseTranspose_ << std::endl;
571 
572  PrintLine();
573 
574  return;
575 }
576 
577 // ======================================================================
579 {
580  if (Problem_->GetOperator() == 0 || MyPID_ != 0)
581  return;
582 
583  double ConTime = GetTime(MtxConvTime_);
584  double MatTime = GetTime(MtxRedistTime_);
585  double VecTime = GetTime(VecRedistTime_);
586  double SymTime = GetTime(SymFactTime_);
587  double NumTime = GetTime(NumFactTime_);
588  double SolTime = GetTime(SolveTime_);
589  double OveTime = GetTime(OverheadTime_);
590 
591  if (NumSymbolicFact_)
592  SymTime /= NumSymbolicFact_;
593 
594  if (NumNumericFact_)
595  NumTime /= NumNumericFact_;
596 
597  if (NumSolve_)
598  SolTime /= NumSolve_;
599 
600  std::string p = "Amesos_Umfpack : ";
601  PrintLine();
602 
603  std::cout << p << "Time to convert matrix to Umfpack format = "
604  << ConTime << " (s)" << std::endl;
605  std::cout << p << "Time to redistribute matrix = "
606  << MatTime << " (s)" << std::endl;
607  std::cout << p << "Time to redistribute vectors = "
608  << VecTime << " (s)" << std::endl;
609  std::cout << p << "Number of symbolic factorizations = "
610  << NumSymbolicFact_ << std::endl;
611  std::cout << p << "Time for sym fact = "
612  << SymTime * NumSymbolicFact_ << " (s), avg = "
613  << SymTime << " (s)" << std::endl;
614  std::cout << p << "Number of numeric factorizations = "
615  << NumNumericFact_ << std::endl;
616  std::cout << p << "Time for num fact = "
617  << NumTime * NumNumericFact_ << " (s), avg = "
618  << NumTime << " (s)" << std::endl;
619  std::cout << p << "Number of solve phases = "
620  << NumSolve_ << std::endl;
621  std::cout << p << "Time for solve = "
622  << SolTime * NumSolve_ << " (s), avg = " << SolTime << " (s)" << std::endl;
623  double tt = SymTime * NumSymbolicFact_ + NumTime * NumNumericFact_ + SolTime * NumSolve_;
624  if (tt != 0)
625  {
626  std::cout << p << "Total time spent in Amesos = " << tt << " (s) " << std::endl;
627  std::cout << p << "Total time spent in the Amesos interface = " << OveTime << " (s)" << std::endl;
628  std::cout << p << "(the above time does not include UMFPACK time)" << std::endl;
629  std::cout << p << "Amesos interface time / total time = " << OveTime / tt << std::endl;
630  }
631 
632  PrintLine();
633 
634  return;
635 }
std::vector< int > Ap
Ap, Ai, Aval form the compressed row storage used by Umfpack.
int numentries_
Number of non-zero entries in Problem_->GetOperator()
int NumSymbolicFact_
Number of symbolic factorization phases.
Definition: Amesos_Status.h:67
Amesos_Klu: A serial, unblocked code ideal for getting started and for very sparse matrices...
Definition: Amesos_Klu.h:111
double GetTime(const std::string what) const
Gets the cumulative time using the string.
Definition: Amesos_Time.h:102
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
int PerformSymbolicFactorization()
const Epetra_LinearProblem * GetProblem() const
Returns the Epetra_LinearProblem.
int MtxConvTime_
Quick access pointers to internal timer data.
virtual const Epetra_Map & RowMatrixRowMap() const=0
const Epetra_Map & SerialMap() const
const Epetra_LinearProblem * Problem_
Pointer to the linear problem to solve.
void * Numeric
Umfpack internal opaque object.
int LRID(int GRID_in) const
bool IsSymbolicFactorizationOK_
If true, SymbolicFactorization() has been successfully called.
Definition: Amesos_Status.h:48
bool MatrixShapeOK() const
Returns true if UMFPACK can handle this matrix shape.
const Epetra_CrsMatrix & SerialCrsMatrix() const
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
static void SetTracebackMode(int TracebackModeValue)
Teuchos::RCP< Epetra_CrsMatrix > SerialCrsMatrixA_
bool AddZeroToDiag_
Adds zero to diagonal of redistributed matrix (some solvers choke on a matrix with a partly empty dia...
#define P(k)
Insert
void PrintStatus() const
Prints information about the factorization and solution phases.
void CreateTimer(const Epetra_Comm &Comm, int size=1)
Initializes the Time object.
Definition: Amesos_Time.h:64
#define EPETRA_MIN(x, y)
double GetRcond() const
Returns an estimate of the reciprocal of the condition number.
int NumNumericFact_
Number of numeric factorization phases.
Definition: Amesos_Status.h:69
virtual int NumGlobalNonzeros() const=0
T * get() const
virtual int MyPID() const=0
int FillComplete(bool OptimizeDataStorage=true)
~Amesos_Umfpack(void)
Amesos_Umfpack Destructor.
int ConvertToSerial(const bool FirstTime)
Converts matrix to a serial Epetra_CrsMatrix.
int NumSolve_
Number of solves.
Definition: Amesos_Status.h:71
#define NULL
virtual int MaxNumEntries() const=0
int NumGlobalElements_
Number of rows and columns in the Problem_->GetOperator()
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
void SetStatusParameters(const Teuchos::ParameterList &ParameterList)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool ComputeVectorNorms_
If true, prints the norms of X and B in Solve().
Definition: Amesos_Status.h:56
void SetControlParameters(const Teuchos::ParameterList &ParameterList)
#define AMESOS_CHK_ERR(a)
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int NumVectors() const
int NumMyElements() const
Epetra_RowMatrix * Matrix()
Returns a pointer to the linear system matrix.
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.
Definition: Amesos_Utils.h:29
bool PrintTiming_
If true, prints timing information in the destructor.
Definition: Amesos_Status.h:52
bool PrintStatus_
If true, print additional information in the destructor.
Definition: Amesos_Status.h:54
Teuchos::RCP< Epetra_Import > ImportToSerial_
Importer from distributed to serial (all rows on process 0).
int AddTime(const std::string what, int dataID, const int timerID=0)
Adds to field what the time elapsed since last call to ResetTimer().
Definition: Amesos_Time.h:80
Epetra_RowMatrix * SerialMatrix_
Points to a Serial Copy of A.
virtual int Broadcast(double *MyVals, int Count, int Root) const=0
std::vector< double > Aval
Amesos_Umfpack(const Epetra_LinearProblem &LinearProblem)
Amesos_Umfpack Constructor.
const Epetra_Import & Importer() const
std::vector< int > Ai
Epetra_MultiVector * GetRHS() const
virtual int NumProc() const=0
bool UseTranspose() const
Returns the current UseTranspose setting.
double Rcond_
Reciprocal condition number estimate.
static int GetTracebackMode()
int Solve()
Solves A X = B (or AT x = B)
void PrintTiming() const
Prints timing information.
int NumGlobalElements() const
int PerformNumericFactorization()
Copy
int NumericFactorization()
Performs NumericFactorization on the matrix A.
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.
Definition: Amesos_Utils.h:52
void ResetTimer(const int timerID=0)
Resets the internally stored time object.
Definition: Amesos_Time.h:74
bool UseTranspose_
If true, solve the problem with the transpose.
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const=0
int IsLocal_
1 if Problem_->GetOperator() is stored entirely on process 0
Epetra_MultiVector * GetLHS() const
int ExtractView(double **A, int *MyLDA) const
int verbose_
Toggles the output level.
Definition: Amesos_Status.h:61
bool RcondValidOnAllProcs_
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
bool IsNumericFactorizationOK_
If true, NumericFactorization() has been successfully called.
Definition: Amesos_Status.h:50
Epetra_Operator * GetOperator() const
int n
int Import(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
virtual int NumGlobalRows() const=0
void PrintLine() const
Prints line on std::cout.
Definition: Amesos_Utils.h:71
#define EPETRA_MAX(x, y)
Teuchos::RCP< Epetra_Map > SerialMap_
Points to a Serial Map (unused if IsLocal == 1 )
bool ComputeTrueResidual_
If true, computes the true residual in Solve().
Definition: Amesos_Status.h:58
void * Symbolic
Umfpack internal opaque object.
double AddToDiag_
Add this value to the diagonal.