MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConstrainedOptPack_MatrixVarReductImplicit.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_VAR_REDUCT_IMPLICIT_H
43 #define MATRIX_VAR_REDUCT_IMPLICIT_H
44 
45 #include <vector>
46 #include <list>
47 
51 
52 namespace ConstrainedOptPack {
53 
93 {
94 public:
95 
98 
103 
105 
108 
144  virtual void initialize(
145  const mat_nonsing_ptr_t &C
146  ,const mat_ptr_t &N
147  ,const mat_ptr_t &D_direct
148  );
157  virtual void set_uninitialized();
158 
160 
163 
169  const mat_nonsing_ptr_t& C_ptr() const;
170 
176  const mat_ptr_t& N_ptr() const;
177 
183  const mat_ptr_t& D_direct_ptr() const;
184 
186 
190  size_type rows() const;
192  size_type cols() const;
194 
197 
199  const VectorSpace& space_cols() const;
201  const VectorSpace& space_rows() const;
203  MatrixOp& operator=(const MatrixOp& M);
205  std::ostream& output(std::ostream&) const;
207  void Vp_StMtV(
208  VectorMutable* v_lhs, value_type alpha
209  ,BLAS_Cpp::Transp trans_rhs1
210  ,const Vector& v_rhs2, value_type beta
211  ) const;
213  void Vp_StMtV(
214  VectorMutable* v_lhs, value_type alpha
215  ,BLAS_Cpp::Transp trans_rhs1
216  ,const SpVectorSlice& sv_rhs2, value_type beta
217  ) const;
219  void Vp_StPtMtV(
220  VectorMutable* v_lhs, value_type alpha
221  ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
222  ,BLAS_Cpp::Transp M_rhs2_trans
223  ,const Vector& v_rhs3, value_type beta
224  ) const;
226  void Vp_StPtMtV(
227  VectorMutable* v_lhs, value_type alpha
228  ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
229  ,BLAS_Cpp::Transp M_rhs2_trans
230  ,const SpVectorSlice& sv_rhs3, value_type beta
231  ) const;
232 
234 
235 private:
236 
237  // //////////////////////////
238  // Private types
239 
240  typedef std::vector<VectorSpace::vec_mut_ptr_t> InvCtN_rows_t;
241  typedef std::list<index_type> InvCtN_rows_set_list_t;
242 
243  // //////////////////////////
244  // Private data members
245 
246 #ifdef DOXYGEN_COMPILE
250 #else
252  mat_ptr_t N_;
253  mat_ptr_t D_direct_;
254 
255  mutable InvCtN_rows_t InvCtN_rows_;
256  // InvCtN_rows_ keeps track of a set pointers of computed rows of inv(C)*N.
257  // If D_direct_ is setup then InvCtN_rows_ is not necessary. However, if
258  // not, then InvCtN_rows_[j-1] will be !=NULL if it points to the precomputed
259  // jth row of inv(C)*N and will be ==NULL if this row has not been computed
260  // yet. Each time initialize(...) is called, these rows are deallocated and
261  // InvCtN_rows_[j-1], j=1...this->rows() is set to NULL.
262 
263  mutable InvCtN_rows_set_list_t InvCtN_rows_set_list_;
264  // InvCtN_rows_set_list_ keeps a unorderd=ed list of the row indexes that are
265  // currently updated. Keeping this list allows the vectors allocated in
266  // InvCtN_rows_[] to be deallocated much faster than if the whole array
267  // had to be searched everytime that this->initialize() was called again.
268 
269 #endif
270 
271  // //////////////////////////////////
272  // Private member functions
273 
275  void assert_initialized() const;
276 
277 }; // end class MatrixVarReductImplicit
278 
279 // ////////////////////////////////
280 // Inline members
281 
282 inline
285 {
286  return C_;
287 }
288 
289 inline
292 {
293  return N_;
294 }
295 
296 inline
299 {
300  return D_direct_;
301 }
302 
303 } // end namespace ConstrainedOptPack
304 
305 #endif // MATRIX_VAR_REDUCT_IMPLICIT_H
AbstractLinAlgPack::size_type size_type
const mat_nonsing_ptr_t & C_ptr() const
Return the smart pointer to the aggregate basis matrix object C.
virtual void initialize(const mat_nonsing_ptr_t &C, const mat_ptr_t &N, const mat_ptr_t &D_direct)
Initialize this matrix object.
void Vp_StPtMtV(VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta) const
const mat_ptr_t & D_direct_ptr() const
Return the smart pointer to the aggregate precomputed matrix object D_direct (if set).
const mat_ptr_t & N_ptr() const
Return the smart pointer to the aggregate nonbasis matrix object N.
const LAPACK_C_Decl::f_int & M
Base class for all matrices that support basic matrix operations.
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const
Implements D = - inv(C) * N for a variable reduction projection.
AbstractLinAlgPack::value_type value_type
Abstract base class for all nonsingular polymorphic matrices that can be used to compute matrix-vecto...
Transp
TRANS.
virtual void set_uninitialized()
Set the matrix to uninitialized.