|
ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization Version of the Day
|
00001 #if 0 00002 00003 // @HEADER 00004 // *********************************************************************** 00005 // 00006 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00007 // Copyright (2003) Sandia Corporation 00008 // 00009 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00010 // license for use of this work by or on behalf of the U.S. Government. 00011 // 00012 // This library is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU Lesser General Public License as 00014 // published by the Free Software Foundation; either version 2.1 of the 00015 // License, or (at your option) any later version. 00016 // 00017 // This library is distributed in the hope that it will be useful, but 00018 // WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 // Lesser General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU Lesser General Public 00023 // License along with this library; if not, write to the Free Software 00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00025 // USA 00026 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00027 // 00028 // *********************************************************************** 00029 // @HEADER 00030 00031 #include "ConstrainedOptPack_MatrixHessianSuperBasicInitDiagonal.hpp" 00032 #include "DenseLinAlgPack_DVectorClass.hpp" 00033 #include "Midynamic_cast_verbose.h" 00034 00035 namespace ConstrainedOptPack { 00036 00037 MatrixHessianSuperBasicInitDiagonal::MatrixHessianSuperBasicInitDiagonal() 00038 : B_RR_init_(NULL) 00039 {} 00040 00041 void MatrixHessianSuperBasicInitDiagonal::initialize( 00042 size_type n 00043 ,size_type n_R 00044 ,const size_type i_x_free[] 00045 ,const size_type i_x_fixed[] 00046 ,const EBounds bnd_fixed[] 00047 ,const B_RR_ptr_t& B_RR_ptr 00048 ,const B_RX_ptr_t& B_RX_ptr 00049 ,BLAS_Cpp::Transp B_RX_trans 00050 ,const B_XX_ptr_t& B_XX_ptr 00051 ) 00052 { 00053 using Teuchos::dyn_cast; 00054 00055 // Validate the B_RR supports this interface 00056 #ifdef _WINDOWS 00057 B_RR_init_ = &dynamic_cast<MatrixSymInitDiag&>( 00058 const_cast<MatrixSymWithOpFactorized&>(*B_RR_ptr) 00059 ); 00060 #else 00061 B_RR_init_ = &dyn_cast<MatrixSymInitDiag>( 00062 const_cast<MatrixSymWithOpFactorized&>(*B_RR_ptr) 00063 ); 00064 #endif 00065 00066 MatrixHessianSuperBasic::initialize( 00067 n,n_R,i_x_free,i_x_fixed,bnd_fixed 00068 ,B_RR_ptr,B_RX_ptr,B_RX_trans,B_XX_ptr 00069 ); 00070 } 00071 00072 // Overridden from MatrixSymInitDiag 00073 00074 void MatrixHessianSuperBasicInitDiagonal::init_identity( 00075 size_type n, value_type alpha ) 00076 { 00077 assert_initialized(); 00078 B_RR_init_->init_identity(n,alpha); 00079 MatrixHessianSuperBasic::initialize( 00080 n,n,NULL,NULL,NULL 00081 ,this->B_RR_ptr() 00082 ,this->B_RX_ptr(),this->B_RX_trans() 00083 ,this->B_XX_ptr() 00084 ); 00085 } 00086 00087 void MatrixHessianSuperBasicInitDiagonal::init_diagonal( 00088 const DVectorSlice& diag ) 00089 { 00090 assert_initialized(); 00091 B_RR_init_->init_diagonal(diag); 00092 MatrixHessianSuperBasic::initialize( 00093 diag.size(),diag.size(),NULL,NULL,NULL 00094 ,this->B_RR_ptr() 00095 ,this->B_RX_ptr(),this->B_RX_trans() 00096 ,this->B_XX_ptr() 00097 ); 00098 } 00099 00100 } // end namespace ConstrainedOptPack 00101 00102 #endif // 0
1.7.4