ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization Version of the Day
ConstrainedOptPack_MatrixHessianSuperBasic.hpp
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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef MATRIX_HESSIAN_SUPER_BASIC_H
00043 #define MATRIX_HESSIAN_SUPER_BASIC_H
00044 
00045 #include <vector>
00046 
00047 #include "ConstrainedOptPack/src/ConstrainedOptPack_Types.hpp"
00048 #include "AbstractLinAlgPack/src/MatrixSymWithOpFactorized.hpp"
00049 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_GenPermMatrixSlice.hpp"
00050 #include "Miref_count_ptr.h"
00051 
00052 namespace ConstrainedOptPack {
00053 
00087 class MatrixHessianSuperBasic
00088   : public virtual MatrixSymOp
00089 {
00090 public:
00091 
00093   typedef Teuchos::RCP<const MatrixSymWithOpFactorized>
00094     B_RR_ptr_t;
00096   typedef Teuchos::RCP<const MatrixOp>
00097     B_RX_ptr_t;
00099   typedef Teuchos::RCP<const MatrixSymOp>
00100     B_XX_ptr_t;
00102   typedef std::vector<EBounds>
00103     bnd_fixed_t;
00104 
00107   MatrixHessianSuperBasic();
00108 
00172   virtual void initialize(
00173     size_type            n
00174     ,size_type           n_R
00175     ,const size_type     i_x_free[]
00176     ,const size_type     i_x_fixed[]
00177     ,const EBounds       bnd_fixed[]
00178     ,const B_RR_ptr_t&   B_RR_ptr
00179     ,const B_RX_ptr_t&   B_RX_ptr
00180     ,BLAS_Cpp::Transp    B_RX_trans
00181     ,const B_XX_ptr_t&   B_XX_ptr
00182     );
00183 
00186 
00188   const GenPermMatrixSlice& Q_R() const;
00190   const GenPermMatrixSlice& Q_X() const;
00192   const bnd_fixed_t& bnd_fixed() const;
00194   const B_RR_ptr_t& B_RR_ptr() const;
00196   const B_RX_ptr_t& B_RX_ptr() const;
00198   BLAS_Cpp::Transp B_RX_trans() const;
00200   const B_XX_ptr_t& B_XX_ptr() const;
00201 
00203 
00206 
00208   size_type rows() const;
00209 
00211 
00214 
00216   void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00217     , const DVectorSlice& vs_rhs2, value_type beta) const;
00219   void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00220     , const SpVectorSlice& sv_rhs2, value_type beta) const;
00222   void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha
00223     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00224     , BLAS_Cpp::Transp M_rhs2_trans
00225     , const DVectorSlice& sv_rhs3, value_type beta) const;
00227   value_type transVtMtV(const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2
00228     , const SpVectorSlice& sv_rhs3) const ;
00229 
00231 
00232 protected:
00233 
00235   void assert_initialized() const;
00236 
00237 private:
00238 
00239   // ///////////////////////////////////
00240   // Private types
00241 
00242   typedef std::vector<size_type>    row_i_t;
00243   typedef std::vector<size_type>    col_j_t;
00244   
00245   // ///////////////////////////////////
00246   // Private data members
00247 
00248   size_type               n_;
00249   size_type               n_R_;
00250   GenPermMatrixSlice    Q_R_;        // Sorted by row
00251   row_i_t         Q_R_row_i_;
00252   col_j_t         Q_R_col_j_;
00253   GenPermMatrixSlice    Q_X_;        // Sorted by row
00254   row_i_t         Q_X_row_i_;
00255   col_j_t         Q_X_col_j_;
00256   bnd_fixed_t             bnd_fixed_;
00257   B_RR_ptr_t              B_RR_ptr_;
00258   B_RX_ptr_t              B_RX_ptr_;
00259   BLAS_Cpp::Transp        B_RX_trans_;
00260   B_XX_ptr_t              B_XX_ptr_;
00261 
00262 }; // end class MatrixHessianSuperBasic
00263 
00264 // ////////////////////////////////////////////
00265 // Inline members for MatrixHessianSuperBasic
00266 
00267 inline
00268 const GenPermMatrixSlice& MatrixHessianSuperBasic::Q_R() const
00269 {
00270   assert_initialized();
00271   return Q_R_;
00272 }
00273 
00274 inline
00275 const GenPermMatrixSlice& MatrixHessianSuperBasic::Q_X() const
00276 {
00277   assert_initialized();
00278   return Q_X_;
00279 }
00280 
00281 inline
00282 const MatrixHessianSuperBasic::bnd_fixed_t&
00283 MatrixHessianSuperBasic::bnd_fixed() const
00284 {
00285   return bnd_fixed_;
00286 }
00287 
00288 inline
00289 const MatrixHessianSuperBasic::B_RR_ptr_t&
00290 MatrixHessianSuperBasic::B_RR_ptr() const
00291 {
00292   assert_initialized();
00293   return B_RR_ptr_;
00294 }
00295 
00296 inline
00297 const MatrixHessianSuperBasic::B_RX_ptr_t&
00298 MatrixHessianSuperBasic::B_RX_ptr() const{
00299   assert_initialized();
00300   return B_RX_ptr_;
00301 }
00302 
00303 inline
00304 BLAS_Cpp::Transp MatrixHessianSuperBasic::B_RX_trans() const
00305 {
00306   assert_initialized();
00307   return B_RX_trans_;
00308 }
00309 
00310 inline
00311 const MatrixHessianSuperBasic::B_XX_ptr_t&
00312 MatrixHessianSuperBasic::B_XX_ptr() const
00313 {
00314   assert_initialized();
00315   return B_XX_ptr_;
00316 }
00317 
00318 } // end namespace ConstrainedOptPack
00319 
00320 #endif // MATRIX_HESSIAN_SUPER_BASIC_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends