19#ifndef AMESOS2_LAPACK_DEF_HPP
20#define AMESOS2_LAPACK_DEF_HPP
22#include <Teuchos_RCP.hpp>
30 template <
class Matrix,
class Vector>
32 Teuchos::RCP<Vector> X,
33 Teuchos::RCP<const Vector> B)
35 , is_contiguous_(true)
38 Teuchos::RCP<Teuchos::ParameterList> default_params
44 template <
class Matrix,
class Vector>
53 template<
class Matrix,
class Vector>
61 template <
class Matrix,
class Vector>
69 template <
class Matrix,
class Vector>
80#ifdef HAVE_AMESOS2_TIMERS
81 Teuchos::TimeMonitor numFactTimer( this->
timers_.numFactTime_ );
87 Teuchos::broadcast(*(this->
getComm()), 0, &factor_ierr);
88 TEUCHOS_TEST_FOR_EXCEPTION( factor_ierr != 0,
90 "Lapack factor routine returned error code "
96 template <
class Matrix,
class Vector>
104 const global_size_type ld_rhs = this->
root_ ? X->getGlobalLength() : 0;
105 const size_t nrhs = X->getGlobalNumVectors();
107 const size_t val_store_size = as<size_t>(ld_rhs * nrhs);
113#ifdef HAVE_AMESOS2_TIMERS
114 Teuchos::TimeMonitor mvConvTimer( this->
timers_.vecConvTime_ );
115 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
118 scalar_type> copy_helper;
129#ifdef HAVE_AMESOS2_TIMERS
130 Teuchos::TimeMonitor solveTimer( this->
timers_.solveTime_ );
133 using Teuchos::rcpFromRef;
134 typedef Teuchos::SerialDenseMatrix<int,scalar_type> DenseMat;
136 DenseMat rhs_dense_mat(Teuchos::View,
rhsvals_.getRawPtr(),
137 as<int>(ld_rhs), as<int>(ld_rhs), as<int>(nrhs));
139 solver_.setVectors( rcpFromRef(rhs_dense_mat),
140 rcpFromRef(rhs_dense_mat) );
148 Teuchos::broadcast(*(this->
getComm()), 0, &solve_ierr);
149 TEUCHOS_TEST_FOR_EXCEPTION( solve_ierr != 0,
151 "Lapack solver solve method returned with error code "
156#ifdef HAVE_AMESOS2_TIMERS
157 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
170 template <
class Matrix,
class Vector>
181 template <
class Matrix,
class Vector>
185 solver_.solveWithTranspose( parameterList->get<
bool>(
"Transpose",
186 this->control_.useTranspose_) );
188 solver_.factorWithEquilibration( parameterList->get<
bool>(
"Equilibrate",
true) );
190 if( parameterList->isParameter(
"IsContiguous") ){
191 is_contiguous_ = parameterList->get<
bool>(
"IsContiguous");
197 template <
class Matrix,
class Vector>
198 Teuchos::RCP<const Teuchos::ParameterList>
201 using Teuchos::ParameterList;
203 static Teuchos::RCP<const Teuchos::ParameterList> valid_params;
205 if( is_null(valid_params) ){
206 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
208 pl->set(
"Equilibrate",
true,
"Whether to equilibrate the input matrix");
210 pl->set(
"IsContiguous",
true,
"Whether GIDs contiguous");
221 template <
class Matrix,
class Vector>
225#ifdef HAVE_AMESOS2_TIMERS
226 Teuchos::TimeMonitor convTimer(this->
timers_.mtxConvTime_);
230 if( current_phase < NUMFACT )
return(
false );
241#ifdef HAVE_AMESOS2_TIMERS
242 Teuchos::TimeMonitor mtxRedistTimer( this->
timers_.mtxRedistTime_ );
248 host_value_type_array, host_ordinal_type_array, host_ordinal_type_array> ccs_helper;
250 ccs_helper::do_get(this->
matrixA_.ptr(),
254 this->rowIndexBase_);
263 for( global_size_type col = 0; col < end_col; ++col ){
266 for( ; ptr < end_ptr; ++ptr ){
278 template<
class Matrix,
class Vector>
Declarations for the Amesos2 interface to LAPACK.
@ ROOTED
Definition Amesos2_TypeDecl.hpp:93
@ CONTIGUOUS_AND_ROOTED
Definition Amesos2_TypeDecl.hpp:94
@ ARBITRARY
Definition Amesos2_TypeDecl.hpp:109
Teuchos::SerialDenseMatrix< int, scalar_type > lu_
L and U storage.
Definition Amesos2_Lapack_decl.hpp:194
~Lapack()
Destructor.
Definition Amesos2_Lapack_def.hpp:45
static const char * name
The name of this solver interface.
Definition Amesos2_Lapack_decl.hpp:54
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition Amesos2_Lapack_def.hpp:183
host_size_type_array colptr_view_
Stores the row indices of the nonzero entries.
Definition Amesos2_Lapack_decl.hpp:190
Teuchos::SerialDenseSolver< int, scalar_type > solver_
The serial solver.
Definition Amesos2_Lapack_decl.hpp:198
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition Amesos2_Lapack_def.hpp:172
int numericFactorization_impl()
Perform numeric factorization using LAPACK.
Definition Amesos2_Lapack_def.hpp:71
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition Amesos2_Lapack_def.hpp:199
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition Amesos2_Lapack_def.hpp:223
host_value_type_array nzvals_view_
Stores the values of the nonzero entries for Umfpack.
Definition Amesos2_Lapack_decl.hpp:186
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
Lapack solve.
Definition Amesos2_Lapack_def.hpp:98
int preOrdering_impl()
No-op.
Definition Amesos2_Lapack_def.hpp:55
host_ordinal_type_array rowind_view_
Stores the location in Ai_ and Aval_ that starts row j.
Definition Amesos2_Lapack_decl.hpp:188
int symbolicFactorization_impl()
No-op.
Definition Amesos2_Lapack_def.hpp:63
Lapack(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
Initialize from Teuchos::RCP.
Definition Amesos2_Lapack_def.hpp:31
Teuchos::Array< scalar_type > rhsvals_
Store for RHS and Solution values.
Definition Amesos2_Lapack_decl.hpp:182
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
super_type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) override
Teuchos::RCP< const MatrixAdapter< Matrix > > matrixA_
Definition Amesos2_SolverCore_decl.hpp:421
bool root_
Definition Amesos2_SolverCore_decl.hpp:472
SolverCore(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
global_size_type globalNumCols_
Definition Amesos2_SolverCore_decl.hpp:445
Timers timers_
Definition Amesos2_SolverCore_decl.hpp:463
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const override
Definition Amesos2_SolverCore_decl.hpp:329
global_size_type globalNumNonZeros_
Definition Amesos2_SolverCore_decl.hpp:448
global_size_type globalNumRows_
Definition Amesos2_SolverCore_decl.hpp:442
EPhase
Used to indicate a phase in the direct solution.
Definition Amesos2_TypeDecl.hpp:31
A templated MultiVector class adapter for Amesos2.
Definition Amesos2_MultiVecAdapter_decl.hpp:142
Helper class for getting 1-D copies of multivectors.
Definition Amesos2_MultiVecAdapter_decl.hpp:233
A generic helper class for getting a CCS representation of a Matrix.
Definition Amesos2_Util.hpp:615
Helper class for putting 1-D data arrays into multivectors.
Definition Amesos2_MultiVecAdapter_decl.hpp:339