|
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 MATRIX_SYM_ADD_DEL_UPDATEABLE_H 00030 #define MATRIX_SYM_ADD_DEL_UPDATEABLE_H 00031 00032 #include "AbstractLinAlgPack_Types.hpp" 00033 #include "AbstractLinAlgPack_MatrixBase.hpp" 00034 00035 namespace AbstractLinAlgPack { 00036 00113 class MatrixSymAddDelUpdateable 00114 : public virtual AbstractLinAlgPack::MatrixBase // doxygen needs full name 00115 { 00116 public: 00117 00120 00122 enum EEigenValType { EIGEN_VAL_POS, EIGEN_VAL_NEG, EIGEN_VAL_ZERO, EIGEN_VAL_UNKNOWN }; 00128 struct Inertia { 00129 enum { UNKNOWN = -1 }; 00130 Inertia( 00131 int neg_eigen_vals = UNKNOWN 00132 ,int zero_eigen_vals = UNKNOWN 00133 ,int pos_eigen_vals = UNKNOWN 00134 ) 00135 : neg_eigens(neg_eigen_vals) 00136 ,zero_eigens(zero_eigen_vals) 00137 ,pos_eigens(pos_eigen_vals) 00138 {} 00140 int neg_eigens; 00142 int zero_eigens; 00144 int pos_eigens; 00145 }; 00149 struct PivotTolerances { 00150 enum { UNKNOWN = -1 }; 00151 PivotTolerances() // 2001/03/08: g++ 2.95.2 requries separate 00152 :warning_tol(UNKNOWN) // constructor for use in default argument 00153 ,singular_tol(UNKNOWN) // or you get internalcomplier error later? 00154 ,wrong_inertia_tol(UNKNOWN) 00155 {} 00156 PivotTolerances( 00157 value_type _warning_tol 00158 ,value_type _singular_tol 00159 ,value_type _wrong_inertia_tol 00160 ) 00161 :warning_tol(_warning_tol) 00162 ,singular_tol(_singular_tol) 00163 ,wrong_inertia_tol(_wrong_inertia_tol) 00164 {} 00166 value_type warning_tol; 00168 value_type singular_tol; 00170 value_type wrong_inertia_tol; 00171 }; 00173 class WarnNearSingularUpdateException : public std::logic_error { 00174 public: 00175 WarnNearSingularUpdateException(const std::string& what_arg,value_type _gamma) 00176 : std::logic_error(what_arg), gamma(_gamma) {} 00177 value_type gamma; 00178 }; 00180 class SingularUpdateException : public std::logic_error { 00181 public: 00182 SingularUpdateException(const std::string& what_arg,value_type _gamma) 00183 : std::logic_error(what_arg), gamma(_gamma) {} 00184 value_type gamma; 00185 }; 00187 class WrongInertiaUpdateException : public std::logic_error { 00188 public: 00189 WrongInertiaUpdateException(const std::string& what_arg,value_type _gamma) 00190 : std::logic_error(what_arg), gamma(_gamma) {} 00191 value_type gamma; 00192 }; 00194 class MaxSizeExceededException : public std::logic_error 00195 {public: MaxSizeExceededException(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00196 00198 00201 00203 virtual ~MatrixSymAddDelUpdateable() 00204 {} 00205 00215 virtual void initialize( 00216 value_type alpha 00217 , size_type max_size 00218 ) = 0; 00219 00241 virtual void initialize( 00242 const DMatrixSliceSym &A 00243 ,size_type max_size 00244 ,bool force_factorization 00245 ,Inertia inertia 00246 ,PivotTolerances pivot_tols = PivotTolerances() 00247 ) = 0; 00248 00251 virtual size_type max_size() const = 0; 00252 00258 virtual Inertia inertia() const = 0; 00259 00262 virtual void set_uninitialized() = 0; 00263 00308 virtual void augment_update( 00309 const DVectorSlice *t 00310 ,value_type alpha 00311 ,bool force_refactorization = true 00312 ,EEigenValType add_eigen_val = EIGEN_VAL_UNKNOWN 00313 ,PivotTolerances pivot_tols = PivotTolerances() 00314 ) = 0; 00315 00350 virtual void delete_update( 00351 size_type jd 00352 ,bool force_refactorization = true 00353 ,EEigenValType drop_eigen_val = EIGEN_VAL_UNKNOWN 00354 ,PivotTolerances pivot_tols = PivotTolerances() 00355 ) = 0; 00356 00358 00359 }; // end class MatrixSymAddDelUpdateable 00360 00361 } // namespace AbstractLinAlgPack 00362 00363 #endif // MATRIX_SYM_ADD_DEL_UPDATEABLE_H
1.7.4