|
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 // 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 MULTI_VECTOR_MUTABLE_DENSE_H 00043 #define MULTI_VECTOR_MUTABLE_DENSE_H 00044 00045 #include "AbstractLinAlgPack_MatrixOpSerial.hpp" 00046 #include "AbstractLinAlgPack_MatrixOpGetGMSMutable.hpp" 00047 #include "AbstractLinAlgPack_MultiVectorMutable.hpp" 00048 #include "DenseLinAlgPack_DMatrixClass.hpp" 00049 #include "ReleaseResource.hpp" 00050 00051 namespace AbstractLinAlgPack { 00052 00083 class MultiVectorMutableDense 00084 : public AbstractLinAlgPack::MultiVectorMutable // doxygen needs the full path 00085 , public MatrixOpSerial 00086 , public MatrixOpGetGMS 00087 { 00088 public: 00089 00091 typedef Teuchos::RCP< 00092 MemMngPack::ReleaseResource> release_resource_ptr_t; 00093 00096 00099 MultiVectorMutableDense( 00100 const size_type rows = 0 00101 ,const size_type cols = 0 00102 ); 00105 MultiVectorMutableDense( 00106 DMatrixSlice gms 00107 ,BLAS_Cpp::Transp gms_trans 00108 ,const release_resource_ptr_t& gms_release 00109 ); 00113 void initialize( 00114 const size_type rows 00115 ,const size_type cols 00116 ); 00127 void initialize( 00128 DMatrixSlice gms 00129 ,BLAS_Cpp::Transp gms_trans 00130 ,const release_resource_ptr_t& gms_release 00131 ); 00132 00134 00137 00145 DMatrixSlice set_gms(); 00148 const DMatrixSlice get_gms() const; 00151 BLAS_Cpp::Transp gms_trans() const; 00155 const release_resource_ptr_t& gms_release() const; 00156 00158 00161 00163 const DMatrixSlice get_gms_view() const; 00165 void free_gms_view(const DMatrixSlice* gms_view) const; 00166 00168 00171 00173 DMatrixSlice get_gms_view(); 00175 void commit_gms_view(DMatrixSlice* gms_view); 00176 00178 00181 00183 size_type rows() const; 00185 size_type cols() const; 00186 00188 00191 00193 void zero_out(); 00195 void Mt_S( value_type alpha ); 00197 MatrixOp& operator=(const MatrixOp& mwo_rhs); 00199 std::ostream& output(std::ostream& out) const; 00201 bool Mp_StM( 00202 MatrixOp* mwo_lhs, value_type alpha 00203 ,BLAS_Cpp::Transp trans_rhs 00204 ) const; 00206 bool Mp_StM( 00207 value_type alpha,const MatrixOp& M_rhs, BLAS_Cpp::Transp trans_rhs 00208 ); 00210 bool syrk( 00211 BLAS_Cpp::Transp M_trans, value_type alpha 00212 ,value_type beta, MatrixSymOp* sym_lhs 00213 ) const; 00215 bool Mp_StMtM( 00216 MatrixOp* mwo_lhs, value_type alpha 00217 ,const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1 00218 ,BLAS_Cpp::Transp trans_rhs2 00219 ,value_type beta ) const; 00221 bool Mp_StMtM( 00222 MatrixOp* mwo_lhs, value_type alpha 00223 ,BLAS_Cpp::Transp trans_rhs1 00224 ,const MatrixOp& mwo_rhs2, BLAS_Cpp::Transp trans_rhs2 00225 ,value_type beta ) const; 00226 00228 00231 00233 access_by_t access_by() const; 00234 00236 00239 00241 vec_mut_ptr_t col(index_type j); 00243 vec_mut_ptr_t row(index_type i); 00245 vec_mut_ptr_t diag(int k); 00247 multi_vec_mut_ptr_t mv_sub_view(const Range1D& row_rng, const Range1D& col_rng); 00248 00250 00253 00255 void Vp_StMtV( 00256 DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00257 , const DVectorSlice& vs_rhs2, value_type beta) const; 00259 void Vp_StMtV( 00260 DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00261 , const SpVectorSlice& sv_rhs2, value_type beta) const; 00262 00263 // ToDo: Add more overrides as they are needed! 00264 00266 00267 protected: 00268 00271 00273 void apply_op( 00274 EApplyBy apply_by, const RTOpPack::RTOp& primary_op 00275 ,const size_t num_multi_vecs, const MultiVector** multi_vecs 00276 ,const size_t num_targ_multi_vecs, MultiVectorMutable** targ_multi_vecs 00277 ,RTOpPack::ReductTarget* reduct_objs[] 00278 ,const index_type primary_first_ele , const index_type primary_sub_dim , const index_type primary_global_offset 00279 ,const index_type secondary_first_ele , const index_type secondary_sub_dim 00280 ) const; 00282 void apply_op( 00283 EApplyBy apply_by, const RTOpPack::RTOp& primary_op, const RTOpPack::RTOp& secondary_op 00284 ,const size_t num_multi_vecs, const MultiVector** multi_vecs 00285 ,const size_t num_targ_multi_vecs, MultiVectorMutable** targ_multi_vecs 00286 ,RTOpPack::ReductTarget *reduct_obj 00287 ,const index_type primary_first_ele , const index_type primary_sub_dim , const index_type primary_global_offset 00288 ,const index_type secondary_first_ele , const index_type secondary_sub_dim 00289 ) const; 00290 00292 00293 private: 00294 00295 // /////////////////////////////////////// 00296 // Private data members 00297 00298 DMatrixSlice gms_; 00299 BLAS_Cpp::Transp gms_trans_; 00300 release_resource_ptr_t gms_release_; 00301 00302 }; // end class MultiVectorMutableDense 00303 00304 // ////////////////////////////////////// 00305 // Inline members 00306 00307 inline 00308 DMatrixSlice 00309 MultiVectorMutableDense::set_gms() 00310 { 00311 return gms_; 00312 } 00313 00314 inline 00315 const DMatrixSlice 00316 MultiVectorMutableDense::get_gms() const 00317 { 00318 return gms_; 00319 } 00320 00321 inline 00322 BLAS_Cpp::Transp 00323 MultiVectorMutableDense::gms_trans() const 00324 { 00325 return gms_trans_; 00326 } 00327 00328 inline 00329 const MultiVectorMutableDense::release_resource_ptr_t& 00330 MultiVectorMutableDense::gms_release() const 00331 { 00332 return gms_release_; 00333 } 00334 00335 } // end namespace AbstractLinAlgPack 00336 00337 #endif // MULTI_VECTOR_MUTABLE_DENSE_H
1.7.6.1