|
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_SYM_POS_DEF_BANDED_CHOL_H 00030 #define MATRIX_SYM_POS_DEF_BANDED_CHOL_H 00031 00032 #include "ConstrainedOptPack_Types.hpp" 00033 #include "AbstractLinAlgPack/src/MatrixSymWithOpFactorized.hpp" 00034 #include "DenseLinAlgPack_DMatrixClass.hpp" 00035 #include "Miref_count_ptr.h" 00036 #include "MiReleaseResource.h" 00037 00038 namespace ConstrainedOptPack { 00065 class MatrixSymPosDefBandedChol : public MatrixSymWithOpFactorized 00066 { 00067 public: 00068 00070 typedef Teuchos::RCP< 00071 MemMngPack::ReleaseResource> release_resource_ptr_t; 00072 00073 // ////////////// 00074 // Constructors 00075 00080 MatrixSymPosDefBandedChol( 00081 size_type n = 0 00082 ,size_type kd = 0 00083 ,DMatrixSlice *MB = NULL 00084 ,const release_resource_ptr_t& MB_release_resource_ptr = NULL 00085 ,BLAS_Cpp::Uplo MB_uplo = BLAS_Cpp::lower 00086 ,DMatrixSlice *UB = NULL 00087 ,const release_resource_ptr_t& UB_release_resource_ptr = NULL 00088 ,BLAS_Cpp::Uplo UB_uplo = BLAS_Cpp::lower 00089 ,bool update_factor = false 00090 ,value_type scale = 1.0 00091 ); 00092 00093 // /////////////////////////// 00094 // Access representation 00095 00128 void initialize( 00129 size_type n = 0 00130 ,size_type kd = 0 00131 ,DMatrixSlice *MB = NULL 00132 ,const release_resource_ptr_t& MB_release_resource_ptr = NULL 00133 ,BLAS_Cpp::Uplo MB_uplo = BLAS_Cpp::lower 00134 ,DMatrixSlice *UB = NULL 00135 ,const release_resource_ptr_t& UB_release_resource_ptr = NULL 00136 ,BLAS_Cpp::Uplo UB_uplo = BLAS_Cpp::lower 00137 ,bool update_factor = false 00138 ,value_type scale = 1.0 00139 ); 00140 00142 size_type kd() const; 00145 DMatrixSlice& MB(); 00147 const DMatrixSlice& MB() const; 00149 BLAS_Cpp::Uplo MB_uplo() const; 00152 DMatrixSlice& UB(); 00154 const DMatrixSlice& UB() const; 00156 BLAS_Cpp::Uplo UB_uplo() const; 00157 00158 // ///////////////////////////// 00159 // Overridden from MatrixOp 00160 00162 size_type rows() const; 00164 size_type nz() const; 00166 std::ostream& output(std::ostream& out) const; 00168 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00169 , const DVectorSlice& vs_rhs2, value_type beta) const; 00171 void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00172 , const SpVectorSlice& sv_rhs2, value_type beta) const; 00174 void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha 00175 , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00176 , BLAS_Cpp::Transp M_rhs2_trans 00177 , const DVectorSlice& vs_rhs3, value_type beta) const; 00179 void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha 00180 , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00181 , BLAS_Cpp::Transp M_rhs2_trans 00182 , const SpVectorSlice& sv_rhs3, value_type beta) const; 00183 00184 // ////////////////////////////////// 00185 // Overridden from MatrixFactorized 00186 00188 void V_InvMtV(DVectorSlice* vs_lhs, BLAS_Cpp::Transp trans_rhs1 00189 , const DVectorSlice& vs_rhs2) const; 00190 00191 private: 00192 00193 // ///////////////////////////// 00194 // Private data members 00195 00196 size_type n_; 00197 size_type kd_; 00198 DMatrixSlice MB_; 00199 release_resource_ptr_t MB_release_resource_ptr_; 00200 BLAS_Cpp::Uplo MB_uplo_; 00201 mutable DMatrixSlice UB_; 00202 mutable release_resource_ptr_t UB_release_resource_ptr_; 00203 mutable BLAS_Cpp::Uplo UB_uplo_; 00204 mutable bool factor_updated_; 00205 value_type scale_; 00206 00207 // ///////////////////////////// 00208 // Private member functions 00209 00210 void assert_initialized() const; 00211 void update_factorization() const; 00212 00213 }; // end class MatrixSymPosDefBandedChol 00214 00215 // /////////////////////////////////////////////////////// 00216 // Inline members for MatrixSymPosDefBandedChol 00217 00218 inline 00219 size_type MatrixSymPosDefBandedChol::kd() const 00220 { 00221 return kd_; 00222 } 00223 00224 inline 00225 DMatrixSlice& MatrixSymPosDefBandedChol::MB() 00226 { 00227 return MB_; 00228 } 00229 00230 inline 00231 const DMatrixSlice& MatrixSymPosDefBandedChol::MB() const 00232 { 00233 return MB_; 00234 } 00235 00236 inline 00237 BLAS_Cpp::Uplo MatrixSymPosDefBandedChol::MB_uplo() const 00238 { 00239 return MB_uplo_; 00240 } 00241 00242 inline 00243 DMatrixSlice& MatrixSymPosDefBandedChol::UB() 00244 { 00245 return UB_; 00246 } 00247 00248 inline 00249 const DMatrixSlice& MatrixSymPosDefBandedChol::UB() const 00250 { 00251 return UB_; 00252 } 00253 00254 inline 00255 BLAS_Cpp::Uplo MatrixSymPosDefBandedChol::UB_uplo() const 00256 { 00257 return UB_uplo_; 00258 } 00259 00260 } // end namespace ConstrainedOptPack 00261 00262 #endif // MATRIX_SYM_POS_DEF_BANDED_CHOL_H
1.7.4