53 #ifndef AMESOS2_SOLVERCORE_DEF_HPP
54 #define AMESOS2_SOLVERCORE_DEF_HPP
56 #include "Kokkos_ArithTraits.hpp"
58 #include "Amesos2_MatrixAdapter_def.hpp"
59 #include "Amesos2_MultiVecAdapter_def.hpp"
63 #include "KokkosSparse_spmv.hpp"
64 #include "KokkosBlas.hpp"
69 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
71 Teuchos::RCP<const Matrix> A,
72 Teuchos::RCP<Vector> X,
73 Teuchos::RCP<const Vector> B )
74 : matrixA_(createConstMatrixAdapter<Matrix>(A))
77 , globalNumRows_(matrixA_->getGlobalNumRows())
78 , globalNumCols_(matrixA_->getGlobalNumCols())
79 , globalNumNonZeros_(matrixA_->getGlobalNNZ())
80 , rowIndexBase_(matrixA_->getRowIndexBase())
81 , columnIndexBase_(matrixA_->getColumnIndexBase())
82 , rank_(Teuchos::rank(*this->getComm()))
84 , nprocs_(Teuchos::
size(*this->getComm()))
86 TEUCHOS_TEST_FOR_EXCEPTION(
88 std::invalid_argument,
89 "Matrix shape inappropriate for this solver");
94 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
101 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
105 #ifdef HAVE_AMESOS2_TIMERS
106 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
111 int error_code =
static_cast<solver_type*
>(
this)->preOrdering_impl();
112 if (error_code == EXIT_SUCCESS){
113 ++status_.numPreOrder_;
114 status_.last_phase_ = PREORDERING;
121 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
125 #ifdef HAVE_AMESOS2_TIMERS
126 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
129 if( !status_.preOrderingDone() ){
131 if( !matrix_loaded_ ) loadA(SYMBFACT);
136 int error_code =
static_cast<solver_type*
>(
this)->symbolicFactorization_impl();
137 if (error_code == EXIT_SUCCESS){
138 ++status_.numSymbolicFact_;
139 status_.last_phase_ = SYMBFACT;
146 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
150 #ifdef HAVE_AMESOS2_TIMERS
151 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
154 if( !status_.symbolicFactorizationDone() ){
155 symbolicFactorization();
156 if( !matrix_loaded_ ) loadA(NUMFACT);
161 int error_code =
static_cast<solver_type*
>(
this)->numericFactorization_impl();
162 if (error_code == EXIT_SUCCESS){
163 ++status_.numNumericFact_;
164 status_.last_phase_ = NUMFACT;
171 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
175 solve(multiVecX_.ptr(), multiVecB_.ptr());
178 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
181 const Teuchos::Ptr<const Vector> B)
const
183 #ifdef HAVE_AMESOS2_TIMERS
184 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
190 if (control_.useIterRefine_) {
191 solve_ir(X, B, control_.maxNumIterRefines_, control_.verboseIterRefine_);
195 const Teuchos::RCP<MultiVecAdapter<Vector> > x =
196 createMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(X));
197 const Teuchos::RCP<const MultiVecAdapter<Vector> > b =
198 createConstMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(B));
200 #ifdef HAVE_AMESOS2_DEBUG
202 TEUCHOS_TEST_FOR_EXCEPTION
203 (x->getGlobalLength() != matrixA_->getGlobalNumCols(),
204 std::invalid_argument,
205 "MultiVector X must have length equal to the number of "
206 "global columns in A. X->getGlobalLength() = "
207 << x->getGlobalLength() <<
" != A->getGlobalNumCols() = "
208 << matrixA_->getGlobalNumCols() <<
".");
210 TEUCHOS_TEST_FOR_EXCEPTION(b->getGlobalLength() != matrixA_->getGlobalNumRows(),
211 std::invalid_argument,
212 "MultiVector B must have length equal to the number of "
215 TEUCHOS_TEST_FOR_EXCEPTION(x->getGlobalNumVectors() != b->getGlobalNumVectors(),
216 std::invalid_argument,
217 "X and B MultiVectors must have the same number of vectors");
218 #endif // HAVE_AMESOS2_DEBUG
220 if( !status_.numericFactorizationDone() ){
226 int error_code =
static_cast<const solver_type*
>(
this)->solve_impl(Teuchos::outArg(*x), Teuchos::ptrInArg(*b));
227 if (error_code == EXIT_SUCCESS){
229 status_.last_phase_ = SOLVE;
233 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
237 solve(Teuchos::ptr(X), Teuchos::ptr(B));
241 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
245 return solve_ir(multiVecX_.ptr(), multiVecB_.ptr(), maxNumIters, verbose);
248 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
250 SolverCore<ConcreteSolver,Matrix,Vector>::solve_ir(Vector* X,
const Vector* B,
const int maxNumIters,
const bool verbose)
const
252 return solve_ir(Teuchos::ptr(X), Teuchos::ptr(B), maxNumIters, verbose);
255 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
257 SolverCore<ConcreteSolver,Matrix,Vector>::solve_ir(
const Teuchos::Ptr< Vector> x,
258 const Teuchos::Ptr<const Vector> b,
259 const int maxNumIters,
260 const bool verbose)
const
262 using KAT = Kokkos::ArithTraits<scalar_type>;
263 using impl_scalar_type =
typename KAT::val_type;
264 using magni_type =
typename KAT::mag_type;
265 using host_execution_space = Kokkos::DefaultHostExecutionSpace;
266 using host_crsmat_t = KokkosSparse::CrsMatrix<impl_scalar_type, int, host_execution_space, void, int>;
267 using host_graph_t =
typename host_crsmat_t::StaticCrsGraphType;
268 using host_values_t =
typename host_crsmat_t::values_type::non_const_type;
269 using host_row_map_t =
typename host_graph_t::row_map_type::non_const_type;
270 using host_colinds_t =
typename host_graph_t::entries_type::non_const_type;
271 using host_mvector_t = Kokkos::View<impl_scalar_type **, Kokkos::LayoutLeft, host_execution_space>;
272 using host_vector_t = Kokkos::View<impl_scalar_type *, Kokkos::LayoutLeft, host_execution_space>;
273 using host_magni_view = Kokkos::View<magni_type *, Kokkos::LayoutLeft, host_execution_space>;
275 const impl_scalar_type one(1.0);
276 const impl_scalar_type mone = impl_scalar_type(-one);
277 const magni_type eps = KAT::eps ();
280 using MVAdapter = MultiVecAdapter<Vector>;
281 Teuchos::RCP< MVAdapter> X = createMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(x));
282 Teuchos::RCP<const MVAdapter> B = createConstMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(b));
284 auto r_ = B->clone();
285 auto e_ = X->clone();
288 Teuchos::RCP< MVAdapter> R = createMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(r));
289 Teuchos::RCP< MVAdapter> E = createMultiVecAdapter<Vector>(Teuchos::rcpFromPtr(e));
291 const size_t nrhs = X->getGlobalNumVectors();
292 const int nnz = this->matrixA_->getGlobalNNZ();
293 const int nrows = this->matrixA_->getGlobalNumRows();
296 host_crsmat_t crsmat;
297 host_graph_t static_graph;
298 host_row_map_t rowmap_view;
299 host_colinds_t colind_view;
300 host_values_t values_view;
302 Kokkos::resize(rowmap_view, 1+nrows);
303 Kokkos::resize(colind_view, nnz);
304 Kokkos::resize(values_view, nnz);
306 Kokkos::resize(rowmap_view, 1);
307 Kokkos::resize(colind_view, 0);
308 Kokkos::resize(values_view, 0);
312 Util::get_crs_helper_kokkos_view<
313 MatrixAdapter<Matrix>, host_values_t, host_colinds_t, host_row_map_t>::do_get(
314 this->matrixA_.ptr(),
315 values_view, colind_view, rowmap_view,
316 nnz_ret, ROOTED, ARBITRARY, this->rowIndexBase_);
319 static_graph = host_graph_t(colind_view, rowmap_view);
320 crsmat = host_crsmat_t(
"CrsMatrix", nrows, values_view, static_graph);
325 static_cast<const solver_type*
>(
this)->solve_impl(Teuchos::outArg(*X), Teuchos::ptrInArg(*B));
329 const int ldx = (this->root_ ? X->getGlobalLength() : 0);
330 const int ldb = (this->root_ ? B->getGlobalLength() : 0);
331 const int ldr = (this->root_ ? R->getGlobalLength() : 0);
332 const int lde = (this->root_ ? E->getGlobalLength() : 0);
333 const bool initialize_data =
true;
334 const bool not_initialize_data =
true;
335 host_mvector_t X_view;
336 host_mvector_t B_view;
337 host_mvector_t R_view;
338 host_mvector_t E_view;
340 global_size_type rowIndexBase = this->rowIndexBase_;
341 auto Xptr = Teuchos::Ptr< MVAdapter>(X.ptr());
342 auto Bptr = Teuchos::Ptr<const MVAdapter>(B.ptr());
343 auto Rptr = Teuchos::Ptr< MVAdapter>(R.ptr());
344 auto Eptr = Teuchos::Ptr< MVAdapter>(E.ptr());
345 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
346 do_get( initialize_data, Xptr, X_view, ldx, CONTIGUOUS_AND_ROOTED, rowIndexBase);
347 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
348 do_get( initialize_data, Bptr, B_view, ldb, CONTIGUOUS_AND_ROOTED, rowIndexBase);
349 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
350 do_get(not_initialize_data, Rptr, R_view, ldr, CONTIGUOUS_AND_ROOTED, rowIndexBase);
351 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
352 do_get(not_initialize_data, Eptr, E_view, lde, CONTIGUOUS_AND_ROOTED, rowIndexBase);
355 host_magni_view x0norms(
"x0norms", nrhs);
356 host_magni_view bnorms(
"bnorms", nrhs);
357 host_magni_view enorms(
"enorms", nrhs);
360 for (
size_t j = 0; j < nrhs; j++) {
361 auto x_subview = Kokkos::subview(X_view, Kokkos::ALL(), j);
362 host_vector_t x_1d (const_cast<impl_scalar_type*>(x_subview.data()), x_subview.extent(0));
363 x0norms(j) = KokkosBlas::nrm2(x_1d);
366 std::cout << std::endl
367 <<
" SolverCore :: solve_ir (maxNumIters = " << maxNumIters
368 <<
", tol = " << x0norms(0) <<
" * " << eps <<
" = " << x0norms(0)*eps
374 std::cout <<
" bnorm = ";
375 for (
size_t j = 0; j < nrhs; j++) {
376 auto b_subview = Kokkos::subview(B_view, Kokkos::ALL(), j);
377 host_vector_t b_1d (const_cast<impl_scalar_type*>(b_subview.data()), b_subview.extent(0));
378 bnorms(j) = KokkosBlas::nrm2(b_1d);
379 std::cout << bnorms(j) <<
", ";
381 std::cout << std::endl;
390 for (numIters = 0; numIters < maxNumIters && converged == 0; ++numIters) {
393 Kokkos::deep_copy(R_view, B_view);
394 KokkosSparse::spmv(
"N", mone, crsmat, X_view, one, R_view);
399 std::cout <<
" > " << numIters <<
" : norm(r,x,e) = ";
400 for (
size_t j = 0; j < nrhs; j++) {
401 auto r_subview = Kokkos::subview(R_view, Kokkos::ALL(), j);
402 auto x_subview = Kokkos::subview(X_view, Kokkos::ALL(), j);
403 host_vector_t r_1d (const_cast<impl_scalar_type*>(r_subview.data()), r_subview.extent(0));
404 host_vector_t x_1d (const_cast<impl_scalar_type*>(x_subview.data()), x_subview.extent(0));
405 impl_scalar_type rnorm = KokkosBlas::nrm2(r_1d);
406 impl_scalar_type xnorm = KokkosBlas::nrm2(x_1d);
407 std::cout << rnorm <<
" -> " << rnorm/bnorms(j) <<
" " << xnorm <<
" " << enorms(j) <<
", ";
409 std::cout << std::endl;
414 Util::put_1d_data_helper_kokkos_view<MVAdapter, host_mvector_t>::
415 do_put(Rptr, R_view, ldr, CONTIGUOUS_AND_ROOTED, rowIndexBase);
416 static_cast<const solver_type*
>(
this)->solve_impl(Teuchos::outArg(*E), Teuchos::ptrInArg(*R));
417 Util::get_1d_copy_helper_kokkos_view<MVAdapter, host_mvector_t>::
418 do_get(initialize_data, Eptr, E_view, lde, CONTIGUOUS_AND_ROOTED, rowIndexBase);
422 KokkosBlas::axpy(one, E_view, X_view);
424 if (numIters < maxNumIters-1) {
427 for (
size_t j = 0; j < nrhs; j++) {
428 auto e_subview = Kokkos::subview(E_view, Kokkos::ALL(), j);
429 host_vector_t e_1d (const_cast<impl_scalar_type*>(e_subview.data()), e_subview.extent(0));
430 enorms(j) = KokkosBlas::nrm2(e_1d);
431 if (enorms(j) > eps * x0norms(j)) {
435 if (verbose && converged) {
436 std::cout <<
" converged " << std::endl;
442 Teuchos::broadcast(*(this->matrixA_->getComm()), 0, &converged);
445 if (verbose && this->root_) {
447 Kokkos::deep_copy(R_view, B_view);
448 KokkosSparse::spmv(
"N", mone, crsmat, X_view, one, R_view);
450 std::cout <<
" > final residual norm = ";
451 for (
size_t j = 0; j < nrhs; j++) {
452 auto r_subview = Kokkos::subview(R_view, Kokkos::ALL(), j);
453 host_vector_t r_1d (const_cast<impl_scalar_type*>(r_subview.data()), r_subview.extent(0));
454 scalar_type rnorm = KokkosBlas::nrm2(r_1d);
455 std::cout << rnorm <<
" -> " << rnorm/bnorms(j) <<
", ";
457 std::cout << std::endl << std::endl;
461 Util::put_1d_data_helper_kokkos_view<MVAdapter, host_mvector_t>::
462 do_put(Xptr, X_view, ldx, CONTIGUOUS_AND_ROOTED, rowIndexBase);
467 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
471 #ifdef HAVE_AMESOS2_TIMERS
472 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
475 return( static_cast<solver_type*>(
this)->matrixShapeOK_impl() );
481 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
486 matrixA_ = createConstMatrixAdapter(a);
488 #ifdef HAVE_AMESOS2_DEBUG
489 TEUCHOS_TEST_FOR_EXCEPTION( (keep_phase != CLEAN) &&
490 (globalNumRows_ != matrixA_->getGlobalNumRows() ||
491 globalNumCols_ != matrixA_->getGlobalNumCols()),
492 std::invalid_argument,
493 "Dimensions of new matrix be the same as the old matrix if "
494 "keeping any solver phase" );
497 status_.last_phase_ = keep_phase;
500 switch( status_.last_phase_ ){
502 status_.numPreOrder_ = 0;
505 status_.numSymbolicFact_ = 0;
508 status_.numNumericFact_ = 0;
511 status_.numSolve_ = 0;
518 globalNumNonZeros_ = matrixA_->getGlobalNNZ();
519 globalNumCols_ = matrixA_->getGlobalNumCols();
520 globalNumRows_ = matrixA_->getGlobalNumRows();
524 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
527 const Teuchos::RCP<Teuchos::ParameterList> & parameterList )
529 #ifdef HAVE_AMESOS2_TIMERS
530 Teuchos::TimeMonitor LocalTimer1(timers_.totalTime_);
533 if( parameterList->name() ==
"Amesos2" ){
535 Teuchos::RCP<const Teuchos::ParameterList> valid_params = getValidParameters();
536 parameterList->validateParameters(*valid_params);
539 control_.setControlParameters(parameterList);
543 if( parameterList->isSublist(name()) ){
546 control_.setControlParameters(Teuchos::sublist(parameterList, name()));
548 static_cast<solver_type*
>(
this)->setParameters_impl(Teuchos::sublist(parameterList, name()));
556 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
557 Teuchos::RCP<const Teuchos::ParameterList>
560 #ifdef HAVE_AMESOS2_TIMERS
561 Teuchos::TimeMonitor LocalTimer1( timers_.totalTime_ );
564 using Teuchos::ParameterList;
569 RCP<ParameterList> control_params = rcp(
new ParameterList(
"Amesos2"));
570 control_params->set(
"Transpose",
false,
"Whether to solve with the matrix transpose");
571 control_params->set(
"Iterative refinement",
false,
"Whether to solve with iterative refinement");
572 control_params->set(
"Number of iterative refinements", 2,
"Number of iterative refinements");
573 control_params->set(
"Verboes for iterative refinement",
false,
"Verbosity for iterative refinements");
579 RCP<const ParameterList>
580 solver_params =
static_cast<const solver_type*
>(
this)->getValidParameters_impl();
582 Teuchos::rcp_const_cast<ParameterList>(solver_params)->set(
"Transpose",
false,
583 "Whether to solve with the "
586 RCP<ParameterList> amesos2_params = rcp(
new ParameterList(
"Amesos2"));
587 amesos2_params->setParameters(*control_params);
588 amesos2_params->set(name(), *solver_params);
590 return amesos2_params;
594 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
598 std::ostringstream oss;
599 oss << name() <<
" solver interface";
604 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
607 Teuchos::FancyOStream &out,
608 const Teuchos::EVerbosityLevel verbLevel)
const
610 if( matrixA_.is_null() || (rank_ != 0) ){
return; }
613 using Teuchos::VERB_DEFAULT;
614 using Teuchos::VERB_NONE;
615 using Teuchos::VERB_LOW;
616 using Teuchos::VERB_MEDIUM;
617 using Teuchos::VERB_HIGH;
618 using Teuchos::VERB_EXTREME;
619 Teuchos::EVerbosityLevel vl = verbLevel;
620 if (vl == VERB_DEFAULT) vl = VERB_LOW;
621 Teuchos::RCP<const Teuchos::Comm<int> > comm = this->getComm();
623 for(
size_t dec = 10; dec < globalNumRows_; dec *= 10 ) {
626 width = std::max<size_t>(width,size_t(11)) + 2;
627 Teuchos::OSTab tab(out);
635 if( vl != VERB_NONE ) {
636 std::string p = name();
638 out << this->description() << std::endl << std::endl;
640 out << p <<
"Matrix has " << globalNumRows_ <<
" rows"
641 <<
" and " << globalNumNonZeros_ <<
" nonzeros"
643 if( vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME ){
644 out << p <<
"Nonzero elements per row = "
645 << globalNumNonZeros_ / globalNumRows_
647 out << p <<
"Percentage of nonzero elements = "
648 << 100.0 * globalNumNonZeros_ / (globalNumRows_ * globalNumCols_)
651 if( vl == VERB_HIGH || vl == VERB_EXTREME ){
652 out << p <<
"Use transpose = " << control_.useTranspose_
654 out << p <<
"Use iterative refinement = " << control_.useIterRefine_
657 if ( vl == VERB_EXTREME ){
665 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
668 Teuchos::FancyOStream &out,
669 const Teuchos::EVerbosityLevel verbLevel)
const
671 if( matrixA_.is_null() || (rank_ != 0) ){
return; }
673 double preTime = timers_.preOrderTime_.totalElapsedTime();
674 double symTime = timers_.symFactTime_.totalElapsedTime();
675 double numTime = timers_.numFactTime_.totalElapsedTime();
676 double solTime = timers_.solveTime_.totalElapsedTime();
677 double totTime = timers_.totalTime_.totalElapsedTime();
678 double overhead = totTime - (preTime + symTime + numTime + solTime);
680 std::string p = name() +
" : ";
683 if(verbLevel != Teuchos::VERB_NONE)
685 out << p <<
"Time to convert matrix to implementation format = "
686 << timers_.mtxConvTime_.totalElapsedTime() <<
" (s)"
688 out << p <<
"Time to redistribute matrix = "
689 << timers_.mtxRedistTime_.totalElapsedTime() <<
" (s)"
692 out << p <<
"Time to convert vectors to implementation format = "
693 << timers_.vecConvTime_.totalElapsedTime() <<
" (s)"
695 out << p <<
"Time to redistribute vectors = "
696 << timers_.vecRedistTime_.totalElapsedTime() <<
" (s)"
699 out << p <<
"Number of pre-orderings = "
700 << status_.getNumPreOrder()
702 out << p <<
"Time for pre-ordering = "
703 << preTime <<
" (s), avg = "
704 << preTime / status_.getNumPreOrder() <<
" (s)"
707 out << p <<
"Number of symbolic factorizations = "
708 << status_.getNumSymbolicFact()
710 out << p <<
"Time for sym fact = "
711 << symTime <<
" (s), avg = "
712 << symTime / status_.getNumSymbolicFact() <<
" (s)"
715 out << p <<
"Number of numeric factorizations = "
716 << status_.getNumNumericFact()
718 out << p <<
"Time for num fact = "
719 << numTime <<
" (s), avg = "
720 << numTime / status_.getNumNumericFact() <<
" (s)"
723 out << p <<
"Number of solve phases = "
724 << status_.getNumSolve()
726 out << p <<
"Time for solve = "
727 << solTime <<
" (s), avg = "
728 << solTime / status_.getNumSolve() <<
" (s)"
731 out << p <<
"Total time spent in Amesos2 = "
734 out << p <<
"Total time spent in the Amesos2 interface = "
735 << overhead <<
" (s)"
737 out << p <<
" (the above time does not include solver time)"
739 out << p <<
"Amesos2 interface time / total time = "
740 << overhead / totTime
747 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
750 Teuchos::ParameterList& timingParameterList)
const
752 Teuchos::ParameterList temp;
753 timingParameterList = temp.setName(
"NULL");
757 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
761 std::string solverName = solver_type::name;
765 template <
template <
class,
class>
class ConcreteSolver,
class Matrix,
class Vector >
769 matrix_loaded_ =
static_cast<solver_type*
>(
this)->loadA_impl(current_phase);
775 #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:558
void solve() override
Solves (or )
Definition: Amesos2_SolverCore_def.hpp:173
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:105
~SolverCore()
Destructor.
Definition: Amesos2_SolverCore_def.hpp:95
const int size
Definition: klu2_simple.cpp:74
EPhase
Used to indicate a phase in the direct solution.
Definition: Amesos2_TypeDecl.hpp:65
super_type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) override
Set/update internal variables and solver options.
Definition: Amesos2_SolverCore_def.hpp:526
std::string description() const override
Returns a short description of this Solver.
Definition: Amesos2_SolverCore_def.hpp:596
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:483
Utility functions for Amesos2.
super_type & preOrdering() override
Pre-orders the matrix A for minimal fill-in.
Definition: Amesos2_SolverCore_def.hpp:103
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const override
Definition: Amesos2_SolverCore_def.hpp:606
void printTiming(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override
Prints timing information about the current solver.
Definition: Amesos2_SolverCore_def.hpp:667
SolverCore(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
Initialize a Solver instance.
Definition: Amesos2_SolverCore_def.hpp:70
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:469
void printLine(Teuchos::FancyOStream &out)
Prints a line of 70 "-"s on std::cout.
Definition: Amesos2_Util.cpp:119
super_type & symbolicFactorization() override
Performs symbolic factorization on the matrix A.
Definition: Amesos2_SolverCore_def.hpp:123
void loadA(EPhase current_phase)
Refresh this solver's internal data about A.
Definition: Amesos2_SolverCore_def.hpp:767
std::string name() const override
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:759
Interface to Amesos2 solver objects.
Definition: Amesos2_Solver_decl.hpp:78
void getTiming(Teuchos::ParameterList &timingParameterList) const override
Extracts timing information from the current solver.
Definition: Amesos2_SolverCore_def.hpp:749
super_type & numericFactorization() override
Performs numeric factorization on the matrix A.
Definition: Amesos2_SolverCore_def.hpp:148