|
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 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 // @HEADER 00041 00042 #ifndef DIRECT_SPARSE_SOLVER_DENSE_H 00043 #define DIRECT_SPARSE_SOLVER_DENSE_H 00044 00045 #include <valarray> 00046 #include <vector> 00047 #include <string> 00048 00049 #include "AbstractLinAlgPack_DirectSparseSolverImp.hpp" 00050 #include "DenseLinAlgPack_DMatrixClass.hpp" 00051 #include "DenseLinAlgPack_IVector.hpp" 00052 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00053 00054 namespace AbstractLinAlgPack { 00055 00060 class DirectSparseSolverDense : public DirectSparseSolverImp { 00061 public: 00062 00065 00067 DirectSparseSolverDense(); 00068 00070 00073 00075 const basis_matrix_factory_ptr_t basis_matrix_factory() const; 00077 void estimated_fillin_ratio( value_type estimated_fillin_ratio ); 00078 00080 00081 protected: 00082 00085 00088 class BasisMatrixDense : public BasisMatrixImp { 00089 public: 00090 00093 00095 Teuchos::RCP<BasisMatrixImp> create_matrix() const; 00097 void V_InvMtV( 00098 VectorMutable* v_lhs, BLAS_Cpp::Transp trans_rhs1 00099 ,const Vector& v_rhs2) const ; 00100 00102 00103 }; // end class BasisMatrixDense 00104 00107 class FactorizationStructureDense : public FactorizationStructure { 00108 public: 00109 friend class DirectSparseSolverDense; 00110 friend class BasisMatrixDense; 00111 private: 00112 FortranTypes::f_int m_; // Number of rows in A 00113 FortranTypes::f_int n_; // Number of columns in A 00114 FortranTypes::f_int nz_; // Number of nonzeros in A 00115 FortranTypes::f_int rank_; // Rank of the basis 00116 IVector col_perm_; // First rank entries selects the basis of A 00117 IVector inv_col_perm_; // Inverse of col_perm_ 00118 FactorizationStructureDense(); 00119 }; // end class FactorizationStructureDense 00120 00123 class FactorizationNonzerosDense : public FactorizationNonzeros { 00124 public: 00125 typedef FortranTypes::f_int f_int; 00126 friend class DirectSparseSolverDense; 00127 friend class BasisMatrixDense; 00128 private: 00129 DMatrix LU_; 00130 bool rect_analyze_and_factor_; // true for n > m analyze_and_factor() 00131 std::valarray<f_int> ipiv_; // The permutation sent to xGETRS (identity if rect_analyze_and_factor_==true) 00132 IVector basis_perm_; // Only used if rect_analyze_and_factor_==true 00133 }; // end class FactorizationNonzerosDense 00134 00136 00139 00141 const Teuchos::RCP<FactorizationStructure> create_fact_struc() const; 00143 const Teuchos::RCP<FactorizationNonzeros> create_fact_nonzeros() const; 00145 void imp_analyze_and_factor( 00146 const AbstractLinAlgPack::MatrixConvertToSparse &A 00147 ,FactorizationStructure *fact_struc 00148 ,FactorizationNonzeros *fact_nonzeros 00149 ,DenseLinAlgPack::IVector *row_perm 00150 ,DenseLinAlgPack::IVector *col_perm 00151 ,size_type *rank 00152 ,std::ostream *out 00153 ); 00155 void imp_factor( 00156 const AbstractLinAlgPack::MatrixConvertToSparse &A 00157 ,const FactorizationStructure &fact_struc 00158 ,FactorizationNonzeros *fact_nonzeros 00159 ,std::ostream *out 00160 ); 00161 00163 00164 }; // end class DirectSparseSolverDense 00165 00166 } // end namespace AbstractLinAlgPack 00167 00168 #endif // DIRECT_SPARSE_SOLVER_DENSE_H
1.7.6.1