|
AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects 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 VECTOR_WITH_OP_MUTABLE_DENSE_H 00030 #define VECTOR_WITH_OP_MUTABLE_DENSE_H 00031 00032 #include "AbstractLinAlgPack_VectorSpaceSerial.hpp" 00033 #include "AbstractLinAlgPack_VectorMutable.hpp" 00034 #include "AbstractLinAlgPack_VectorApplyOpSerialBase.hpp" 00035 #include "DenseLinAlgPack_DVectorClass.hpp" 00036 #include "Teuchos_RCP.hpp" 00037 #include "ReleaseResource.hpp" 00038 00039 namespace AbstractLinAlgPack { 00040 00071 class VectorMutableDense 00072 : virtual public VectorMutable 00073 , virtual private VectorApplyOpSerialBase 00074 { 00075 public: 00076 00078 typedef Teuchos::RCP< 00079 MemMngPack::ReleaseResource> release_resource_ptr_t; 00080 00083 00086 VectorMutableDense( 00087 const size_type dim = 0 00088 ); 00091 VectorMutableDense( 00092 DVectorSlice v 00093 ,const release_resource_ptr_t& v_release 00094 ); 00098 void initialize( 00099 const size_type dim 00100 ); 00103 void initialize( 00104 DVectorSlice v 00105 ,const release_resource_ptr_t& v_release 00106 ); 00107 00109 00112 00123 DVectorSlice set_vec(); 00126 const DVectorSlice get_vec() const; 00130 const release_resource_ptr_t& vec_release() const; 00131 00133 00136 00138 const VectorSpace& space() const; 00140 void apply_op( 00141 const RTOpPack::RTOp& op 00142 ,const size_t num_vecs, const Vector* vecs[] 00143 ,const size_t num_targ_vecs, VectorMutable* targ_vecs[] 00144 ,RTOpPack::ReductTarget *reduct_obj 00145 ,const index_type first_ele, const index_type sub_dim, const index_type global_offset 00146 ) const; 00148 index_type dim() const; 00150 value_type get_ele(index_type i) const; 00152 void get_sub_vector( const Range1D& rng, RTOpPack::SubVector* sub_vec ) const; 00154 void free_sub_vector( RTOpPack::SubVector* sub_vec ) const; 00155 00157 00160 00162 VectorMutable& operator=(value_type alpha); 00164 VectorMutable& operator=(const Vector& v); 00166 VectorMutable& operator=(const VectorMutable& v); 00168 void set_ele( index_type i, value_type val ); 00170 vec_mut_ptr_t sub_view( const Range1D& rng ); 00172 void get_sub_vector( const Range1D& rng, RTOpPack::MutableSubVector* sub_vec ); 00174 void commit_sub_vector( RTOpPack::MutableSubVector* sub_vec ); 00176 void set_sub_vector( const RTOpPack::SparseSubVector& sub_vec ); 00178 void Vp_StMtV( 00179 value_type alpha 00180 ,const GenPermMatrixSlice &P 00181 ,BLAS_Cpp::Transp P_trans 00182 ,const Vector &x 00183 ,value_type beta 00184 ); 00185 00187 00189 VectorMutableDense* operator&() 00190 { 00191 return this; 00192 } 00193 private: 00194 00195 // /////////////////////////////////////// 00196 // Private data members 00197 00198 DVectorSlice v_; 00199 release_resource_ptr_t v_release_; 00200 VectorSpaceSerial space_; 00201 00202 // Not defined and not to be called 00203 //VectorMutableDense(const VectorMutableDense&); 00204 VectorMutableDense& operator=(const VectorMutableDense&); 00205 00206 }; // end class VectorMutableDense 00207 00208 // ////////////////////////////////////// 00209 // Inline members 00210 00211 inline 00212 DVectorSlice 00213 VectorMutableDense::set_vec() 00214 { 00215 this->has_changed(); 00216 return v_; 00217 } 00218 00219 inline 00220 const DVectorSlice 00221 VectorMutableDense::get_vec() const 00222 { 00223 return v_; 00224 } 00225 00226 inline 00227 const VectorMutableDense::release_resource_ptr_t& 00228 VectorMutableDense::vec_release() const 00229 { 00230 return v_release_; 00231 } 00232 00233 } // end namespace AbstractLinAlgPack 00234 00235 #endif // VECTOR_WITH_OP_MUTABLE_DENSE_H
1.7.4