Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_Superlu_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Amesos2: Templated Direct Sparse Solver Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ***********************************************************************
41 //
42 // @HEADER
43 
53 #ifndef AMESOS2_SUPERLU_DEF_HPP
54 #define AMESOS2_SUPERLU_DEF_HPP
55 
56 #include <Teuchos_Tuple.hpp>
57 #include <Teuchos_ParameterList.hpp>
58 #include <Teuchos_StandardParameterEntryValidators.hpp>
59 
61 #include "Amesos2_Superlu_decl.hpp"
62 
63 namespace Amesos2 {
64 
65 
66 template <class Matrix, class Vector>
68  Teuchos::RCP<const Matrix> A,
69  Teuchos::RCP<Vector> X,
70  Teuchos::RCP<const Vector> B )
71  : SolverCore<Amesos2::Superlu,Matrix,Vector>(A, X, B)
72  , nzvals_() // initialize to empty arrays
73  , rowind_()
74  , colptr_()
75 {
76  SLU::set_default_options(&(data_.options));
77  // Override some default options
78  data_.options.PrintStat = SLU::NO;
79 
80  SLU::StatInit(&(data_.stat));
81 
82  data_.perm_r.resize(this->globalNumRows_);
83  data_.perm_c.resize(this->globalNumCols_);
84  data_.etree.resize(this->globalNumCols_);
85  data_.R.resize(this->globalNumRows_);
86  data_.C.resize(this->globalNumCols_);
87 
88  data_.relax = SLU::sp_ienv(2); // Query optimal relax param from superlu
89  data_.panel_size = SLU::sp_ienv(1); // Query optimal panel size
90 
91  data_.equed = 'N'; // No equilibration
92  data_.A.Store = NULL;
93  data_.L.Store = NULL;
94  data_.U.Store = NULL;
95  data_.X.Store = NULL;
96  data_.B.Store = NULL;
97 }
98 
99 
100 template <class Matrix, class Vector>
102 {
103  /* Free Superlu data_types
104  * - Matrices
105  * - Vectors
106  * - Stat object
107  */
108  SLU::StatFree( &(data_.stat) ) ;
109 
110  // Storage is initialized in numericFactorization_impl()
111  if ( data_.A.Store != NULL ){
112  SLU::Destroy_SuperMatrix_Store( &(data_.A) );
113  }
114 
115  // only root allocated these SuperMatrices.
116  if ( data_.L.Store != NULL ){ // will only be true for this->root_
117  SLU::Destroy_SuperNode_Matrix( &(data_.L) );
118  SLU::Destroy_CompCol_Matrix( &(data_.U) );
119  }
120 }
121 
122 template<class Matrix, class Vector>
123 int
125 {
126  /*
127  * Get column permutation vector perm_c[], according to permc_spec:
128  * permc_spec = NATURAL: natural ordering
129  * permc_spec = MMD_AT_PLUS_A: minimum degree on structure of A'+A
130  * permc_spec = MMD_ATA: minimum degree on structure of A'*A
131  * permc_spec = COLAMD: approximate minimum degree column ordering
132  * permc_spec = MY_PERMC: the ordering already supplied in perm_c[]
133  */
134  int permc_spec = data_.options.ColPerm;
135  if ( permc_spec != SLU::MY_PERMC && this->root_ ){
136 #ifdef HAVE_AMESOS2_TIMERS
137  Teuchos::TimeMonitor preOrderTimer(this->timers_.preOrderTime_);
138 #endif
139 
140  SLU::get_perm_c(permc_spec, &(data_.A), data_.perm_c.getRawPtr());
141  }
142 
143  return(0);
144 }
145 
146 
147 template <class Matrix, class Vector>
148 int
150 {
151  /*
152  * SuperLU performs symbolic factorization and numeric factorization
153  * together, but does leave some options for reusing symbolic
154  * structures that have been created on previous factorizations. If
155  * our Amesos2 user calls this function, that is an indication that
156  * the symbolic structure of the matrix is no longer valid, and
157  * SuperLU should do the factorization from scratch.
158  *
159  * This can be accomplished by setting the options.Fact flag to
160  * DOFACT, as well as setting our own internal flag to false.
161  */
162  same_symbolic_ = false;
163  data_.options.Fact = SLU::DOFACT;
164 
165  return(0);
166 }
167 
168 
169 template <class Matrix, class Vector>
170 int
172 {
173  using Teuchos::as;
174 
175  // Cleanup old L and U matrices if we are not reusing a symbolic
176  // factorization. Stores and other data will be allocated in gstrf.
177  // Only rank 0 has valid pointers
178  if ( !same_symbolic_ && data_.L.Store != NULL ){
179  SLU::Destroy_SuperNode_Matrix( &(data_.L) );
180  SLU::Destroy_CompCol_Matrix( &(data_.U) );
181  data_.L.Store = NULL;
182  data_.U.Store = NULL;
183  }
184 
185  if( same_symbolic_ ) data_.options.Fact = SLU::SamePattern_SameRowPerm;
186 
187  int info = 0;
188  if ( this->root_ ){
189 
190 #ifdef HAVE_AMESOS2_DEBUG
191  TEUCHOS_TEST_FOR_EXCEPTION( data_.A.ncol != as<int>(this->globalNumCols_),
192  std::runtime_error,
193  "Error in converting to SuperLU SuperMatrix: wrong number of global columns." );
194  TEUCHOS_TEST_FOR_EXCEPTION( data_.A.nrow != as<int>(this->globalNumRows_),
195  std::runtime_error,
196  "Error in converting to SuperLU SuperMatrix: wrong number of global rows." );
197 #endif
198 
199  if( data_.options.Equil == SLU::YES ){
200  magnitude_type rowcnd, colcnd, amax;
201  int info2 = 0;
202 
203  // calculate row and column scalings
204  function_map::gsequ(&(data_.A), data_.R.getRawPtr(),
205  data_.C.getRawPtr(), &rowcnd, &colcnd,
206  &amax, &info2);
207  TEUCHOS_TEST_FOR_EXCEPTION( info2 != 0,
208  std::runtime_error,
209  "SuperLU gsequ returned with status " << info2 );
210 
211  // apply row and column scalings if necessary
212  function_map::laqgs(&(data_.A), data_.R.getRawPtr(),
213  data_.C.getRawPtr(), rowcnd, colcnd,
214  amax, &(data_.equed));
215 
216  // // check what types of equilibration was actually done
217  // data_.rowequ = (data_.equed == 'R') || (data_.equed == 'B');
218  // data_.colequ = (data_.equed == 'C') || (data_.equed == 'B');
219  }
220 
221  // Apply the column permutation computed in preOrdering. Place the
222  // column-permuted matrix in AC
223  SLU::sp_preorder(&(data_.options), &(data_.A), data_.perm_c.getRawPtr(),
224  data_.etree.getRawPtr(), &(data_.AC));
225 
226  { // Do factorization
227 #ifdef HAVE_AMESOS2_TIMERS
228  Teuchos::TimeMonitor numFactTimer(this->timers_.numFactTime_);
229 #endif
230 
231 #ifdef HAVE_AMESOS2_VERBOSE_DEBUG
232  std::cout << "Superlu:: Before numeric factorization" << std::endl;
233  std::cout << "nzvals_ : " << nzvals_.toString() << std::endl;
234  std::cout << "rowind_ : " << rowind_.toString() << std::endl;
235  std::cout << "colptr_ : " << colptr_.toString() << std::endl;
236 #endif
237 
238  function_map::gstrf(&(data_.options), &(data_.AC),
239  data_.relax, data_.panel_size, data_.etree.getRawPtr(),
240  NULL, 0, data_.perm_c.getRawPtr(), data_.perm_r.getRawPtr(),
241  &(data_.L), &(data_.U), &(data_.stat), &info);
242  }
243  // Cleanup. AC data will be alloc'd again for next factorization (if at all)
244  SLU::Destroy_CompCol_Permuted( &(data_.AC) );
245 
246  // Set the number of non-zero values in the L and U factors
247  this->setNnzLU( as<size_t>(((SLU::SCformat*)data_.L.Store)->nnz +
248  ((SLU::NCformat*)data_.U.Store)->nnz) );
249  }
250 
251  /* All processes should have the same error code */
252  Teuchos::broadcast(*(this->matrixA_->getComm()), 0, &info);
253 
254  global_size_type info_st = as<global_size_type>(info);
255  TEUCHOS_TEST_FOR_EXCEPTION( (info_st > 0) && (info_st <= this->globalNumCols_),
256  std::runtime_error,
257  "Factorization complete, but matrix is singular. Division by zero eminent");
258  TEUCHOS_TEST_FOR_EXCEPTION( (info_st > 0) && (info_st > this->globalNumCols_),
259  std::runtime_error,
260  "Memory allocation failure in Superlu factorization");
261 
262  data_.options.Fact = SLU::FACTORED;
263  same_symbolic_ = true;
264 
265  return(info);
266 }
267 
268 
269 template <class Matrix, class Vector>
270 int
272  const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const
273 {
274  using Teuchos::as;
275 
276  const global_size_type ld_rhs = this->root_ ? X->getGlobalLength() : 0;
277  const size_t nrhs = X->getGlobalNumVectors();
278 
279  const size_t val_store_size = as<size_t>(ld_rhs * nrhs);
280  Teuchos::Array<slu_type> xValues(val_store_size);
281  Teuchos::Array<slu_type> bValues(val_store_size);
282 
283  { // Get values from RHS B
284 #ifdef HAVE_AMESOS2_TIMERS
285  Teuchos::TimeMonitor mvConvTimer(this->timers_.vecConvTime_);
286  Teuchos::TimeMonitor redistTimer( this->timers_.vecRedistTime_ );
287 #endif
289  slu_type>::do_get(B, bValues(),
290  as<size_t>(ld_rhs),
291  ROOTED, this->rowIndexBase_);
292  }
293 
294  int ierr = 0; // returned error code
295 
296  magnitude_type rpg, rcond;
297  if ( this->root_ ) {
298  data_.ferr.resize(nrhs);
299  data_.berr.resize(nrhs);
300 
301  {
302 #ifdef HAVE_AMESOS2_TIMERS
303  Teuchos::TimeMonitor mvConvTimer(this->timers_.vecConvTime_);
304 #endif
305  SLU::Dtype_t dtype = type_map::dtype;
306  int i_ld_rhs = as<int>(ld_rhs);
307  function_map::create_Dense_Matrix(&(data_.B), i_ld_rhs, as<int>(nrhs),
308  bValues.getRawPtr(), i_ld_rhs,
309  SLU::SLU_DN, dtype, SLU::SLU_GE);
310  function_map::create_Dense_Matrix(&(data_.X), i_ld_rhs, as<int>(nrhs),
311  xValues.getRawPtr(), i_ld_rhs,
312  SLU::SLU_DN, dtype, SLU::SLU_GE);
313  }
314 
315  // Note: the values of B and X (after solution) are adjusted
316  // appropriately within gssvx for row and column scalings.
317 
318  { // Do solve!
319 #ifdef HAVE_AMESOS2_TIMERS
320  Teuchos::TimeMonitor solveTimer(this->timers_.solveTime_);
321 #endif
322 
323  function_map::gssvx(&(data_.options), &(data_.A),
324  data_.perm_c.getRawPtr(), data_.perm_r.getRawPtr(), data_.etree.getRawPtr(),
325  &(data_.equed), data_.R.getRawPtr(), data_.C.getRawPtr(), &(data_.L),
326  &(data_.U), NULL, 0, &(data_.B), &(data_.X), &rpg, &rcond,
327  data_.ferr.getRawPtr(), data_.berr.getRawPtr(), &(data_.mem_usage),
328  &(data_.stat), &ierr);
329  }
330 
331  // Cleanup X and B stores
332  SLU::Destroy_SuperMatrix_Store( &(data_.X) );
333  SLU::Destroy_SuperMatrix_Store( &(data_.B) );
334  data_.X.Store = NULL;
335  data_.B.Store = NULL;
336  }
337 
338  /* All processes should have the same error code */
339  Teuchos::broadcast(*(this->getComm()), 0, &ierr);
340 
341  global_size_type ierr_st = as<global_size_type>(ierr);
342  TEUCHOS_TEST_FOR_EXCEPTION( ierr < 0,
343  std::invalid_argument,
344  "Argument " << -ierr << " to SuperLU xgssvx had illegal value" );
345  TEUCHOS_TEST_FOR_EXCEPTION( ierr > 0 && ierr_st <= this->globalNumCols_,
346  std::runtime_error,
347  "Factorization complete, but U is exactly singular" );
348  TEUCHOS_TEST_FOR_EXCEPTION( ierr > 0 && ierr_st > this->globalNumCols_ + 1,
349  std::runtime_error,
350  "SuperLU allocated " << ierr - this->globalNumCols_ << " bytes of "
351  "memory before allocation failure occured." );
352 
353  /* Update X's global values */
354  {
355 #ifdef HAVE_AMESOS2_TIMERS
356  Teuchos::TimeMonitor redistTimer(this->timers_.vecRedistTime_);
357 #endif
358 
360  MultiVecAdapter<Vector>,slu_type>::do_put(X, xValues(),
361  as<size_t>(ld_rhs),
362  ROOTED, this->rowIndexBase_);
363  }
364 
365 
366  return(ierr);
367 }
368 
369 
370 template <class Matrix, class Vector>
371 bool
373 {
374  // The Superlu factorization routines can handle square as well as
375  // rectangular matrices, but Superlu can only apply the solve routines to
376  // square matrices, so we check the matrix for squareness.
377  return( this->matrixA_->getGlobalNumRows() == this->matrixA_->getGlobalNumCols() );
378 }
379 
380 
381 template <class Matrix, class Vector>
382 void
383 Superlu<Matrix,Vector>::setParameters_impl(const Teuchos::RCP<Teuchos::ParameterList> & parameterList )
384 {
385  using Teuchos::RCP;
386  using Teuchos::getIntegralValue;
387  using Teuchos::ParameterEntryValidator;
388 
389  RCP<const Teuchos::ParameterList> valid_params = getValidParameters_impl();
390 
391  data_.options.Trans = this->control_.useTranspose_ ? SLU::TRANS : SLU::NOTRANS;
392  // The SuperLU transpose option can override the Amesos2 option
393  if( parameterList->isParameter("Trans") ){
394  RCP<const ParameterEntryValidator> trans_validator = valid_params->getEntry("Trans").validator();
395  parameterList->getEntry("Trans").setValidator(trans_validator);
396 
397  data_.options.Trans = getIntegralValue<SLU::trans_t>(*parameterList, "Trans");
398  }
399 
400  if( parameterList->isParameter("IterRefine") ){
401  RCP<const ParameterEntryValidator> refine_validator = valid_params->getEntry("IterRefine").validator();
402  parameterList->getEntry("IterRefine").setValidator(refine_validator);
403 
404  data_.options.IterRefine = getIntegralValue<SLU::IterRefine_t>(*parameterList, "IterRefine");
405  }
406 
407  if( parameterList->isParameter("ColPerm") ){
408  RCP<const ParameterEntryValidator> colperm_validator = valid_params->getEntry("ColPerm").validator();
409  parameterList->getEntry("ColPerm").setValidator(colperm_validator);
410 
411  data_.options.ColPerm = getIntegralValue<SLU::colperm_t>(*parameterList, "ColPerm");
412  }
413 
414  data_.options.DiagPivotThresh = parameterList->get<double>("DiagPivotThresh", 1.0);
415 
416  bool equil = parameterList->get<bool>("Equil", true);
417  data_.options.Equil = equil ? SLU::YES : SLU::NO;
418 
419  bool symmetric_mode = parameterList->get<bool>("SymmetricMode", false);
420  data_.options.SymmetricMode = symmetric_mode ? SLU::YES : SLU::NO;
421 }
422 
423 
424 template <class Matrix, class Vector>
425 Teuchos::RCP<const Teuchos::ParameterList>
427 {
428  using std::string;
429  using Teuchos::tuple;
430  using Teuchos::ParameterList;
431  using Teuchos::EnhancedNumberValidator;
432  using Teuchos::setStringToIntegralParameter;
433  using Teuchos::stringToIntegralParameterEntryValidator;
434 
435  static Teuchos::RCP<const Teuchos::ParameterList> valid_params;
436 
437  if( is_null(valid_params) ){
438  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
439 
440  setStringToIntegralParameter<SLU::trans_t>("Trans", "NOTRANS",
441  "Solve for the transpose system or not",
442  tuple<string>("TRANS","NOTRANS","CONJ"),
443  tuple<string>("Solve with transpose",
444  "Do not solve with transpose",
445  "Solve with the conjugate transpose"),
446  tuple<SLU::trans_t>(SLU::TRANS,
447  SLU::NOTRANS,
448  SLU::CONJ),
449  pl.getRawPtr());
450 
451  setStringToIntegralParameter<SLU::IterRefine_t>("IterRefine", "NOREFINE",
452  "Type of iterative refinement to use",
453  tuple<string>("NOREFINE", "SLU_SINGLE", "SLU_DOUBLE"),
454  tuple<string>("Do not use iterative refinement",
455  "Do single iterative refinement",
456  "Do double iterative refinement"),
457  tuple<SLU::IterRefine_t>(SLU::NOREFINE,
458  SLU::SLU_SINGLE,
459  SLU::SLU_DOUBLE),
460  pl.getRawPtr());
461 
462  // Note: MY_PERMC not yet supported
463  setStringToIntegralParameter<SLU::colperm_t>("ColPerm", "COLAMD",
464  "Specifies how to permute the columns of the "
465  "matrix for sparsity preservation",
466  tuple<string>("NATURAL", "MMD_AT_PLUS_A",
467  "MMD_ATA", "COLAMD"),
468  tuple<string>("Natural ordering",
469  "Minimum degree ordering on A^T + A",
470  "Minimum degree ordering on A^T A",
471  "Approximate minimum degree column ordering"),
472  tuple<SLU::colperm_t>(SLU::NATURAL,
473  SLU::MMD_AT_PLUS_A,
474  SLU::MMD_ATA,
475  SLU::COLAMD),
476  pl.getRawPtr());
477 
478  Teuchos::RCP<EnhancedNumberValidator<double> > diag_pivot_thresh_validator
479  = Teuchos::rcp( new EnhancedNumberValidator<double>(0.0, 1.0) );
480  pl->set("DiagPivotThresh", 1.0,
481  "Specifies the threshold used for a diagonal entry to be an acceptable pivot",
482  diag_pivot_thresh_validator); // partial pivoting
483 
484  pl->set("Equil", true, "Whether to equilibrate the system before solve");
485 
486  pl->set("SymmetricMode", false,
487  "Specifies whether to use the symmetric mode. "
488  "Gives preference to diagonal pivots and uses "
489  "an (A^T + A)-based column permutation.");
490 
491  valid_params = pl;
492  }
493 
494  return valid_params;
495 }
496 
497 
498 template <class Matrix, class Vector>
499 bool
501 {
502  using Teuchos::as;
503 
504 #ifdef HAVE_AMESOS2_TIMERS
505  Teuchos::TimeMonitor convTimer(this->timers_.mtxConvTime_);
506 #endif
507 
508  // SuperLU does not need the matrix at symbolicFactorization()
509  if( current_phase == SYMBFACT ) return false;
510 
511  // Cleanup old store memory if it's non-NULL (should only ever be non-NULL at root_)
512  if( data_.A.Store != NULL ){
513  SLU::Destroy_SuperMatrix_Store( &(data_.A) );
514  data_.A.Store = NULL;
515  }
516 
517  // Only the root image needs storage allocated
518  if( this->root_ ){
519  nzvals_.resize(this->globalNumNonZeros_);
520  rowind_.resize(this->globalNumNonZeros_);
521  colptr_.resize(this->globalNumCols_ + 1);
522  }
523 
524  int nnz_ret = 0;
525  {
526 #ifdef HAVE_AMESOS2_TIMERS
527  Teuchos::TimeMonitor mtxRedistTimer( this->timers_.mtxRedistTime_ );
528 #endif
529 
530  TEUCHOS_TEST_FOR_EXCEPTION( this->rowIndexBase_ != this->columnIndexBase_,
531  std::runtime_error,
532  "Row and column maps have different indexbase ");
534  MatrixAdapter<Matrix>,slu_type,int,int>::do_get(this->matrixA_.ptr(),
535  nzvals_(), rowind_(),
536  colptr_(), nnz_ret, ROOTED,
537  ARBITRARY,
538  this->rowIndexBase_);
539  }
540 
541  // Get the SLU data type for this type of matrix
542  SLU::Dtype_t dtype = type_map::dtype;
543 
544  if( this->root_ ){
545  TEUCHOS_TEST_FOR_EXCEPTION( nnz_ret != as<int>(this->globalNumNonZeros_),
546  std::runtime_error,
547  "Did not get the expected number of non-zero vals");
548 
549  function_map::create_CompCol_Matrix( &(data_.A),
550  this->globalNumRows_, this->globalNumCols_,
551  nnz_ret,
552  nzvals_.getRawPtr(),
553  rowind_.getRawPtr(),
554  colptr_.getRawPtr(),
555  SLU::SLU_NC, dtype, SLU::SLU_GE);
556  }
557 
558  return true;
559 }
560 
561 
562 template<class Matrix, class Vector>
563 const char* Superlu<Matrix,Vector>::name = "SuperLU";
564 
565 
566 } // end namespace Amesos2
567 
568 #endif // AMESOS2_SUPERLU_DEF_HPP
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:105
Teuchos::Array< slu_type > nzvals_
Stores the values of the nonzero entries for SuperLU.
Definition: Amesos2_Superlu_decl.hpp:250
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_Superlu_def.hpp:500
EPhase
Used to indicate a phase in the direct solution.
Definition: Amesos2_TypeDecl.hpp:65
Teuchos::Array< int > colptr_
Stores the row indices of the nonzero entries.
Definition: Amesos2_Superlu_decl.hpp:254
int numericFactorization_impl()
Superlu specific numeric factorization.
Definition: Amesos2_Superlu_def.hpp:171
global_size_type columnIndexBase_
Index base of column map of matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:485
global_size_type globalNumCols_
Number of global columns in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:476
~Superlu()
Destructor.
Definition: Amesos2_Superlu_def.hpp:101
Teuchos::Array< int > rowind_
Stores the location in Ai_ and Aval_ that starts row j.
Definition: Amesos2_Superlu_decl.hpp:252
bool root_
If true, then this is the root processor.
Definition: Amesos2_SolverCore_decl.hpp:504
global_size_type globalNumRows_
Number of global rows in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:473
Amesos2 Superlu declarations.
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_Superlu_def.hpp:372
Helper class for getting 1-D copies of multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:243
Definition: Amesos2_TypeDecl.hpp:134
Superlu(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
Initialize from Teuchos::RCP.
Definition: Amesos2_Superlu_def.hpp:67
Control control_
Parameters for solving.
Definition: Amesos2_SolverCore_decl.hpp:492
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Superlu_def.hpp:426
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
A generic helper class for getting a CCS representation of a Matrix.
Definition: Amesos2_Util.hpp:575
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
Superlu specific solve.
Definition: Amesos2_Superlu_def.hpp:271
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns a pointer to the Teuchos::Comm communicator with this operator.
Definition: Amesos2_SolverCore_decl.hpp:360
A Matrix adapter interface for Amesos2.
Definition: Amesos2_MatrixAdapter_decl.hpp:76
global_size_type globalNumNonZeros_
Number of global non-zero values in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:479
void setNnzLU(size_t nnz)
Set the number of non-zero values in the and factors.
Definition: Amesos2_SolverCore_decl.hpp:449
Definition: Amesos2_TypeDecl.hpp:119
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > &parameterList)
Definition: Amesos2_Superlu_def.hpp:383
Timers timers_
Various timing statistics.
Definition: Amesos2_SolverCore_decl.hpp:495
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_Superlu_def.hpp:124
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:292
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:175
Teuchos::RCP< const MatrixAdapter< Matrix > > matrixA_
The LHS operator.
Definition: Amesos2_SolverCore_decl.hpp:452
global_size_type rowIndexBase_
Index base of rowmap of matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:482
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using Superlu.
Definition: Amesos2_Superlu_def.hpp:149
Amesos2 interface to the SuperLU package.
Definition: Amesos2_Superlu_decl.hpp:73