|
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 #include <assert.h> 00030 00031 #include "ConstrainedOptPack_MatrixIdentConcatStd.hpp" 00032 #include "Teuchos_TestForException.hpp" 00033 00034 namespace ConstrainedOptPack { 00035 00036 // Setup and representation access 00037 00038 MatrixIdentConcatStd::MatrixIdentConcatStd() 00039 { 00040 this->set_uninitialized(); 00041 } 00042 00043 void MatrixIdentConcatStd::initialize( 00044 const VectorSpace::space_ptr_t& space_cols 00045 ,const VectorSpace::space_ptr_t& space_rows 00046 ,ETopBottom top_or_bottom 00047 ,value_type alpha 00048 ,const D_ptr_t &D_ptr 00049 ,BLAS_Cpp::Transp D_trans 00050 ) 00051 { 00052 #ifdef TEUCHOS_DEBUG 00053 TEST_FOR_EXCEPTION( 00054 space_cols.get() == NULL, std::invalid_argument 00055 ,"MatrixIdentConcatStd::initialize(...): Error, " 00056 "space_cols.get() can not be NULL!" ); 00057 TEST_FOR_EXCEPTION( 00058 space_rows.get() == NULL, std::invalid_argument 00059 ,"MatrixIdentConcatStd::initialize(...): Error, " 00060 "space_rows.get() can not be NULL!" ); 00061 TEST_FOR_EXCEPTION( 00062 D_ptr.get() == NULL, std::invalid_argument 00063 ,"MatrixIdentConcatStd::initialize(...): Error, " 00064 "D_ptr.get() can not be NULL!" ); 00065 #endif 00066 const size_type 00067 D_rows = D_ptr->rows(), 00068 D_cols = D_ptr->cols(), 00069 opD_rows = BLAS_Cpp::rows( D_rows, D_cols, D_trans ), 00070 opD_cols = BLAS_Cpp::cols( D_rows, D_cols, D_trans ), 00071 rows = opD_rows + opD_cols; 00072 space_cols_ = space_cols; 00073 space_rows_ = space_rows; 00074 alpha_ = alpha; 00075 D_ptr_ = D_ptr; 00076 D_trans_ = D_trans; 00077 D_rng_ = top_or_bottom == TOP ? Range1D(1,opD_rows) : Range1D(opD_cols+1,rows); 00078 I_rng_ = top_or_bottom == TOP ? Range1D(opD_rows+1,rows) : Range1D(1,opD_cols); 00079 } 00080 00081 void MatrixIdentConcatStd::set_uninitialized() 00082 { 00083 namespace rcp = MemMngPack; 00084 space_cols_ = Teuchos::null; 00085 space_rows_ = Teuchos::null; 00086 alpha_ = 0.0; 00087 D_ptr_ = Teuchos::null; 00088 D_trans_ = BLAS_Cpp::no_trans; 00089 D_rng_ = Range1D::Invalid; 00090 I_rng_ = Range1D::Invalid; 00091 } 00092 00093 const MatrixIdentConcatStd::D_ptr_t& MatrixIdentConcatStd::D_ptr() const 00094 { 00095 return D_ptr_; 00096 } 00097 00098 // Overridden form MatrixIdentConcat 00099 00100 Range1D MatrixIdentConcatStd::D_rng() const 00101 { 00102 return D_rng_; 00103 } 00104 00105 Range1D MatrixIdentConcatStd::I_rng() const 00106 { 00107 return I_rng_; 00108 } 00109 00110 value_type MatrixIdentConcatStd::alpha() const 00111 { 00112 return alpha_; 00113 } 00114 00115 const MatrixOp& MatrixIdentConcatStd::D() const 00116 { 00117 return *D_ptr_; 00118 } 00119 00120 BLAS_Cpp::Transp MatrixIdentConcatStd::D_trans() const 00121 { 00122 return D_trans_; 00123 } 00124 00125 // Overridden from MatrixOp 00126 00127 const VectorSpace& MatrixIdentConcatStd::space_cols() const 00128 { 00129 return *space_cols_; 00130 } 00131 00132 const VectorSpace& MatrixIdentConcatStd::space_rows() const 00133 { 00134 return *space_rows_; 00135 } 00136 00137 MatrixOp& MatrixIdentConcatStd::operator=(const MatrixOp& m) 00138 { 00139 TEST_FOR_EXCEPT(true); // Finish! 00140 return *this; 00141 } 00142 00143 // private 00144 00145 void MatrixIdentConcatStd::assert_initialized() const { 00146 TEST_FOR_EXCEPTION( 00147 space_cols_.get() == NULL, std::logic_error 00148 ,"Error, the MatrixIdentConcatStd object has not been initialized!" ); 00149 } 00150 00151 } // end namespace ConstrainedOptPack
1.7.4