|
AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00005 // Copyright (2003) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef DIRECT_SPARSE_SOLVER_DENSE_H 00030 #define DIRECT_SPARSE_SOLVER_DENSE_H 00031 00032 #include <valarray> 00033 #include <vector> 00034 #include <string> 00035 00036 #include "AbstractLinAlgPack_DirectSparseSolverImp.hpp" 00037 #include "DenseLinAlgPack_DMatrixClass.hpp" 00038 #include "DenseLinAlgPack_IVector.hpp" 00039 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00040 00041 namespace AbstractLinAlgPack { 00042 00047 class DirectSparseSolverDense : public DirectSparseSolverImp { 00048 public: 00049 00052 00054 DirectSparseSolverDense(); 00055 00057 00060 00062 const basis_matrix_factory_ptr_t basis_matrix_factory() const; 00064 void estimated_fillin_ratio( value_type estimated_fillin_ratio ); 00065 00067 00068 protected: 00069 00072 00075 class BasisMatrixDense : public BasisMatrixImp { 00076 public: 00077 00080 00082 Teuchos::RCP<BasisMatrixImp> create_matrix() const; 00084 void V_InvMtV( 00085 VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1 00086 ,const Vector& v_rhs2) const ; 00087 00089 00090 }; // end class BasisMatrixDense 00091 00094 class FactorizationStructureDense : public FactorizationStructure { 00095 public: 00096 friend class DirectSparseSolverDense; 00097 friend class BasisMatrixDense; 00098 private: 00099 FortranTypes::f_int m_; // Number of rows in A 00100 FortranTypes::f_int n_; // Number of columns in A 00101 FortranTypes::f_int nz_; // Number of nonzeros in A 00102 FortranTypes::f_int rank_; // Rank of the basis 00103 IVector col_perm_; // First rank entries selects the basis of A 00104 IVector inv_col_perm_; // Inverse of col_perm_ 00105 FactorizationStructureDense(); 00106 }; // end class FactorizationStructureDense 00107 00110 class FactorizationNonzerosDense : public FactorizationNonzeros { 00111 public: 00112 typedef FortranTypes::f_int f_int; 00113 friend class DirectSparseSolverDense; 00114 friend class BasisMatrixDense; 00115 private: 00116 DMatrix LU_; 00117 bool rect_analyze_and_factor_; // true for n > m analyze_and_factor() 00118 std::valarray<f_int> ipiv_; // The permutation sent to xGETRS (identity if rect_analyze_and_factor_==true) 00119 IVector basis_perm_; // Only used if rect_analyze_and_factor_==true 00120 }; // end class FactorizationNonzerosDense 00121 00123 00126 00128 const Teuchos::RCP<FactorizationStructure> create_fact_struc() const; 00130 const Teuchos::RCP<FactorizationNonzeros> create_fact_nonzeros() const; 00132 void imp_analyze_and_factor( 00133 const AbstractLinAlgPack::MatrixConvertToSparse &A 00134 ,FactorizationStructure *fact_struc 00135 ,FactorizationNonzeros *fact_nonzeros 00136 ,DenseLinAlgPack::IVector *row_perm 00137 ,DenseLinAlgPack::IVector *col_perm 00138 ,size_type *rank 00139 ,std::ostream *out 00140 ); 00142 void imp_factor( 00143 const AbstractLinAlgPack::MatrixConvertToSparse &A 00144 ,const FactorizationStructure &fact_struc 00145 ,FactorizationNonzeros *fact_nonzeros 00146 ,std::ostream *out 00147 ); 00148 00150 00151 }; // end class DirectSparseSolverDense 00152 00153 } // end namespace AbstractLinAlgPack 00154 00155 #endif // DIRECT_SPARSE_SOLVER_DENSE_H
1.7.4