|
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 MATRIX_SYM_ADD_DEL_UPDATEABLE_H 00043 #define MATRIX_SYM_ADD_DEL_UPDATEABLE_H 00044 00045 #include "AbstractLinAlgPack_Types.hpp" 00046 #include "AbstractLinAlgPack_MatrixBase.hpp" 00047 00048 namespace AbstractLinAlgPack { 00049 00126 class MatrixSymAddDelUpdateable 00127 : public virtual AbstractLinAlgPack::MatrixBase // doxygen needs full name 00128 { 00129 public: 00130 00133 00135 enum EEigenValType { EIGEN_VAL_POS, EIGEN_VAL_NEG, EIGEN_VAL_ZERO, EIGEN_VAL_UNKNOWN }; 00141 struct Inertia { 00142 enum { UNKNOWN = -1 }; 00143 Inertia( 00144 int neg_eigen_vals = UNKNOWN 00145 ,int zero_eigen_vals = UNKNOWN 00146 ,int pos_eigen_vals = UNKNOWN 00147 ) 00148 : neg_eigens(neg_eigen_vals) 00149 ,zero_eigens(zero_eigen_vals) 00150 ,pos_eigens(pos_eigen_vals) 00151 {} 00153 int neg_eigens; 00155 int zero_eigens; 00157 int pos_eigens; 00158 }; 00162 struct PivotTolerances { 00163 enum { UNKNOWN = -1 }; 00164 PivotTolerances() // 2001/03/08: g++ 2.95.2 requries separate 00165 :warning_tol(UNKNOWN) // constructor for use in default argument 00166 ,singular_tol(UNKNOWN) // or you get internalcomplier error later? 00167 ,wrong_inertia_tol(UNKNOWN) 00168 {} 00169 PivotTolerances( 00170 value_type _warning_tol 00171 ,value_type _singular_tol 00172 ,value_type _wrong_inertia_tol 00173 ) 00174 :warning_tol(_warning_tol) 00175 ,singular_tol(_singular_tol) 00176 ,wrong_inertia_tol(_wrong_inertia_tol) 00177 {} 00179 value_type warning_tol; 00181 value_type singular_tol; 00183 value_type wrong_inertia_tol; 00184 }; 00186 class WarnNearSingularUpdateException : public std::logic_error { 00187 public: 00188 WarnNearSingularUpdateException(const std::string& what_arg,value_type _gamma) 00189 : std::logic_error(what_arg), gamma(_gamma) {} 00190 value_type gamma; 00191 }; 00193 class SingularUpdateException : public std::logic_error { 00194 public: 00195 SingularUpdateException(const std::string& what_arg,value_type _gamma) 00196 : std::logic_error(what_arg), gamma(_gamma) {} 00197 value_type gamma; 00198 }; 00200 class WrongInertiaUpdateException : public std::logic_error { 00201 public: 00202 WrongInertiaUpdateException(const std::string& what_arg,value_type _gamma) 00203 : std::logic_error(what_arg), gamma(_gamma) {} 00204 value_type gamma; 00205 }; 00207 class MaxSizeExceededException : public std::logic_error 00208 {public: MaxSizeExceededException(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00209 00211 00214 00216 virtual ~MatrixSymAddDelUpdateable() 00217 {} 00218 00228 virtual void initialize( 00229 value_type alpha 00230 , size_type max_size 00231 ) = 0; 00232 00254 virtual void initialize( 00255 const DMatrixSliceSym &A 00256 ,size_type max_size 00257 ,bool force_factorization 00258 ,Inertia inertia 00259 ,PivotTolerances pivot_tols = PivotTolerances() 00260 ) = 0; 00261 00264 virtual size_type max_size() const = 0; 00265 00271 virtual Inertia inertia() const = 0; 00272 00275 virtual void set_uninitialized() = 0; 00276 00321 virtual void augment_update( 00322 const DVectorSlice *t 00323 ,value_type alpha 00324 ,bool force_refactorization = true 00325 ,EEigenValType add_eigen_val = EIGEN_VAL_UNKNOWN 00326 ,PivotTolerances pivot_tols = PivotTolerances() 00327 ) = 0; 00328 00363 virtual void delete_update( 00364 size_type jd 00365 ,bool force_refactorization = true 00366 ,EEigenValType drop_eigen_val = EIGEN_VAL_UNKNOWN 00367 ,PivotTolerances pivot_tols = PivotTolerances() 00368 ) = 0; 00369 00371 00372 }; // end class MatrixSymAddDelUpdateable 00373 00374 } // namespace AbstractLinAlgPack 00375 00376 #endif // MATRIX_SYM_ADD_DEL_UPDATEABLE_H
1.7.6.1