MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_MatrixSymAddDelUpdateable.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef MATRIX_SYM_ADD_DEL_UPDATEABLE_H
43 #define MATRIX_SYM_ADD_DEL_UPDATEABLE_H
44 
47 
48 namespace AbstractLinAlgPack {
49 
127  : public virtual AbstractLinAlgPack::MatrixBase // doxygen needs full name
128 {
129 public:
130 
133 
141  struct Inertia {
142  enum { UNKNOWN = -1 };
144  int neg_eigen_vals = UNKNOWN
145  ,int zero_eigen_vals = UNKNOWN
146  ,int pos_eigen_vals = UNKNOWN
147  )
148  : neg_eigens(neg_eigen_vals)
149  ,zero_eigens(zero_eigen_vals)
150  ,pos_eigens(pos_eigen_vals)
151  {}
158  };
163  enum { UNKNOWN = -1 };
164  PivotTolerances() // 2001/03/08: g++ 2.95.2 requries separate
165  :warning_tol(UNKNOWN) // constructor for use in default argument
166  ,singular_tol(UNKNOWN) // or you get internalcomplier error later?
168  {}
170  value_type _warning_tol
171  ,value_type _singular_tol
172  ,value_type _wrong_inertia_tol
173  )
174  :warning_tol(_warning_tol)
175  ,singular_tol(_singular_tol)
176  ,wrong_inertia_tol(_wrong_inertia_tol)
177  {}
184  };
186  class WarnNearSingularUpdateException : public std::logic_error {
187  public:
188  WarnNearSingularUpdateException(const std::string& what_arg,value_type _gamma)
189  : std::logic_error(what_arg), gamma(_gamma) {}
191  };
193  class SingularUpdateException : public std::logic_error {
194  public:
195  SingularUpdateException(const std::string& what_arg,value_type _gamma)
196  : std::logic_error(what_arg), gamma(_gamma) {}
198  };
200  class WrongInertiaUpdateException : public std::logic_error {
201  public:
202  WrongInertiaUpdateException(const std::string& what_arg,value_type _gamma)
203  : std::logic_error(what_arg), gamma(_gamma) {}
205  };
207  class MaxSizeExceededException : public std::logic_error
208  {public: MaxSizeExceededException(const std::string& what_arg) : std::logic_error(what_arg) {}};
209 
211 
214 
217  {}
218 
228  virtual void initialize(
229  value_type alpha
231  ) = 0;
232 
254  virtual void initialize(
255  const DMatrixSliceSym &A
257  ,bool force_factorization
258  ,Inertia inertia
259  ,PivotTolerances pivot_tols = PivotTolerances()
260  ) = 0;
261 
264  virtual size_type max_size() const = 0;
265 
271  virtual Inertia inertia() const = 0;
272 
275  virtual void set_uninitialized() = 0;
276 
321  virtual void augment_update(
322  const DVectorSlice *t
323  ,value_type alpha
324  ,bool force_refactorization = true
325  ,EEigenValType add_eigen_val = EIGEN_VAL_UNKNOWN
326  ,PivotTolerances pivot_tols = PivotTolerances()
327  ) = 0;
328 
363  virtual void delete_update(
364  size_type jd
365  ,bool force_refactorization = true
366  ,EEigenValType drop_eigen_val = EIGEN_VAL_UNKNOWN
367  ,PivotTolerances pivot_tols = PivotTolerances()
368  ) = 0;
369 
371 
372 }; // end class MatrixSymAddDelUpdateable
373 
374 } // namespace AbstractLinAlgPack
375 
376 #endif // MATRIX_SYM_ADD_DEL_UPDATEABLE_H
Base class for all polymorphic matrices.
virtual void delete_update(size_type jd, bool force_refactorization=true, EEigenValType drop_eigen_val=EIGEN_VAL_UNKNOWN, PivotTolerances pivot_tols=PivotTolerances())=0
Update by deleteing a symmetric row and column.
virtual void augment_update(const DVectorSlice *t, value_type alpha, bool force_refactorization=true, EEigenValType add_eigen_val=EIGEN_VAL_UNKNOWN, PivotTolerances pivot_tols=PivotTolerances())=0
Update by adding a symmetric row and column.
PivotTolerances(value_type _warning_tol, value_type _singular_tol, value_type _wrong_inertia_tol)
Mix-in Interface for updating a serial symmetric matrix by adding and deleting rows and columns...
virtual void initialize(value_type alpha, size_type max_size)=0
Initialize to a 1x1 matrix.
virtual Inertia inertia() const =0
Return the inertia of the matrix (if it is known). If any of the members of the inertia is not known ...
virtual void set_uninitialized()=0
Set the matrix to uninitialized.
Struct for pivot tolerances to be used when initializing, and augmenting and deleting rows and column...
Inertia(int neg_eigen_vals=UNKNOWN, int zero_eigen_vals=UNKNOWN, int pos_eigen_vals=UNKNOWN)
virtual size_type max_size() const =0
Return the maximum size the matrix is allowed to become.