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)
74 Teuchos::RCP<Teuchos::ParameterList> default_params
80 template <
class Matrix,
class Vector>
89 template<
class Matrix,
class Vector>
97 template <
class Matrix,
class Vector>
105 template <
class Matrix,
class Vector>
113 solver_.setMatrix( Teuchos::rcpFromRef(
lu_) );
116 #ifdef HAVE_AMESOS2_TIMERS 117 Teuchos::TimeMonitor numFactTimer( this->
timers_.numFactTime_ );
119 factor_ierr =
solver_.factor();
123 Teuchos::broadcast(*(this->
getComm()), 0, &factor_ierr);
124 TEUCHOS_TEST_FOR_EXCEPTION( factor_ierr != 0,
126 "Lapack factor routine returned error code " 132 template <
class Matrix,
class Vector>
140 const global_size_type ld_rhs = this->
root_ ? X->getGlobalLength() : 0;
141 const size_t nrhs = X->getGlobalNumVectors();
143 const size_t val_store_size = as<size_t>(ld_rhs * nrhs);
149 #ifdef HAVE_AMESOS2_TIMERS 150 Teuchos::TimeMonitor mvConvTimer( this->
timers_.vecConvTime_ );
151 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
154 scalar_type> copy_helper;
162 #ifdef HAVE_AMESOS2_TIMERS 163 Teuchos::TimeMonitor solveTimer( this->
timers_.solveTime_ );
166 using Teuchos::rcpFromRef;
167 typedef Teuchos::SerialDenseMatrix<int,scalar_type> DenseMat;
169 DenseMat rhs_dense_mat(Teuchos::View,
rhsvals_.getRawPtr(),
170 as<int>(ld_rhs), as<int>(ld_rhs), as<int>(nrhs));
172 solver_.setVectors( rcpFromRef(rhs_dense_mat),
173 rcpFromRef(rhs_dense_mat) );
181 Teuchos::broadcast(*(this->
getComm()), 0, &solve_ierr);
182 TEUCHOS_TEST_FOR_EXCEPTION( solve_ierr != 0,
184 "Lapack solver solve method returned with error code " 189 #ifdef HAVE_AMESOS2_TIMERS 190 Teuchos::TimeMonitor redistTimer( this->
timers_.vecRedistTime_ );
203 template <
class Matrix,
class Vector>
214 template <
class Matrix,
class Vector>
218 solver_.solveWithTranspose( parameterList->get<
bool>(
"Transpose",
219 this->control_.useTranspose_) );
221 solver_.factorWithEquilibration( parameterList->get<
bool>(
"Equilibrate",
true) );
226 template <
class Matrix,
class Vector>
227 Teuchos::RCP<const Teuchos::ParameterList>
230 using Teuchos::ParameterList;
232 static Teuchos::RCP<const Teuchos::ParameterList> valid_params;
234 if( is_null(valid_params) ){
235 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
237 pl->set(
"Equilibrate",
true,
"Whether to equilibrate the input matrix");
248 template <
class Matrix,
class Vector>
252 #ifdef HAVE_AMESOS2_TIMERS 253 Teuchos::TimeMonitor convTimer(this->
timers_.mtxConvTime_);
257 if( current_phase < NUMFACT )
return(
false );
268 #ifdef HAVE_AMESOS2_TIMERS 269 Teuchos::TimeMonitor mtxRedistTimer( this->
timers_.mtxRedistTime_ );
275 scalar_type, int,
int> ccs_helper;
276 ccs_helper::do_get(this->
matrixA_.ptr(),
287 for( global_size_type col = 0; col < end_col; ++col ){
288 global_ordinal_type ptr =
colptr_[col];
289 global_ordinal_type end_ptr =
colptr_[col+1];
290 for( ; ptr < end_ptr; ++ptr ){
302 template<
class Matrix,
class Vector>
308 #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:141
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:99
global_size_type globalNumCols_
Number of global columns in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:479
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:507
global_size_type globalNumRows_
Number of global rows in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:476
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:243
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition: Amesos2_Lapack_def.hpp:216
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:307
Teuchos::Array< int > rowind_
Stores the column indices of the nonzero entries.
Definition: Amesos2_Lapack_decl.hpp:205
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_Lapack_def.hpp:205
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
A generic helper class for getting a CCS representation of a Matrix.
Definition: Amesos2_Util.hpp:580
Teuchos::Array< scalar_type > nzvals_
Stores the values of the nonzero entries.
Definition: Amesos2_Lapack_decl.hpp:202
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns a pointer to the Teuchos::Comm communicator with this operator.
Definition: Amesos2_SolverCore_decl.hpp:363
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:91
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Lapack_def.hpp:228
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
Lapack solve.
Definition: Amesos2_Lapack_def.hpp:134
global_size_type globalNumNonZeros_
Number of global non-zero values in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:482
super_type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Set/update internal variables and solver options.
Definition: Amesos2_SolverCore_def.hpp:275
Declarations for the Amesos2 interface to LAPACK.
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_Lapack_def.hpp:250
Definition: Amesos2_TypeDecl.hpp:127
Timers timers_
Various timing statistics.
Definition: Amesos2_SolverCore_decl.hpp:498
~Lapack()
Destructor.
Definition: Amesos2_Lapack_def.hpp:81
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:296
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:455
int numericFactorization_impl()
Perform numeric factorization using LAPACK.
Definition: Amesos2_Lapack_def.hpp:107