53 #ifndef AMESOS2_LAPACK_DEF_HPP 54 #define AMESOS2_LAPACK_DEF_HPP 56 #include <Teuchos_RCP.hpp> 64 template <
class Matrix,
class Vector>
66 Teuchos::RCP<Vector> X,
67 Teuchos::RCP<const Vector> B)
72 , is_contiguous_(true)
75 Teuchos::RCP<Teuchos::ParameterList> default_params
81 template <
class Matrix,
class Vector>
90 template<
class Matrix,
class Vector>
98 template <
class Matrix,
class Vector>
106 template <
class Matrix,
class Vector>
114 solver_.setMatrix( Teuchos::rcpFromRef(
lu_) );
117 #ifdef HAVE_AMESOS2_TIMERS 118 Teuchos::TimeMonitor numFactTimer( this->
timers_.numFactTime_ );
120 factor_ierr =
solver_.factor();
124 Teuchos::broadcast(*(this->
getComm()), 0, &factor_ierr);
125 TEUCHOS_TEST_FOR_EXCEPTION( factor_ierr != 0,
127 "Lapack factor routine returned error code " 133 template <
class Matrix,
class Vector>
141 const global_size_type ld_rhs = this->
root_ ? X->getGlobalLength() : 0;
142 const size_t nrhs = X->getGlobalNumVectors();
144 const size_t val_store_size = as<size_t>(ld_rhs * nrhs);
150 #ifdef HAVE_AMESOS2_TIMERS 151 Teuchos::TimeMonitor mvConvTimer( this->
timers_.vecConvTime_ );
152 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
155 scalar_type> copy_helper;
156 if ( is_contiguous_ ==
true ) {
157 copy_helper::do_get(B,
rhsvals_(), as<size_t>(ld_rhs),
ROOTED, 0);
168 #ifdef HAVE_AMESOS2_TIMERS 169 Teuchos::TimeMonitor solveTimer( this->
timers_.solveTime_ );
172 using Teuchos::rcpFromRef;
173 typedef Teuchos::SerialDenseMatrix<int,scalar_type> DenseMat;
175 DenseMat rhs_dense_mat(Teuchos::View,
rhsvals_.getRawPtr(),
176 as<int>(ld_rhs), as<int>(ld_rhs), as<int>(nrhs));
178 solver_.setVectors( rcpFromRef(rhs_dense_mat),
179 rcpFromRef(rhs_dense_mat) );
187 Teuchos::broadcast(*(this->
getComm()), 0, &solve_ierr);
188 TEUCHOS_TEST_FOR_EXCEPTION( solve_ierr != 0,
190 "Lapack solver solve method returned with error code " 195 #ifdef HAVE_AMESOS2_TIMERS 196 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
199 if ( is_contiguous_ ==
true ) {
217 template <
class Matrix,
class Vector>
228 template <
class Matrix,
class Vector>
232 solver_.solveWithTranspose( parameterList->get<
bool>(
"Transpose",
233 this->control_.useTranspose_) );
235 solver_.factorWithEquilibration( parameterList->get<
bool>(
"Equilibrate",
true) );
237 if( parameterList->isParameter(
"IsContiguous") ){
238 is_contiguous_ = parameterList->get<
bool>(
"IsContiguous");
244 template <
class Matrix,
class Vector>
245 Teuchos::RCP<const Teuchos::ParameterList>
248 using Teuchos::ParameterList;
250 static Teuchos::RCP<const Teuchos::ParameterList> valid_params;
252 if( is_null(valid_params) ){
253 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
255 pl->set(
"Equilibrate",
true,
"Whether to equilibrate the input matrix");
257 pl->set(
"IsContiguous",
true,
"Whether GIDs contiguous");
268 template <
class Matrix,
class Vector>
272 #ifdef HAVE_AMESOS2_TIMERS 273 Teuchos::TimeMonitor convTimer(this->
timers_.mtxConvTime_);
277 if( current_phase < NUMFACT )
return(
false );
288 #ifdef HAVE_AMESOS2_TIMERS 289 Teuchos::TimeMonitor mtxRedistTimer( this->
timers_.mtxRedistTime_ );
295 scalar_type, int,
int> ccs_helper;
296 if ( is_contiguous_ ==
true ) {
297 ccs_helper::do_get(this->
matrixA_.ptr(),
302 ccs_helper::do_get(this->
matrixA_.ptr(),
314 for( global_size_type col = 0; col < end_col; ++col ){
315 global_ordinal_type ptr =
colptr_[col];
316 global_ordinal_type end_ptr =
colptr_[col+1];
317 for( ; ptr < end_ptr; ++ptr ){
329 template<
class Matrix,
class Vector>
335 #endif // AMESOS2_LAPACK_DEF_HPP Teuchos::Array< int > colptr_
Stores the location in Ai_ and Aval_ that starts col j.
Definition: Amesos2_Lapack_decl.hpp:208
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:105
Amesos2 interface to the LAPACK.
Definition: Amesos2_Lapack_decl.hpp:80
Definition: Amesos2_TypeDecl.hpp:142
EPhase
Used to indicate a phase in the direct solution.
Definition: Amesos2_TypeDecl.hpp:65
int symbolicFactorization_impl()
No-op.
Definition: Amesos2_Lapack_def.hpp:100
global_size_type globalNumCols_
Number of global columns in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:478
Teuchos::SerialDenseMatrix< int, scalar_type > lu_
L and U storage.
Definition: Amesos2_Lapack_decl.hpp:214
bool root_
If true, then this is the root processor.
Definition: Amesos2_SolverCore_decl.hpp:506
global_size_type globalNumRows_
Number of global rows in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:475
Teuchos::SerialDenseSolver< int, scalar_type > solver_
The serial solver.
Definition: Amesos2_Lapack_decl.hpp:218
Helper class for getting 1-D copies of multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:266
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_Lapack_def.hpp:219
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition: Amesos2_Lapack_def.hpp:230
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return a const parameter list of all of the valid parameters that this->setParameterList(...) will accept.
Definition: Amesos2_SolverCore_def.hpp:310
Teuchos::Array< int > rowind_
Stores the column indices of the nonzero entries.
Definition: Amesos2_Lapack_decl.hpp:205
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns a pointer to the Teuchos::Comm communicator with this operator.
Definition: Amesos2_SolverCore_decl.hpp:362
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
A generic helper class for getting a CCS representation of a Matrix.
Definition: Amesos2_Util.hpp:626
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
Lapack solve.
Definition: Amesos2_Lapack_def.hpp:135
Teuchos::Array< scalar_type > nzvals_
Stores the values of the nonzero entries.
Definition: Amesos2_Lapack_decl.hpp:202
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Lapack_def.hpp:246
Lapack(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
Initialize from Teuchos::RCP.
Definition: Amesos2_Lapack_def.hpp:65
int preOrdering_impl()
No-op.
Definition: Amesos2_Lapack_def.hpp:92
global_size_type globalNumNonZeros_
Number of global non-zero values in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:481
super_type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Set/update internal variables and solver options.
Definition: Amesos2_SolverCore_def.hpp:278
Declarations for the Amesos2 interface to LAPACK.
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_Lapack_def.hpp:270
Definition: Amesos2_TypeDecl.hpp:127
Timers timers_
Various timing statistics.
Definition: Amesos2_SolverCore_decl.hpp:497
~Lapack()
Destructor.
Definition: Amesos2_Lapack_def.hpp:82
Teuchos::Array< scalar_type > rhsvals_
Store for RHS and Solution values.
Definition: Amesos2_Lapack_decl.hpp:210
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:322
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:176
Teuchos::RCP< const MatrixAdapter< Matrix > > matrixA_
The LHS operator.
Definition: Amesos2_SolverCore_decl.hpp:454
Definition: Amesos2_TypeDecl.hpp:128
int numericFactorization_impl()
Perform numeric factorization using LAPACK.
Definition: Amesos2_Lapack_def.hpp:108