|
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 MULTI_VECTOR_MUTABLE_DENSE_H 00030 #define MULTI_VECTOR_MUTABLE_DENSE_H 00031 00032 #include "AbstractLinAlgPack_MatrixOpSerial.hpp" 00033 #include "AbstractLinAlgPack_MatrixOpGetGMSMutable.hpp" 00034 #include "AbstractLinAlgPack_MultiVectorMutable.hpp" 00035 #include "DenseLinAlgPack_DMatrixClass.hpp" 00036 #include "ReleaseResource.hpp" 00037 00038 namespace AbstractLinAlgPack { 00039 00070 class MultiVectorMutableDense 00071 : public AbstractLinAlgPack::MultiVectorMutable // doxygen needs the full path 00072 , public MatrixOpSerial 00073 , public MatrixOpGetGMS 00074 { 00075 public: 00076 00078 typedef Teuchos::RCP< 00079 MemMngPack::ReleaseResource> release_resource_ptr_t; 00080 00083 00086 MultiVectorMutableDense( 00087 const size_type rows = 0 00088 ,const size_type cols = 0 00089 ); 00092 MultiVectorMutableDense( 00093 DMatrixSlice gms 00094 ,BLAS_Cpp::Transp gms_trans 00095 ,const release_resource_ptr_t& gms_release 00096 ); 00100 void initialize( 00101 const size_type rows 00102 ,const size_type cols 00103 ); 00114 void initialize( 00115 DMatrixSlice gms 00116 ,BLAS_Cpp::Transp gms_trans 00117 ,const release_resource_ptr_t& gms_release 00118 ); 00119 00121 00124 00132 DMatrixSlice set_gms(); 00135 const DMatrixSlice get_gms() const; 00138 BLAS_Cpp::Transp gms_trans() const; 00142 const release_resource_ptr_t& gms_release() const; 00143 00145 00148 00150 const DMatrixSlice get_gms_view() const; 00152 void free_gms_view(const DMatrixSlice* gms_view) const; 00153 00155 00158 00160 DMatrixSlice get_gms_view(); 00162 void commit_gms_view(DMatrixSlice* gms_view); 00163 00165 00168 00170 size_type rows() const; 00172 size_type cols() const; 00173 00175 00178 00180 void zero_out(); 00182 void Mt_S( value_type alpha ); 00184 MatrixOp& operator=(const MatrixOp& mwo_rhs); 00186 std::ostream& output(std::ostream& out) const; 00188 bool Mp_StM( 00189 MatrixOp* mwo_lhs, value_type alpha 00190 ,BLAS_Cpp::Transp trans_rhs 00191 ) const; 00193 bool Mp_StM( 00194 value_type alpha,const MatrixOp& M_rhs, BLAS_Cpp::Transp trans_rhs 00195 ); 00197 bool syrk( 00198 BLAS_Cpp::Transp M_trans, value_type alpha 00199 ,value_type beta, MatrixSymOp* sym_lhs 00200 ) const; 00202 bool Mp_StMtM( 00203 MatrixOp* mwo_lhs, value_type alpha 00204 ,const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1 00205 ,BLAS_Cpp::Transp trans_rhs2 00206 ,value_type beta ) const; 00208 bool Mp_StMtM( 00209 MatrixOp* mwo_lhs, value_type alpha 00210 ,BLAS_Cpp::Transp trans_rhs1 00211 ,const MatrixOp& mwo_rhs2, BLAS_Cpp::Transp trans_rhs2 00212 ,value_type beta ) const; 00213 00215 00218 00220 access_by_t access_by() const; 00221 00223 00226 00228 vec_mut_ptr_t col(index_type j); 00230 vec_mut_ptr_t row(index_type i); 00232 vec_mut_ptr_t diag(int k); 00234 multi_vec_mut_ptr_t mv_sub_view(const Range1D& row_rng, const Range1D& col_rng); 00235 00237 00240 00242 void Vp_StMtV( 00243 DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00244 , const DVectorSlice& vs_rhs2, value_type beta) const; 00246 void Vp_StMtV( 00247 DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00248 , const SpVectorSlice& sv_rhs2, value_type beta) const; 00249 00250 // ToDo: Add more overrides as they are needed! 00251 00253 00254 protected: 00255 00258 00260 void apply_op( 00261 EApplyBy apply_by, const RTOpPack::RTOp& primary_op 00262 ,const size_t num_multi_vecs, const MultiVector** multi_vecs 00263 ,const size_t num_targ_multi_vecs, MultiVectorMutable** targ_multi_vecs 00264 ,RTOpPack::ReductTarget* reduct_objs[] 00265 ,const index_type primary_first_ele , const index_type primary_sub_dim , const index_type primary_global_offset 00266 ,const index_type secondary_first_ele , const index_type secondary_sub_dim 00267 ) const; 00269 void apply_op( 00270 EApplyBy apply_by, const RTOpPack::RTOp& primary_op, const RTOpPack::RTOp& secondary_op 00271 ,const size_t num_multi_vecs, const MultiVector** multi_vecs 00272 ,const size_t num_targ_multi_vecs, MultiVectorMutable** targ_multi_vecs 00273 ,RTOpPack::ReductTarget *reduct_obj 00274 ,const index_type primary_first_ele , const index_type primary_sub_dim , const index_type primary_global_offset 00275 ,const index_type secondary_first_ele , const index_type secondary_sub_dim 00276 ) const; 00277 00279 00280 private: 00281 00282 // /////////////////////////////////////// 00283 // Private data members 00284 00285 DMatrixSlice gms_; 00286 BLAS_Cpp::Transp gms_trans_; 00287 release_resource_ptr_t gms_release_; 00288 00289 }; // end class MultiVectorMutableDense 00290 00291 // ////////////////////////////////////// 00292 // Inline members 00293 00294 inline 00295 DMatrixSlice 00296 MultiVectorMutableDense::set_gms() 00297 { 00298 return gms_; 00299 } 00300 00301 inline 00302 const DMatrixSlice 00303 MultiVectorMutableDense::get_gms() const 00304 { 00305 return gms_; 00306 } 00307 00308 inline 00309 BLAS_Cpp::Transp 00310 MultiVectorMutableDense::gms_trans() const 00311 { 00312 return gms_trans_; 00313 } 00314 00315 inline 00316 const MultiVectorMutableDense::release_resource_ptr_t& 00317 MultiVectorMutableDense::gms_release() const 00318 { 00319 return gms_release_; 00320 } 00321 00322 } // end namespace AbstractLinAlgPack 00323 00324 #endif // MULTI_VECTOR_MUTABLE_DENSE_H
1.7.4