42 #ifdef SPARSE_SOLVER_PACK_USE_SUPERLU 
   73   std::fill_n( &acsr_row_ptr[0], m+1, 0 );
 
   74   {
for( 
int k = 0; k < 
nz; ++k ) {
 
   75     ++acsr_row_ptr[a_row_i[k]]; 
 
   83   {
for( 
int i = 2; i < m + 1; ++i ) {
 
   84     acsr_row_ptr[i] += acsr_row_ptr[i-1];
 
   86   {
for( 
int i = m; i > 0; --i ) {
 
   87     acsr_row_ptr[i] = acsr_row_ptr[i-1];
 
   91   {
for( 
int k = 0; k < 
nz; ++k ) {
 
   92     const int row_i   = a_row_i[k];            
 
   93     const int row_ptr = acsr_row_ptr[row_i];  
 
   94     acsr_val[row_ptr]   = a_val[k];
 
   95     acsr_col_j[row_ptr] = a_col_j[row_ptr] - 1; 
 
   96     ++acsr_row_ptr[row_i];
 
  104 namespace AbstractLinAlgPack {
 
  130 DirectSparseSolverSuperLU::BasisMatrixSuperLU::create_matrix()
 const 
  145   const FactorizationStructureSuperLU
 
  146     &fs = 
dyn_cast<
const FactorizationStructureSuperLU>(*this->get_fact_struc());
 
  147   const FactorizationNonzerosSuperLU
 
  148     &fn = 
dyn_cast<
const FactorizationNonzerosSuperLU>(*this->get_fact_nonzeros());
 
  150   VectorDenseMutableEncap  yd(*y);
 
  151   VectorDenseEncap         xd(x);
 
  155   fs.superlu_solver_->solve(
 
  170 DirectSparseSolverSuperLU::FactorizationStructureSuperLU::FactorizationStructureSuperLU()
 
  171   :superlu_solver_(SuperLUPack::SuperLUSolver::create_solver())
 
  179 DirectSparseSolverSuperLU::DirectSparseSolverSuperLU()
 
  185 DirectSparseSolverSuperLU::basis_matrix_factory()
 const 
  187   namespace mmp = MemMngPack;
 
  191 void DirectSparseSolverSuperLU::estimated_fillin_ratio(
 
  201 DirectSparseSolverSuperLU::create_fact_struc()
 const 
  207 DirectSparseSolverSuperLU::create_fact_nonzeros()
 const 
  212 void DirectSparseSolverSuperLU::imp_analyze_and_factor(
 
  214   ,FactorizationStructure                         *fact_struc
 
  215   ,FactorizationNonzeros                          *fact_nonzeros
 
  222   namespace mmp = MemMngPack;
 
  224   typedef MatrixConvertToSparse MCTS;
 
  229     *out << 
"\nUsing SuperLU to analyze and factor a new matrix ...\n";
 
  232   FactorizationStructureSuperLU
 
  233     &fs = 
dyn_cast<FactorizationStructureSuperLU>(*fact_struc);
 
  234   FactorizationNonzerosSuperLU
 
  235     &fn = 
dyn_cast<FactorizationNonzerosSuperLU>(*fact_nonzeros);
 
  238   if(!fs.fact_struct_.get())
 
  239     fs.fact_struct_ = SuperLUPack::SuperLUSolver::create_fact_struct();
 
  240   if(!fn.fact_nonzeros_.get())
 
  241     fn.fact_nonzeros_ = SuperLUPack::SuperLUSolver::create_fact_nonzeros();
 
  247     nz = A.
num_nonzeros( MCTS::EXTRACT_FULL_MATRIX ,MCTS::ELEMENTS_ALLOW_DUPLICATES_SUM );
 
  251     n <= 0 || m <= 0 || m > n, std::invalid_argument
 
  252     ,
"DirectSparseSolverSuperLU::imp_analyze_and_factor(...) : Error!" );
 
  255   Workspace<value_type>   a_val(wss,nz);
 
  256   Workspace<index_type>   a_row_i(wss,nz);
 
  257   Workspace<index_type>   a_col_j(wss,nz);
 
  259     MCTS::EXTRACT_FULL_MATRIX
 
  260     ,MCTS::ELEMENTS_ALLOW_DUPLICATES_SUM
 
  274   Workspace<double>   acsr_val(wss,nz);
 
  275   Workspace<int>      acsr_col_j(wss,nz);    
 
  276   Workspace<int>      acsr_row_ptr(wss,m+1);
 
  279     n,m,nz,&a_val[0],&a_row_i[0],&a_col_j[0]
 
  280     ,&acsr_val[0],&acsr_col_j[0],&acsr_row_ptr[0]
 
  290   Workspace<int>    perm_r(wss,m); 
 
  291   Workspace<int>    perm_c(wss,n); 
 
  294   fs.superlu_solver_->analyze_and_factor(
 
  301     ,fs.fact_struct_.get()    
 
  302     ,fn.fact_nonzeros_.get()  
 
  310   for( 
int i = 0; i < m; ++i )
 
  311     (*row_perm)[i] = perm_r[i] + 1; 
 
  313   for( 
int j = 0; j < n; ++j )
 
  314     (*col_perm)[j] = perm_c[j] + 1; 
 
  318   std::sort(&(*row_perm)[0] , &(*row_perm)[0] + (*rank) );
 
  319   std::sort(&(*col_perm)[0] , &(*col_perm)[0] + (*rank) );
 
  321     std::sort(&(*row_perm)[0] + (*rank) , &(*row_perm)[0] + m );
 
  323     std::sort(&(*col_perm)[0] + (*rank) , &(*col_perm)[0] + n );
 
  327 void DirectSparseSolverSuperLU::imp_factor(
 
  329   ,
const FactorizationStructure                   &fact_struc
 
  330   ,FactorizationNonzeros                          *fact_nonzeros
 
  334   namespace mmp = MemMngPack;
 
  336   typedef MatrixConvertToSparse MCTS;
 
  341     *out << 
"\nUsing SuperLU to refactor the basis matrix ...\n";
 
  344   const FactorizationStructureSuperLU
 
  345     &fs = 
dyn_cast<
const FactorizationStructureSuperLU>(fact_struc);
 
  346   FactorizationNonzerosSuperLU
 
  347     &fn = 
dyn_cast<FactorizationNonzerosSuperLU>(*fact_nonzeros);
 
  351     !fs.fact_struct_.get(), std::logic_error
 
  352     ,
"DirectSparseSolverSuperLU::imp_factor(...): Error, the factorization sturcture must " 
  353     "have already been computed!" 
  355   if(!fn.fact_nonzeros_.get())
 
  356     fn.fact_nonzeros_ = SuperLUPack::SuperLUSolver::create_fact_nonzeros();
 
  362     nz = A.
num_nonzeros( MCTS::EXTRACT_FULL_MATRIX ,MCTS::ELEMENTS_ALLOW_DUPLICATES_SUM );
 
  366     n <= 0 || m <= 0 || m > n, std::invalid_argument
 
  367     ,
"DirectSparseSolverSuperLU::imp_factor(...) : Error!" );
 
  370   Workspace<value_type>   a_val(wss,nz);
 
  371   Workspace<index_type>   a_row_i(wss,nz);
 
  372   Workspace<index_type>   a_col_j(wss,nz);
 
  374     MCTS::EXTRACT_FULL_MATRIX
 
  375     ,MCTS::ELEMENTS_ALLOW_DUPLICATES_SUM
 
  389   Workspace<double>   acsr_val(wss,nz);
 
  390   Workspace<int>      acsr_col_j(wss,nz);    
 
  391   Workspace<int>      acsr_row_ptr(wss,m+1);
 
  394     n,m,nz,&a_val[0],&a_row_i[0],&a_col_j[0]
 
  395     ,&acsr_val[0],&acsr_col_j[0],&acsr_row_ptr[0]
 
  405   fs.superlu_solver_->factor(
 
  413     ,fn.fact_nonzeros_.get()  
 
  422 #endif // SPARSE_SOLVER_PACK_USE_SUPERLU 
Teuchos::RCP< const Teuchos::AbstractFactory< BasisMatrix > > basis_matrix_factory_ptr_t
virtual void coor_extract_nonzeros(EExtractRegion extract_region, EElementUniqueness element_uniqueness, const index_type len_Aval, value_type Aval[], const index_type len_Aij, index_type Arow[], index_type Acol[], const index_type row_offset=0, const index_type col_offset=0) const =0
Extract sparse elements in a coordinate data structure. 
RTOp_index_type index_type
Teuchos::Ordinal index_type
Typedef for the index type of elements that are used by the library. 
virtual index_type num_nonzeros(EExtractRegion extract_region, EElementUniqueness element_uniqueness) const =0
Returns the number of nonzeros in the matrix. 
RTOp_value_type value_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual size_type cols() const 
Return the number of columns in the matrix. 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
RTOp_index_type size_type
T_To & dyn_cast(T_From &from)
Mix-in interface for extracing explicit elements from a sparse matrix in one of several Fortran compa...
void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
v_lhs = inv(op(M_rhs1)) * v_rhs2 
FortranTypes::f_dbl_prec value_type
Typedef for the value type of elements that is used for the library. 
virtual size_type rows() const 
Return the number of rows in the matrix. 
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()