IFPACK  Development
 All Classes Files Functions Variables Enumerations Friends Pages
Ifpack_ILUT.cpp
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack: Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2002) 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 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
43 #include "Ifpack_ConfigDefs.h"
44 #include "Ifpack_Preconditioner.h"
45 #include "Ifpack_ILUT.h"
46 #include "Ifpack_Condest.h"
47 #include "Ifpack_Utils.h"
48 #include "Ifpack_HashTable.h"
49 #include "Epetra_SerialComm.h"
50 #include "Epetra_Comm.h"
51 #include "Epetra_Map.h"
52 #include "Epetra_RowMatrix.h"
53 #include "Epetra_CrsMatrix.h"
54 #include "Epetra_Vector.h"
55 #include "Epetra_MultiVector.h"
56 #include "Epetra_Util.h"
57 #include "Teuchos_ParameterList.hpp"
58 #include "Teuchos_RefCountPtr.hpp"
59 #include <functional>
60 
61 using namespace Teuchos;
62 
63 //==============================================================================
64 // FIXME: allocate Comm_ and Time_ the first Initialize() call
65 Ifpack_ILUT::Ifpack_ILUT(const Epetra_RowMatrix* A) :
66  A_(*A),
67  Comm_(A->Comm()),
68  Condest_(-1.0),
69  Relax_(0.),
70  Athresh_(0.0),
71  Rthresh_(1.0),
72  LevelOfFill_(1.0),
73  DropTolerance_(1e-12),
74  IsInitialized_(false),
75  IsComputed_(false),
76  UseTranspose_(false),
77  NumMyRows_(-1),
78  NumInitialize_(0),
79  NumCompute_(0),
80  NumApplyInverse_(0),
81  InitializeTime_(0.0),
82  ComputeTime_(0.0),
83  ApplyInverseTime_(0.0),
84  ComputeFlops_(0.0),
85  ApplyInverseFlops_(0.0),
86  Time_(Comm()),
87  GlobalNonzeros_(0)
88 {
89  // do nothing here..
90 }
91 
92 //==============================================================================
94 {
95  Destroy();
96 }
97 
98 //==============================================================================
99 void Ifpack_ILUT::Destroy()
100 {
101  IsInitialized_ = false;
102  IsComputed_ = false;
103 }
104 
105 //==========================================================================
106 int Ifpack_ILUT::SetParameters(Teuchos::ParameterList& List)
107 {
108  try
109  {
110  LevelOfFill_ = List.get<double>("fact: ilut level-of-fill", LevelOfFill());
111  if (LevelOfFill_ <= 0.0)
112  IFPACK_CHK_ERR(-2); // must be greater than 0.0
113 
114  Athresh_ = List.get<double>("fact: absolute threshold", Athresh_);
115  Rthresh_ = List.get<double>("fact: relative threshold", Rthresh_);
116  Relax_ = List.get<double>("fact: relax value", Relax_);
117  DropTolerance_ = List.get<double>("fact: drop tolerance", DropTolerance_);
118 
119  Label_ = "IFPACK ILUT (fill=" + Ifpack_toString(LevelOfFill())
120  + ", relax=" + Ifpack_toString(RelaxValue())
121  + ", athr=" + Ifpack_toString(AbsoluteThreshold())
122  + ", rthr=" + Ifpack_toString(RelativeThreshold())
123  + ", droptol=" + Ifpack_toString(DropTolerance())
124  + ")";
125  return(0);
126  }
127  catch (...)
128  {
129  cerr << "Caught an exception while parsing the parameter list" << endl;
130  cerr << "This typically means that a parameter was set with the" << endl;
131  cerr << "wrong type (for example, int instead of double). " << endl;
132  cerr << "please check the documentation for the type required by each parameer." << endl;
133  IFPACK_CHK_ERR(-1);
134  }
135 
136  return(0);
137 }
138 
139 //==========================================================================
141 {
142  // delete previously allocated factorization
143  Destroy();
144 
145  Time_.ResetStartTime();
146 
147  // check only in serial
148  if (Comm().NumProc() == 1 && Matrix().NumMyRows() != Matrix().NumMyCols())
149  IFPACK_CHK_ERR(-2);
150 
151  NumMyRows_ = Matrix().NumMyRows();
152 
153  // nothing else to do here
154  IsInitialized_ = true;
155  ++NumInitialize_;
156  InitializeTime_ += Time_.ElapsedTime();
157 
158  return(0);
159 }
160 
161 //==========================================================================
162 class Ifpack_AbsComp
163 {
164  public:
165  inline bool operator()(const double& x, const double& y)
166  {
167  return(IFPACK_ABS(x) > IFPACK_ABS(y));
168  }
169 };
170 
171 //==========================================================================
172 // MS // completely rewritten the algorithm on 25-Jan-05, using more STL
173 // MS // and in a nicer and cleaner way. Also, it is more efficient.
174 // MS // WARNING: Still not fully tested!
176 {
177  if (!IsInitialized())
178  IFPACK_CHK_ERR(Initialize());
179 
180  Time_.ResetStartTime();
181  IsComputed_ = false;
182 
183  NumMyRows_ = A_.NumMyRows();
184  int Length = A_.MaxNumEntries();
185  vector<int> RowIndicesL(Length);
186  vector<double> RowValuesL(Length);
187  vector<int> RowIndicesU(Length);
188  vector<double> RowValuesU(Length);
189  bool distributed = (Comm().NumProc() > 1)?true:false;
190 
191  if (distributed)
192  {
193  SerialComm_ = rcp(new Epetra_SerialComm);
194  SerialMap_ = rcp(new Epetra_Map(NumMyRows_, 0, *SerialComm_));
195  assert (SerialComm_.get() != 0);
196  assert (SerialMap_.get() != 0);
197  }
198  else
199  SerialMap_ = rcp(const_cast<Epetra_Map*>(&A_.RowMatrixRowMap()), false);
200 
201  int RowNnzU;
202 
203  L_ = rcp(new Epetra_CrsMatrix(Copy, *SerialMap_, 0));
204  U_ = rcp(new Epetra_CrsMatrix(Copy, *SerialMap_, 0));
205 
206  if ((L_.get() == 0) || (U_.get() == 0))
207  IFPACK_CHK_ERR(-5); // memory allocation error
208 
209  // insert first row in U_ and L_
210  IFPACK_CHK_ERR(A_.ExtractMyRowCopy(0,Length,RowNnzU,
211  &RowValuesU[0],&RowIndicesU[0]));
212 
213  if (distributed)
214  {
215  int count = 0;
216  for (int i = 0 ;i < RowNnzU ; ++i)
217  {
218  if (RowIndicesU[i] < NumMyRows_){
219  RowIndicesU[count] = RowIndicesU[i];
220  RowValuesU[count] = RowValuesU[i];
221  ++count;
222  }
223  else
224  continue;
225  }
226  RowNnzU = count;
227  }
228 
229  // modify diagonal
230  for (int i = 0 ;i < RowNnzU ; ++i) {
231  if (RowIndicesU[i] == 0) {
232  double& v = RowValuesU[i];
233  v = AbsoluteThreshold() * EPETRA_SGN(v) + RelativeThreshold() * v;
234  break;
235  }
236  }
237 
238  IFPACK_CHK_ERR(U_->InsertGlobalValues(0,RowNnzU,&(RowValuesU[0]),
239  &(RowIndicesU[0])));
240  // FIXME: DOES IT WORK IN PARALLEL ??
241  RowValuesU[0] = 1.0;
242  RowIndicesU[0] = 0;
243  IFPACK_CHK_ERR(L_->InsertGlobalValues(0,1,&(RowValuesU[0]),
244  &(RowIndicesU[0])));
245 
246  int max_keys = (int) 10 * A_.MaxNumEntries() * LevelOfFill() ;
247  Ifpack_HashTable SingleRowU(max_keys , 1);
248  Ifpack_HashTable SingleRowL(max_keys , 1);
249 
250  int hash_size = SingleRowU.getRecommendedHashSize(max_keys) ;
251  vector<int> keys; keys.reserve(hash_size * 10);
252  vector<double> values; values.reserve(hash_size * 10);
253  vector<double> AbsRow; AbsRow.reserve(hash_size * 10);
254 
255  // =================== //
256  // start factorization //
257  // =================== //
258 
259 #ifdef IFPACK_FLOPCOUNTERS
260  double this_proc_flops = 0.0;
261 #endif
262 
263  for (int row_i = 1 ; row_i < NumMyRows_ ; ++row_i)
264  {
265  // get row `row_i' of the matrix, store in U pointers
266  IFPACK_CHK_ERR(A_.ExtractMyRowCopy(row_i,Length,RowNnzU,
267  &RowValuesU[0],&RowIndicesU[0]));
268 
269  if (distributed)
270  {
271  int count = 0;
272  for (int i = 0 ;i < RowNnzU ; ++i)
273  {
274  if (RowIndicesU[i] < NumMyRows_){
275  RowIndicesU[count] = RowIndicesU[i];
276  RowValuesU[count] = RowValuesU[i];
277  ++count;
278  }
279  else
280  continue;
281  }
282  RowNnzU = count;
283  }
284 
285  int NnzLower = 0;
286  int NnzUpper = 0;
287 
288  for (int i = 0 ;i < RowNnzU ; ++i) {
289  if (RowIndicesU[i] < row_i)
290  NnzLower++;
291  else if (RowIndicesU[i] == row_i) {
292  // add threshold
293  NnzUpper++;
294  double& v = RowValuesU[i];
295  v = AbsoluteThreshold() * EPETRA_SGN(v) + RelativeThreshold() * v;
296  }
297  else
298  NnzUpper++;
299  }
300 
301  int FillL = (int)(LevelOfFill() * NnzLower);
302  int FillU = (int)(LevelOfFill() * NnzUpper);
303  if (FillL == 0) FillL = 1;
304  if (FillU == 0) FillU = 1;
305 
306  // convert line `row_i' into STL map for fast access
307  SingleRowU.reset();
308 
309  for (int i = 0 ; i < RowNnzU ; ++i) {
310  SingleRowU.set(RowIndicesU[i], RowValuesU[i]);
311  }
312 
313  // for the multipliers
314  SingleRowL.reset();
315 
316  int start_col = NumMyRows_;
317  for (int i = 0 ; i < RowNnzU ; ++i)
318  start_col = EPETRA_MIN(start_col, RowIndicesU[i]);
319 
320 #ifdef IFPACK_FLOPCOUNTERS
321  int flops = 0;
322 #endif
323 
324  for (int col_k = start_col ; col_k < row_i ; ++col_k) {
325 
326  int* ColIndicesK;
327  double* ColValuesK;
328  int ColNnzK;
329 
330  double xxx = SingleRowU.get(col_k);
331  // This factorization is too "relaxed". Leaving it as it is, as Tifpack
332  // does it correctly.
333  if (IFPACK_ABS(xxx) > DropTolerance()) {
334  IFPACK_CHK_ERR(U_->ExtractGlobalRowView(col_k, ColNnzK, ColValuesK,
335  ColIndicesK));
336 
337  // FIXME: can keep trace of diagonals
338  double DiagonalValueK = 0.0;
339  for (int i = 0 ; i < ColNnzK ; ++i) {
340  if (ColIndicesK[i] == col_k) {
341  DiagonalValueK = ColValuesK[i];
342  break;
343  }
344  }
345 
346  // FIXME: this should never happen!
347  if (DiagonalValueK == 0.0)
348  DiagonalValueK = AbsoluteThreshold();
349 
350  double yyy = xxx / DiagonalValueK ;
351  SingleRowL.set(col_k, yyy);
352 #ifdef IFPACK_FLOPCOUNTERS
353  ++flops;
354 #endif
355 
356  for (int j = 0 ; yyy != 0.0 && j < ColNnzK ; ++j)
357  {
358  int col_j = ColIndicesK[j];
359 
360  if (col_j < col_k) continue;
361 
362  SingleRowU.set(col_j, -yyy * ColValuesK[j], true);
363 #ifdef IFPACK_FLOPCOUNTERS
364  flops += 2;
365 #endif
366  }
367  }
368  }
369 
370 #ifdef IFPACK_FLOPCOUNTERS
371  this_proc_flops += 1.0 * flops;
372 #endif
373 
374  double cutoff = DropTolerance();
375  double DiscardedElements = 0.0;
376  int count;
377 
378  // drop elements to satisfy LevelOfFill(), start with L
379  count = 0;
380  int sizeL = SingleRowL.getNumEntries();
381  keys.resize(sizeL);
382  values.resize(sizeL);
383 
384  AbsRow.resize(sizeL);
385 
386  SingleRowL.arrayify(
387  keys.size() ? &keys[0] : 0,
388  values.size() ? &values[0] : 0
389  );
390  for (int i = 0; i < sizeL; ++i)
391  if (IFPACK_ABS(values[i]) > DropTolerance()) {
392  AbsRow[count++] = IFPACK_ABS(values[i]);
393  }
394 
395  if (count > FillL) {
396  nth_element(AbsRow.begin(), AbsRow.begin() + FillL, AbsRow.begin() + count,
397  greater<double>());
398  cutoff = AbsRow[FillL];
399  }
400 
401  for (int i = 0; i < sizeL; ++i) {
402  if (IFPACK_ABS(values[i]) >= cutoff) {
403  IFPACK_CHK_ERR(L_->InsertGlobalValues(row_i,1, &values[i], (int*)&keys[i]));
404  }
405  else
406  DiscardedElements += values[i];
407  }
408 
409  // FIXME: DOES IT WORK IN PARALLEL ???
410  // add 1 to the diagonal
411  double dtmp = 1.0;
412  IFPACK_CHK_ERR(L_->InsertGlobalValues(row_i,1, &dtmp, &row_i));
413 
414  // same business with U_
415  count = 0;
416  int sizeU = SingleRowU.getNumEntries();
417  AbsRow.resize(sizeU + 1);
418  keys.resize(sizeU + 1);
419  values.resize(sizeU + 1);
420 
421  SingleRowU.arrayify(&keys[0], &values[0]);
422 
423  for (int i = 0; i < sizeU; ++i)
424  if (keys[i] >= row_i && IFPACK_ABS(values[i]) > DropTolerance())
425  {
426  AbsRow[count++] = IFPACK_ABS(values[i]);
427  }
428 
429  if (count > FillU) {
430  nth_element(AbsRow.begin(), AbsRow.begin() + FillU, AbsRow.begin() + count,
431  greater<double>());
432  cutoff = AbsRow[FillU];
433  }
434 
435  // sets the factors in U_
436  for (int i = 0; i < sizeU; ++i)
437  {
438  int col = keys[i];
439  double val = values[i];
440 
441  if (col >= row_i) {
442  if (IFPACK_ABS(val) >= cutoff || row_i == col) {
443  IFPACK_CHK_ERR(U_->InsertGlobalValues(row_i,1, &val, &col));
444  }
445  else
446  DiscardedElements += val;
447  }
448  }
449 
450  // FIXME: not so sure of that!
451  if (RelaxValue() != 0.0) {
452  DiscardedElements *= RelaxValue();
453  IFPACK_CHK_ERR(U_->InsertGlobalValues(row_i,1, &DiscardedElements,
454  &row_i));
455  }
456  }
457 
458 #ifdef IFPACK_FLOPCOUNTERS
459  double tf;
460  Comm().SumAll(&this_proc_flops, &tf, 1);
461  ComputeFlops_ += tf;
462 #endif
463 
464  IFPACK_CHK_ERR(L_->FillComplete());
465  IFPACK_CHK_ERR(U_->FillComplete());
466 
467 #if 0
468  // to check the complete factorization
469  Epetra_Vector LHS(A_.RowMatrixRowMap());
470  Epetra_Vector RHS1(A_.RowMatrixRowMap());
471  Epetra_Vector RHS2(A_.RowMatrixRowMap());
472  Epetra_Vector RHS3(A_.RowMatrixRowMap());
473  LHS.Random();
474 
475  cout << "A = " << A_.NumGlobalNonzeros() << endl;
476  cout << "L = " << L_->NumGlobalNonzeros() << endl;
477  cout << "U = " << U_->NumGlobalNonzeros() << endl;
478 
479  A_.Multiply(false,LHS,RHS1);
480  U_->Multiply(false,LHS,RHS2);
481  L_->Multiply(false,RHS2,RHS3);
482 
483  RHS1.Update(-1.0, RHS3, 1.0);
484  double Norm;
485  RHS1.Norm2(&Norm);
486 #endif
487 
488  int MyNonzeros = L_->NumGlobalNonzeros() + U_->NumGlobalNonzeros();
489  Comm().SumAll(&MyNonzeros, &GlobalNonzeros_, 1);
490 
491  IsComputed_ = true;
492 
493  ++NumCompute_;
494  ComputeTime_ += Time_.ElapsedTime();
495 
496  return(0);
497 
498 }
499 
500 //=============================================================================
501 int Ifpack_ILUT::ApplyInverse(const Epetra_MultiVector& X,
502  Epetra_MultiVector& Y) const
503 {
504  if (!IsComputed())
505  IFPACK_CHK_ERR(-2); // compute preconditioner first
506 
507  if (X.NumVectors() != Y.NumVectors())
508  IFPACK_CHK_ERR(-3); // Return error: X and Y not the same size
509 
510  Time_.ResetStartTime();
511 
512  // NOTE: L_ and U_ are based on SerialMap_, while Xcopy is based
513  // on A.Map()... which are in general different. However, Solve()
514  // does not seem to care... which is fine with me.
515  //
516  // AztecOO gives X and Y pointing to the same memory location,
517  // need to create an auxiliary vector, Xcopy
518  Teuchos::RefCountPtr<const Epetra_MultiVector> Xcopy;
519  if (X.Pointers()[0] == Y.Pointers()[0])
520  Xcopy = Teuchos::rcp( new Epetra_MultiVector(X) );
521  else
522  Xcopy = Teuchos::rcp( &X, false );
523 
524  if (!UseTranspose_)
525  {
526  // solves LU Y = X
527  IFPACK_CHK_ERR(L_->Solve(false,false,false,*Xcopy,Y));
528  IFPACK_CHK_ERR(U_->Solve(true,false,false,Y,Y));
529  }
530  else
531  {
532  // solves U(trans) L(trans) Y = X
533  IFPACK_CHK_ERR(U_->Solve(true,true,false,*Xcopy,Y));
534  IFPACK_CHK_ERR(L_->Solve(false,true,false,Y,Y));
535  }
536 
537  ++NumApplyInverse_;
538 #ifdef IFPACK_FLOPCOUNTERS
539  ApplyInverseFlops_ += X.NumVectors() * 2 * GlobalNonzeros_;
540 #endif
541  ApplyInverseTime_ += Time_.ElapsedTime();
542 
543  return(0);
544 
545 }
546 //=============================================================================
547 // This function finds X such that LDU Y = X or U(trans) D L(trans) Y = X for multiple RHS
548 int Ifpack_ILUT::Apply(const Epetra_MultiVector& X,
549  Epetra_MultiVector& Y) const
550 {
551  return(-98);
552 }
553 
554 //=============================================================================
555 double Ifpack_ILUT::Condest(const Ifpack_CondestType CT,
556  const int MaxIters, const double Tol,
557  Epetra_RowMatrix* Matrix_in)
558 {
559  if (!IsComputed()) // cannot compute right now
560  return(-1.0);
561 
562  // NOTE: this is computing the *local* condest
563  if (Condest_ == -1.0)
564  Condest_ = Ifpack_Condest(*this, CT, MaxIters, Tol, Matrix_in);
565 
566  return(Condest_);
567 }
568 
569 //=============================================================================
570 std::ostream&
571 Ifpack_ILUT::Print(std::ostream& os) const
572 {
573  if (!Comm().MyPID()) {
574  os << endl;
575  os << "================================================================================" << endl;
576  os << "Ifpack_ILUT: " << Label() << endl << endl;
577  os << "Level-of-fill = " << LevelOfFill() << endl;
578  os << "Absolute threshold = " << AbsoluteThreshold() << endl;
579  os << "Relative threshold = " << RelativeThreshold() << endl;
580  os << "Relax value = " << RelaxValue() << endl;
581  os << "Condition number estimate = " << Condest() << endl;
582  os << "Global number of rows = " << A_.NumGlobalRows() << endl;
583  if (IsComputed_) {
584  os << "Number of nonzeros in A = " << A_.NumGlobalNonzeros() << endl;
585  os << "Number of nonzeros in L + U = " << NumGlobalNonzeros()
586  << " ( = " << 100.0 * NumGlobalNonzeros() / A_.NumGlobalNonzeros()
587  << " % of A)" << endl;
588  os << "nonzeros / rows = "
589  << 1.0 * NumGlobalNonzeros() / U_->NumGlobalRows() << endl;
590  }
591  os << endl;
592  os << "Phase # calls Total Time (s) Total MFlops MFlops/s" << endl;
593  os << "----- ------- -------------- ------------ --------" << endl;
594  os << "Initialize() " << std::setw(5) << NumInitialize()
595  << " " << std::setw(15) << InitializeTime()
596  << " 0.0 0.0" << endl;
597  os << "Compute() " << std::setw(5) << NumCompute()
598  << " " << std::setw(15) << ComputeTime()
599  << " " << std::setw(15) << 1.0e-6 * ComputeFlops();
600  if (ComputeTime() != 0.0)
601  os << " " << std::setw(15) << 1.0e-6 * ComputeFlops() / ComputeTime() << endl;
602  else
603  os << " " << std::setw(15) << 0.0 << endl;
604  os << "ApplyInverse() " << std::setw(5) << NumApplyInverse()
605  << " " << std::setw(15) << ApplyInverseTime()
606  << " " << std::setw(15) << 1.0e-6 * ApplyInverseFlops();
607  if (ApplyInverseTime() != 0.0)
608  os << " " << std::setw(15) << 1.0e-6 * ApplyInverseFlops() / ApplyInverseTime() << endl;
609  else
610  os << " " << std::setw(15) << 0.0 << endl;
611  os << "================================================================================" << endl;
612  os << endl;
613  }
614 
615  return(os);
616 }
virtual ostream & Print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator&lt;&lt;.
const Epetra_RowMatrix & Matrix() const
Returns a reference to the matrix to be preconditioned.
Definition: Ifpack_ILUT.h:190
double Condest() const
Returns the computed estimated condition number, or -1.0 if no computed.
Definition: Ifpack_ILUT.h:154
bool IsComputed() const
If factor is completed, this query returns true, otherwise it returns false.
Definition: Ifpack_ILUT.h:130
virtual int NumApplyInverse() const
Returns the number of calls to ApplyInverse().
Definition: Ifpack_ILUT.h:230
Ifpack_ILUT(const Epetra_RowMatrix *A)
Ifpack_ILUT constuctor with variable number of indices per row.
Definition: Ifpack_ILUT.cpp:65
int SetParameters(Teuchos::ParameterList &parameterlis)
Set parameters using a Teuchos::ParameterList object.
virtual int NumInitialize() const
Returns the number of calls to Initialize().
Definition: Ifpack_ILUT.h:218
string Ifpack_toString(const int &x)
Convertes an integer to string.
int Initialize()
Initialize L and U with values from user matrix A.
virtual ~Ifpack_ILUT()
Ifpack_ILUT Destructor.
Definition: Ifpack_ILUT.cpp:93
double RelativeThreshold() const
Get relative threshold value.
Definition: Ifpack_ILUT.h:285
void arrayify(int *key_array, double *val_array)
Converts the contents in array format for both keys and values.
const Epetra_Comm & Comm() const
Returns the Epetra_BlockMap object associated with the range of this matrix operator.
Definition: Ifpack_ILUT.h:187
virtual int NumCompute() const
Returns the number of calls to Compute().
Definition: Ifpack_ILUT.h:224
int Compute()
Compute IC factor U using the specified graph, diagonal perturbation thresholds and relaxation parame...
void set(const int key, const double value, const bool addToValue=false)
Sets an element in the hash table.
virtual double ComputeFlops() const
Returns the number of flops in the computation phase.
Definition: Ifpack_ILUT.h:259
virtual double ApplyInverseTime() const
Returns the time spent in ApplyInverse().
Definition: Ifpack_ILUT.h:248
int getNumEntries() const
Returns the number of stored entries.
bool IsInitialized() const
Returns true if the preconditioner has been successfully initialized.
Definition: Ifpack_ILUT.h:113
virtual double ApplyInverseFlops() const
Returns the number of flops in the application of the preconditioner.
Definition: Ifpack_ILUT.h:264
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Ifpack_ILUT forward/back solve on a Epetra_MultiVector X in Y...
double DropTolerance() const
Gets the dropping tolerance.
Definition: Ifpack_ILUT.h:291
virtual double ComputeTime() const
Returns the time spent in Compute().
Definition: Ifpack_ILUT.h:242
double AbsoluteThreshold() const
Get absolute threshold value.
Definition: Ifpack_ILUT.h:279
double get(const int key)
Returns an element from the hash table, or 0.0 if not found.
int NumGlobalNonzeros() const
Returns the number of nonzero entries in the global graph.
Definition: Ifpack_ILUT.h:297
const char * Label() const
Returns the label of this object.
Definition: Ifpack_ILUT.h:202
virtual double InitializeTime() const
Returns the time spent in Initialize().
Definition: Ifpack_ILUT.h:236
void reset()
Resets the entries of the already allocated memory. This method can be used to clean an array...
double RelaxValue() const
Set relative threshold value.
Definition: Ifpack_ILUT.h:274