|
ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization 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_VAR_REDUCT_IMPLICIT_H 00030 #define MATRIX_VAR_REDUCT_IMPLICIT_H 00031 00032 #include <vector> 00033 #include <list> 00034 00035 #include "ConstrainedOptPack_Types.hpp" 00036 #include "AbstractLinAlgPack_MatrixOp.hpp" 00037 #include "AbstractLinAlgPack_VectorSpace.hpp" 00038 00039 namespace ConstrainedOptPack { 00040 00078 class MatrixVarReductImplicit 00079 : public AbstractLinAlgPack::MatrixOp 00080 { 00081 public: 00082 00085 00087 typedef Teuchos::RCP<const MatrixOpNonsing> mat_nonsing_ptr_t; 00089 typedef Teuchos::RCP<const MatrixOp> mat_ptr_t; 00090 00092 00095 00131 virtual void initialize( 00132 const mat_nonsing_ptr_t &C 00133 ,const mat_ptr_t &N 00134 ,const mat_ptr_t &D_direct 00135 ); 00144 virtual void set_uninitialized(); 00145 00147 00150 00156 const mat_nonsing_ptr_t& C_ptr() const; 00157 00163 const mat_ptr_t& N_ptr() const; 00164 00170 const mat_ptr_t& D_direct_ptr() const; 00171 00173 00177 size_type rows() const; 00179 size_type cols() const; 00181 00184 00186 const VectorSpace& space_cols() const; 00188 const VectorSpace& space_rows() const; 00190 MatrixOp& operator=(const MatrixOp& M); 00192 std::ostream& output(std::ostream&) const; 00194 void Vp_StMtV( 00195 VectorMutable* v_lhs, value_type alpha 00196 ,BLAS_Cpp::Transp trans_rhs1 00197 ,const Vector& v_rhs2, value_type beta 00198 ) const; 00200 void Vp_StMtV( 00201 VectorMutable* v_lhs, value_type alpha 00202 ,BLAS_Cpp::Transp trans_rhs1 00203 ,const SpVectorSlice& sv_rhs2, value_type beta 00204 ) const; 00206 void Vp_StPtMtV( 00207 VectorMutable* v_lhs, value_type alpha 00208 ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00209 ,BLAS_Cpp::Transp M_rhs2_trans 00210 ,const Vector& v_rhs3, value_type beta 00211 ) const; 00213 void Vp_StPtMtV( 00214 VectorMutable* v_lhs, value_type alpha 00215 ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00216 ,BLAS_Cpp::Transp M_rhs2_trans 00217 ,const SpVectorSlice& sv_rhs3, value_type beta 00218 ) const; 00219 00221 00222 private: 00223 00224 // ////////////////////////// 00225 // Private types 00226 00227 typedef std::vector<VectorSpace::vec_mut_ptr_t> InvCtN_rows_t; 00228 typedef std::list<index_type> InvCtN_rows_set_list_t; 00229 00230 // ////////////////////////// 00231 // Private data members 00232 00233 #ifdef DOXYGEN_COMPILE 00234 AbstractLinAlgPack::MatrixOpNonsing *C; 00235 AbstractLinAlgPack::MatrixOp *N; 00236 AbstractLinAlgPack::MatrixOp *D_direct; 00237 #else 00238 mat_nonsing_ptr_t C_; 00239 mat_ptr_t N_; 00240 mat_ptr_t D_direct_; 00241 00242 mutable InvCtN_rows_t InvCtN_rows_; 00243 // InvCtN_rows_ keeps track of a set pointers of computed rows of inv(C)*N. 00244 // If D_direct_ is setup then InvCtN_rows_ is not necessary. However, if 00245 // not, then InvCtN_rows_[j-1] will be !=NULL if it points to the precomputed 00246 // jth row of inv(C)*N and will be ==NULL if this row has not been computed 00247 // yet. Each time initialize(...) is called, these rows are deallocated and 00248 // InvCtN_rows_[j-1], j=1...this->rows() is set to NULL. 00249 00250 mutable InvCtN_rows_set_list_t InvCtN_rows_set_list_; 00251 // InvCtN_rows_set_list_ keeps a unorderd=ed list of the row indexes that are 00252 // currently updated. Keeping this list allows the vectors allocated in 00253 // InvCtN_rows_[] to be deallocated much faster than if the whole array 00254 // had to be searched everytime that this->initialize() was called again. 00255 00256 #endif 00257 00258 // ////////////////////////////////// 00259 // Private member functions 00260 00262 void assert_initialized() const; 00263 00264 }; // end class MatrixVarReductImplicit 00265 00266 // //////////////////////////////// 00267 // Inline members 00268 00269 inline 00270 const MatrixVarReductImplicit::mat_nonsing_ptr_t& 00271 MatrixVarReductImplicit::C_ptr() const 00272 { 00273 return C_; 00274 } 00275 00276 inline 00277 const MatrixVarReductImplicit::mat_ptr_t& 00278 MatrixVarReductImplicit::N_ptr() const 00279 { 00280 return N_; 00281 } 00282 00283 inline 00284 const MatrixVarReductImplicit::mat_ptr_t& 00285 MatrixVarReductImplicit::D_direct_ptr() const 00286 { 00287 return D_direct_; 00288 } 00289 00290 } // end namespace ConstrainedOptPack 00291 00292 #endif // MATRIX_VAR_REDUCT_IMPLICIT_H
1.7.4