AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AbstractLinAlgPack_BasisSystemPermDirectSparse.hpp
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 ABSTRACT_LIN_ALG_PACK_BASIS_PERM_DIRECT_SPARSE_SYSTEM_H
43 #define ABSTRACT_LIN_ALG_PACK_BASIS_PERM_DIRECT_SPARSE_SYSTEM_H
44 
45 #include "AbstractLinAlgPack_DirectSparseSolver.hpp"
46 #include "AbstractLinAlgPack_BasisSystemPerm.hpp"
47 #include "DenseLinAlgPack_IVector.hpp"
48 
49 namespace AbstractLinAlgPack {
50 
60 {
61 public:
62 
65 
68 
70 
73 
76  const direct_solver_ptr_t& direct_solver = Teuchos::null
77  );
78 
80  void initialize(
81  const direct_solver_ptr_t& direct_solver
82  );
83 
85 
88 
90  const mat_nonsing_fcty_ptr_t factory_C() const;
92  const mat_fcty_ptr_t factory_D() const;
94  const mat_fcty_ptr_t factory_GcUP() const;
96  Range1D var_dep() const;
98  Range1D var_indep() const;
100  Range1D equ_decomp() const;
102  Range1D equ_undecomp() const;
104  void update_basis(
105  const MatrixOp &Gc
106  ,MatrixOpNonsing *C
107  ,MatrixOp *D
108  ,MatrixOp *GcUP
109  ,EMatRelations mat_rel
110  ,std::ostream *out
111  ) const;
112 
114 
117 
119  const perm_fcty_ptr_t factory_P_var() const;
121  const perm_fcty_ptr_t factory_P_equ() const;
123  const perm_fcty_ptr_t factory_P_inequ() const;
125  void set_basis(
126  const Permutation &P_var
127  ,const Range1D &var_dep
128  ,const Permutation *P_equ
129  ,const Range1D *equ_decomp
130  ,const MatrixOp &Gc
131  ,MatrixOpNonsing *C
132  ,MatrixOp *D
133  ,MatrixOp *GcUP
134  ,EMatRelations mat_rel
135  ,std::ostream *out
136  );
138  void select_basis(
139  const Vector *nu
140  ,MatrixOp *Gc
141  ,Permutation *P_var
142  ,Range1D *var_dep
143  ,Permutation *P_equ
145  ,MatrixOpNonsing *C
146  ,MatrixOp *D
147  ,MatrixOp *GcUP
148  ,EMatRelations mat_rel
149  ,std::ostream *out
150  );
151 
153 
154 private:
155 
156  // ///////////////////////////////
157  // Private data members
158 
159  direct_solver_ptr_t direct_solver_;
160  size_type n_;
161  size_type m_;
162  size_type r_;
163  size_type Gc_nz_;
164  Range1D init_var_rng_;
165  IVector init_var_inv_perm_; // If init_var_rng is full range then this is ignored
166  Range1D init_equ_rng_;
167  IVector init_equ_inv_perm_; // If init_equ_rng is full range then this is ignored
168  Range1D var_dep_; // used by factor()
169  Range1D var_indep_; // used by factor()
170  Range1D equ_decomp_; // used by factor()
171  Range1D equ_undecomp_; // used by factor()
172 
173  // ///////////////////////////////
174  // Private member functions
175 
178  get_basis_matrix( MatrixOpNonsingAggr &C_aggr ) const;
179 
181  void set_A_mctse(
182  size_type n
183  ,size_type m
184  ,const MatrixPermAggr &Gc_pa
186  ) const;
187 
189  void update_basis_and_auxiliary_matrices(
190  const MatrixOp& Gc
192  ,MatrixOpNonsingAggr *C_aggr
193  ,MatrixOp* D, MatrixOp* GcUP
194  ) const;
195 
197  void do_some_basis_stuff(
198  const MatrixOp& Gc
199  ,const Range1D& var_dep, const Range1D& equ_decomp
201  ,MatrixOpNonsingAggr *C_aggr
202  ,MatrixOp* D, MatrixOp* GcUP
203  );
204 
205 
206 }; // end class BasisSystemPermDirectSparse
207 
208 } // end namespace AbstractLinAlgPack
209 
210 #endif // ABSTRACT_LIN_ALG_PACK_BASIS_PERM_DIRECT_SPARSE_SYSTEM_H
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
BasisSystemPermDirectSparse(const direct_solver_ptr_t &direct_solver=Teuchos::null)
Calls this->initialize()
void initialize(const direct_solver_ptr_t &direct_solver)
Initialize given a direct sparse solver object.
Aggregate matrix class for a matrix and its permuted view.
Base class for all matrices that support basic matrix operations.
Permutatble basis system subclass that uses a direct sparse solver.
Abstract interface to permutation matrices.
void set_basis(const Permutation &P_var, const Range1D &var_dep, const Permutation *P_equ, const Range1D *equ_decomp, const MatrixOp &Gc, MatrixOpNonsing *C, MatrixOp *D, MatrixOp *GcUP, EMatRelations mat_rel, std::ostream *out)
Interface for setting and selecting a basis from the Jacobian from a set of equations.
Abstract base class for all nonsingular polymorphic matrices that can be used to compute matrix-vecto...
void select_basis(const Vector *nu, MatrixOp *Gc, Permutation *P_var, Range1D *var_dep, Permutation *P_equ, Range1D *equ_decomp, MatrixOpNonsing *C, MatrixOp *D, MatrixOp *GcUP, EMatRelations mat_rel, std::ostream *out)
Sparse conversion subclass based on views of a MatrixExtractSparseElements object.
void update_basis(const MatrixOp &Gc, MatrixOpNonsing *C, MatrixOp *D, MatrixOp *GcUP, EMatRelations mat_rel, std::ostream *out) const
Aggregate matrix class pulling together a MatrixOp object and a MatrixNonsing object into a unified m...