19 #ifndef AMESOS2_SOLVERCORE_DEF_HPP
20 #define AMESOS2_SOLVERCORE_DEF_HPP
22 #include "Kokkos_ArithTraits.hpp"
24 #include "Amesos2_MatrixAdapter_def.hpp"
25 #include "Amesos2_MultiVecAdapter_def.hpp"
29 #include "KokkosSparse_spmv.hpp"
30 #include "KokkosBlas.hpp"
35 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
37 Teuchos::RCP<const Matrix> A,
38 Teuchos::RCP<Vector> X,
39 Teuchos::RCP<const Vector> B )
40 : matrixA_(createConstMatrixAdapter<Matrix>(A))
43 , globalNumRows_(matrixA_->getGlobalNumRows())
44 , globalNumCols_(matrixA_->getGlobalNumCols())
45 , globalNumNonZeros_(matrixA_->getGlobalNNZ())
46 , rowIndexBase_(matrixA_->getRowIndexBase())
47 , columnIndexBase_(matrixA_->getColumnIndexBase())
48 , rank_(Teuchos::rank(*this->getComm()))
50 , nprocs_(Teuchos::
size(*this->getComm()))
52 TEUCHOS_TEST_FOR_EXCEPTION(
54 std::invalid_argument,
55 "Matrix shape inappropriate for this solver");
60 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
67 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
71 #ifdef HAVE_AMESOS2_TIMERS
72 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
77 int error_code =
static_cast<solver_type*
>(
this)->preOrdering_impl();
78 if (error_code == EXIT_SUCCESS){
79 ++status_.numPreOrder_;
80 status_.last_phase_ = PREORDERING;
87 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
91 #ifdef HAVE_AMESOS2_TIMERS
92 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
95 if( !status_.preOrderingDone() ){
97 if( !matrix_loaded_ ) loadA(SYMBFACT);
102 int error_code =
static_cast<solver_type*
>(
this)->symbolicFactorization_impl();
103 if (error_code == EXIT_SUCCESS){
104 ++status_.numSymbolicFact_;
105 status_.last_phase_ = SYMBFACT;
112 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
116 #ifdef HAVE_AMESOS2_TIMERS
117 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
120 if( !status_.symbolicFactorizationDone() ){
121 symbolicFactorization();
122 if( !matrix_loaded_ ) loadA(NUMFACT);
127 int error_code =
static_cast<solver_type*
>(
this)->numericFactorization_impl();
128 if (error_code == EXIT_SUCCESS){
129 ++status_.numNumericFact_;
130 status_.last_phase_ = NUMFACT;
137 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
141 solve(multiVecX_.ptr(), multiVecB_.ptr());
144 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
147 const Teuchos::Ptr<const Vector> B)
const
149 #ifdef HAVE_AMESOS2_TIMERS
150 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
156 if (control_.useIterRefine_) {
157 solve_ir(X, B, control_.maxNumIterRefines_, control_.verboseIterRefine_);
161 const Teuchos::RCP<MultiVecAdapter<Vector> > x =
162 createMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(X));
163 const Teuchos::RCP<const MultiVecAdapter<Vector> > b =
164 createConstMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(B));
166 #ifdef HAVE_AMESOS2_DEBUG
168 TEUCHOS_TEST_FOR_EXCEPTION
169 (x->getGlobalLength() != matrixA_->getGlobalNumCols(),
170 std::invalid_argument,
171 "MultiVector X must have length equal to the number of "
172 "global columns in A. X->getGlobalLength() = "
173 << x->getGlobalLength() <<
" != A->getGlobalNumCols() = "
174 << matrixA_->getGlobalNumCols() <<
".");
176 TEUCHOS_TEST_FOR_EXCEPTION(b->getGlobalLength() != matrixA_->getGlobalNumRows(),
177 std::invalid_argument,
178 "MultiVector B must have length equal to the number of "
181 TEUCHOS_TEST_FOR_EXCEPTION(x->getGlobalNumVectors() != b->getGlobalNumVectors(),
182 std::invalid_argument,
183 "X and B MultiVectors must have the same number of vectors");
184 #endif // HAVE_AMESOS2_DEBUG
186 if( !status_.numericFactorizationDone() ){
192 int error_code =
static_cast<const solver_type*
>(
this)->solve_impl(Teuchos::outArg(*x), Teuchos::ptrInArg(*b));
193 if (error_code == EXIT_SUCCESS){
195 status_.last_phase_ = SOLVE;
199 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
203 solve(Teuchos::ptr(X), Teuchos::ptr(B));
207 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
211 return solve_ir(multiVecX_.ptr(), multiVecB_.ptr(), maxNumIters, verbose);
214 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
216 SolverCore<ConcreteSolver,Matrix,Vector>::solve_ir(Vector* X,
const Vector* B,
const int maxNumIters,
const bool verbose)
const
218 return solve_ir(Teuchos::ptr(X), Teuchos::ptr(B), maxNumIters, verbose);
221 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
223 SolverCore<ConcreteSolver,Matrix,Vector>::solve_ir(
const Teuchos::Ptr< Vector> x,
224 const Teuchos::Ptr<const Vector> b,
225 const int maxNumIters,
226 const bool verbose)
const
228 using KAT = Kokkos::ArithTraits<scalar_type>;
229 using impl_scalar_type =
typename KAT::val_type;
230 using magni_type =
typename KAT::mag_type;
231 using host_execution_space = Kokkos::DefaultHostExecutionSpace;
232 using host_crsmat_t = KokkosSparse::CrsMatrix<impl_scalar_type, int, host_execution_space, void, int>;
233 using host_graph_t =
typename host_crsmat_t::StaticCrsGraphType;
234 using host_values_t =
typename host_crsmat_t::values_type::non_const_type;
235 using host_row_map_t =
typename host_graph_t::row_map_type::non_const_type;
236 using host_colinds_t =
typename host_graph_t::entries_type::non_const_type;
237 using host_mvector_t = Kokkos::View<impl_scalar_type **, Kokkos::LayoutLeft, host_execution_space>;
238 using host_vector_t = Kokkos::View<impl_scalar_type *, Kokkos::LayoutLeft, host_execution_space>;
239 using host_magni_view = Kokkos::View<magni_type *, Kokkos::LayoutLeft, host_execution_space>;
241 const impl_scalar_type one(1.0);
242 const impl_scalar_type mone = impl_scalar_type(-one);
243 const magni_type eps = KAT::eps ();
246 using MVAdapter = MultiVecAdapter<Vector>;
247 Teuchos::RCP< MVAdapter> X = createMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(x));
248 Teuchos::RCP<const MVAdapter> B = createConstMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(b));
250 auto r_ = B->clone();
251 auto e_ = X->clone();
254 Teuchos::RCP< MVAdapter> R = createMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(r));
255 Teuchos::RCP< MVAdapter> E = createMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(e));
257 const size_t nrhs = X->getGlobalNumVectors();
258 const int nnz = this->matrixA_->getGlobalNNZ();
259 const int nrows = this->matrixA_->getGlobalNumRows();
262 host_crsmat_t crsmat;
263 host_graph_t static_graph;
264 host_row_map_t rowmap_view;
265 host_colinds_t colind_view;
266 host_values_t values_view;
268 Kokkos::resize(rowmap_view, 1+nrows);
269 Kokkos::resize(colind_view, nnz);
270 Kokkos::resize(values_view, nnz);
272 Kokkos::resize(rowmap_view, 1);
273 Kokkos::resize(colind_view, 0);
274 Kokkos::resize(values_view, 0);
278 Util::get_crs_helper_kokkos_view<
279 MatrixAdapter<Matrix>, host_values_t, host_colinds_t, host_row_map_t>::do_get(
280 this->matrixA_.ptr(),
281 values_view, colind_view, rowmap_view,
282 nnz_ret, ROOTED, ARBITRARY, this->rowIndexBase_);
285 static_graph = host_graph_t(colind_view, rowmap_view);
286 crsmat = host_crsmat_t(
"CrsMatrix", nrows, values_view, static_graph);
291 static_cast<const solver_type*
>(
this)->solve_impl(Teuchos::outArg(*X), Teuchos::ptrInArg(*B));
295 const int ldx = (this->root_ ? X->getGlobalLength() : 0);
296 const int ldb = (this->root_ ? B->getGlobalLength() : 0);
297 const int ldr = (this->root_ ? R->getGlobalLength() : 0);
298 const int lde = (this->root_ ? E->getGlobalLength() : 0);
299 const bool initialize_data =
true;
300 const bool not_initialize_data =
true;
301 host_mvector_t X_view;
302 host_mvector_t B_view;
303 host_mvector_t R_view;
304 host_mvector_t E_view;
306 global_size_type rowIndexBase = this->rowIndexBase_;
307 auto Xptr = Teuchos::Ptr< MVAdapter>(X.ptr());
308 auto Bptr = Teuchos::Ptr<const MVAdapter>(B.ptr());
309 auto Rptr = Teuchos::Ptr< MVAdapter>(R.ptr());
310 auto Eptr = Teuchos::Ptr< MVAdapter>(E.ptr());
311 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
312 do_get( initialize_data, Xptr, X_view, ldx, CONTIGUOUS_AND_ROOTED, rowIndexBase);
313 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
314 do_get( initialize_data, Bptr, B_view, ldb, CONTIGUOUS_AND_ROOTED, rowIndexBase);
315 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
316 do_get(not_initialize_data, Rptr, R_view, ldr, CONTIGUOUS_AND_ROOTED, rowIndexBase);
317 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
318 do_get(not_initialize_data, Eptr, E_view, lde, CONTIGUOUS_AND_ROOTED, rowIndexBase);
321 host_magni_view x0norms(
"x0norms", nrhs);
322 host_magni_view bnorms(
"bnorms", nrhs);
323 host_magni_view enorms(
"enorms", nrhs);
326 for (
size_t j = 0; j < nrhs; j++) {
327 auto x_subview = Kokkos::subview(X_view, Kokkos::ALL(), j);
328 host_vector_t x_1d (const_cast<impl_scalar_type*>(x_subview.data()), x_subview.extent(0));
329 x0norms(j) = KokkosBlas::nrm2(x_1d);
332 std::cout << std::endl
333 <<
" SolverCore :: solve_ir (maxNumIters = " << maxNumIters
334 <<
", tol = " << x0norms(0) <<
" * " << eps <<
" = " << x0norms(0)*eps
340 std::cout <<
" bnorm = ";
341 for (
size_t j = 0; j < nrhs; j++) {
342 auto b_subview = Kokkos::subview(B_view, Kokkos::ALL(), j);
343 host_vector_t b_1d (const_cast<impl_scalar_type*>(b_subview.data()), b_subview.extent(0));
344 bnorms(j) = KokkosBlas::nrm2(b_1d);
345 std::cout << bnorms(j) <<
", ";
347 std::cout << std::endl;
356 for (numIters = 0; numIters < maxNumIters && converged == 0; ++numIters) {
359 Kokkos::deep_copy(R_view, B_view);
360 KokkosSparse::spmv(
"N", mone, crsmat, X_view, one, R_view);
365 std::cout <<
" > " << numIters <<
" : norm(r,x,e) = ";
366 for (
size_t j = 0; j < nrhs; j++) {
367 auto r_subview = Kokkos::subview(R_view, Kokkos::ALL(), j);
368 auto x_subview = Kokkos::subview(X_view, Kokkos::ALL(), j);
369 host_vector_t r_1d (const_cast<impl_scalar_type*>(r_subview.data()), r_subview.extent(0));
370 host_vector_t x_1d (const_cast<impl_scalar_type*>(x_subview.data()), x_subview.extent(0));
371 impl_scalar_type rnorm = KokkosBlas::nrm2(r_1d);
372 impl_scalar_type xnorm = KokkosBlas::nrm2(x_1d);
373 std::cout << rnorm <<
" -> " << rnorm/bnorms(j) <<
" " << xnorm <<
" " << enorms(j) <<
", ";
375 std::cout << std::endl;
380 Util::put_1d_data_helper_kokkos_view<MVAdapter, host_mvector_t>::
381 do_put(Rptr, R_view, ldr, CONTIGUOUS_AND_ROOTED, rowIndexBase);
382 static_cast<const solver_type*
>(
this)->solve_impl(Teuchos::outArg(*E), Teuchos::ptrInArg(*R));
383 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
384 do_get(initialize_data, Eptr, E_view, lde, CONTIGUOUS_AND_ROOTED, rowIndexBase);
388 KokkosBlas::axpy(one, E_view, X_view);
390 if (numIters < maxNumIters-1) {
393 for (
size_t j = 0; j < nrhs; j++) {
394 auto e_subview = Kokkos::subview(E_view, Kokkos::ALL(), j);
395 host_vector_t e_1d (const_cast<impl_scalar_type*>(e_subview.data()), e_subview.extent(0));
396 enorms(j) = KokkosBlas::nrm2(e_1d);
397 if (enorms(j) > eps * x0norms(j)) {
401 if (verbose && converged) {
402 std::cout <<
" converged " << std::endl;
408 Teuchos::broadcast(*(this->matrixA_->getComm()), 0, &converged);
411 if (verbose && this->root_) {
413 Kokkos::deep_copy(R_view, B_view);
414 KokkosSparse::spmv(
"N", mone, crsmat, X_view, one, R_view);
416 std::cout <<
" > final residual norm = ";
417 for (
size_t j = 0; j < nrhs; j++) {
418 auto r_subview = Kokkos::subview(R_view, Kokkos::ALL(), j);
419 host_vector_t r_1d (const_cast<impl_scalar_type*>(r_subview.data()), r_subview.extent(0));
420 scalar_type rnorm = KokkosBlas::nrm2(r_1d);
421 std::cout << rnorm <<
" -> " << rnorm/bnorms(j) <<
", ";
423 std::cout << std::endl << std::endl;
427 Util::put_1d_data_helper_kokkos_view<MVAdapter, host_mvector_t>::
428 do_put(Xptr, X_view, ldx, CONTIGUOUS_AND_ROOTED, rowIndexBase);
433 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
437 #ifdef HAVE_AMESOS2_TIMERS
438 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
441 return( static_cast<solver_type*>(
this)->matrixShapeOK_impl() );
447 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
452 matrixA_ = createConstMatrixAdapter(a);
454 #ifdef HAVE_AMESOS2_DEBUG
455 TEUCHOS_TEST_FOR_EXCEPTION( (keep_phase != CLEAN) &&
456 (globalNumRows_ != matrixA_->getGlobalNumRows() ||
457 globalNumCols_ != matrixA_->getGlobalNumCols()),
458 std::invalid_argument,
459 "Dimensions of new matrix be the same as the old matrix if "
460 "keeping any solver phase" );
463 status_.last_phase_ = keep_phase;
466 switch( status_.last_phase_ ){
468 status_.numPreOrder_ = 0;
471 status_.numSymbolicFact_ = 0;
474 status_.numNumericFact_ = 0;
477 status_.numSolve_ = 0;
484 globalNumNonZeros_ = matrixA_->getGlobalNNZ();
485 globalNumCols_ = matrixA_->getGlobalNumCols();
486 globalNumRows_ = matrixA_->getGlobalNumRows();
490 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
493 const Teuchos::RCP<Teuchos::ParameterList> & parameterList )
495 #ifdef HAVE_AMESOS2_TIMERS
496 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
499 if( parameterList->name() ==
"Amesos2" ){
501 Teuchos::RCP<const Teuchos::ParameterList> valid_params = getValidParameters();
502 parameterList->validateParameters(*valid_params);
505 control_.setControlParameters(parameterList);
509 if( parameterList->isSublist(name()) ){
512 control_.setControlParameters(Teuchos::sublist(parameterList, name()));
514 static_cast<solver_type*
>(
this)->setParameters_impl(Teuchos::sublist(parameterList, name()));
522 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
523 Teuchos::RCP<const Teuchos::ParameterList>
526 #ifdef HAVE_AMESOS2_TIMERS
527 Teuchos::TimeMonitor LocalTimer1( timers_.totalTime_ );
530 using Teuchos::ParameterList;
535 RCP<ParameterList> control_params = rcp(
new ParameterList(
"Amesos2"));
536 control_params->set(
"Transpose",
false,
"Whether to solve with the matrix transpose");
537 control_params->set(
"Iterative refinement",
false,
"Whether to solve with iterative refinement");
538 control_params->set(
"Number of iterative refinements", 2,
"Number of iterative refinements");
539 control_params->set(
"Verboes for iterative refinement",
false,
"Verbosity for iterative refinements");
545 RCP<const ParameterList>
546 solver_params =
static_cast<const solver_type*
>(
this)->getValidParameters_impl();
548 Teuchos::rcp_const_cast<ParameterList>(solver_params)->set(
"Transpose",
false,
549 "Whether to solve with the "
552 RCP<ParameterList> amesos2_params = rcp(
new ParameterList(
"Amesos2"));
553 amesos2_params->setParameters(*control_params);
554 amesos2_params->set(name(), *solver_params);
556 return amesos2_params;
560 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
564 std::ostringstream oss;
565 oss << name() <<
" solver interface";
570 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
573 Teuchos::FancyOStream &out,
574 const Teuchos::EVerbosityLevel verbLevel)
const
576 if( matrixA_.is_null() || (rank_ != 0) ){
return; }
579 using Teuchos::VERB_DEFAULT;
580 using Teuchos::VERB_NONE;
581 using Teuchos::VERB_LOW;
582 using Teuchos::VERB_MEDIUM;
583 using Teuchos::VERB_HIGH;
584 using Teuchos::VERB_EXTREME;
585 Teuchos::EVerbosityLevel vl = verbLevel;
586 if (vl == VERB_DEFAULT) vl = VERB_LOW;
587 Teuchos::RCP<const Teuchos::Comm<int> > comm = this->getComm();
589 for(
size_t dec = 10; dec < globalNumRows_; dec *= 10 ) {
592 width = std::max<size_t>(width,size_t(11)) + 2;
593 Teuchos::OSTab tab(out);
601 if( vl != VERB_NONE ) {
602 std::string p = name();
604 out << this->description() << std::endl << std::endl;
606 out << p <<
"Matrix has " << globalNumRows_ <<
" rows"
607 <<
" and " << globalNumNonZeros_ <<
" nonzeros"
609 if( vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME ){
610 out << p <<
"Nonzero elements per row = "
611 << globalNumNonZeros_ / globalNumRows_
613 out << p <<
"Percentage of nonzero elements = "
614 << 100.0 * globalNumNonZeros_ / (globalNumRows_ * globalNumCols_)
617 if( vl == VERB_HIGH || vl == VERB_EXTREME ){
618 out << p <<
"Use transpose = " << control_.useTranspose_
620 out << p <<
"Use iterative refinement = " << control_.useIterRefine_
623 if ( vl == VERB_EXTREME ){
631 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
634 Teuchos::FancyOStream &out,
635 const Teuchos::EVerbosityLevel verbLevel)
const
637 if( matrixA_.is_null() || (rank_ != 0) ){
return; }
639 double preTime = timers_.preOrderTime_.totalElapsedTime();
640 double symTime = timers_.symFactTime_.totalElapsedTime();
641 double numTime = timers_.numFactTime_.totalElapsedTime();
642 double solTime = timers_.solveTime_.totalElapsedTime();
643 double totTime = timers_.totalTime_.totalElapsedTime();
644 double overhead = totTime - (preTime + symTime + numTime + solTime);
646 std::string p = name() +
" : ";
649 if(verbLevel != Teuchos::VERB_NONE)
651 out << p <<
"Time to convert matrix to implementation format = "
652 << timers_.mtxConvTime_.totalElapsedTime() <<
" (s)"
654 out << p <<
"Time to redistribute matrix = "
655 << timers_.mtxRedistTime_.totalElapsedTime() <<
" (s)"
658 out << p <<
"Time to convert vectors to implementation format = "
659 << timers_.vecConvTime_.totalElapsedTime() <<
" (s)"
661 out << p <<
"Time to redistribute vectors = "
662 << timers_.vecRedistTime_.totalElapsedTime() <<
" (s)"
665 out << p <<
"Number of pre-orderings = "
666 << status_.getNumPreOrder()
668 out << p <<
"Time for pre-ordering = "
669 << preTime <<
" (s), avg = "
670 << preTime / status_.getNumPreOrder() <<
" (s)"
673 out << p <<
"Number of symbolic factorizations = "
674 << status_.getNumSymbolicFact()
676 out << p <<
"Time for sym fact = "
677 << symTime <<
" (s), avg = "
678 << symTime / status_.getNumSymbolicFact() <<
" (s)"
681 out << p <<
"Number of numeric factorizations = "
682 << status_.getNumNumericFact()
684 out << p <<
"Time for num fact = "
685 << numTime <<
" (s), avg = "
686 << numTime / status_.getNumNumericFact() <<
" (s)"
689 out << p <<
"Number of solve phases = "
690 << status_.getNumSolve()
692 out << p <<
"Time for solve = "
693 << solTime <<
" (s), avg = "
694 << solTime / status_.getNumSolve() <<
" (s)"
697 out << p <<
"Total time spent in Amesos2 = "
700 out << p <<
"Total time spent in the Amesos2 interface = "
701 << overhead <<
" (s)"
703 out << p <<
" (the above time does not include solver time)"
705 out << p <<
"Amesos2 interface time / total time = "
706 << overhead / totTime
713 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
716 Teuchos::ParameterList& timingParameterList)
const
718 Teuchos::ParameterList temp;
719 timingParameterList = temp.setName(
"NULL");
723 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
727 std::string solverName = solver_type::name;
731 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
735 matrix_loaded_ =
static_cast<solver_type*
>(
this)->loadA_impl(current_phase);
741 #endif // AMESOS2_SOLVERCORE_DEF_HPP
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Return a const parameter list of all of the valid parameters that this->setParameterList(...) will accept.
Definition: Amesos2_SolverCore_def.hpp:524
void solve() override
Solves (or )
Definition: Amesos2_SolverCore_def.hpp:139
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:71
~SolverCore()
Destructor.
Definition: Amesos2_SolverCore_def.hpp:61
const int size
Definition: klu2_simple.cpp:50
EPhase
Used to indicate a phase in the direct solution.
Definition: Amesos2_TypeDecl.hpp:31
super_type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) override
Set/update internal variables and solver options.
Definition: Amesos2_SolverCore_def.hpp:492
std::string description() const override
Returns a short description of this Solver.
Definition: Amesos2_SolverCore_def.hpp:562
void setA(const Teuchos::RCP< const Matrix > a, EPhase keep_phase=CLEAN) override
Sets the matrix A of this solver.
Definition: Amesos2_SolverCore_def.hpp:449
Utility functions for Amesos2.
super_type & preOrdering() override
Pre-orders the matrix A for minimal fill-in.
Definition: Amesos2_SolverCore_def.hpp:69
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const override
Definition: Amesos2_SolverCore_def.hpp:572
void printTiming(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override
Prints timing information about the current solver.
Definition: Amesos2_SolverCore_def.hpp:633
SolverCore(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
Initialize a Solver instance.
Definition: Amesos2_SolverCore_def.hpp:36
virtual type & numericFactorization(void)=0
Performs numeric factorization on the matrix.
bool matrixShapeOK() override
Returns true if the solver can handle this matrix shape.
Definition: Amesos2_SolverCore_def.hpp:435
void printLine(Teuchos::FancyOStream &out)
Prints a line of 70 "-"s on std::cout.
Definition: Amesos2_Util.cpp:85
super_type & symbolicFactorization() override
Performs symbolic factorization on the matrix A.
Definition: Amesos2_SolverCore_def.hpp:89
void loadA(EPhase current_phase)
Refresh this solver's internal data about A.
Definition: Amesos2_SolverCore_def.hpp:733
std::string name() const override
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:725
Interface to Amesos2 solver objects.
Definition: Amesos2_Solver_decl.hpp:44
void getTiming(Teuchos::ParameterList &timingParameterList) const override
Extracts timing information from the current solver.
Definition: Amesos2_SolverCore_def.hpp:715
super_type & numericFactorization() override
Performs numeric factorization on the matrix A.
Definition: Amesos2_SolverCore_def.hpp:114