|
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 ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H 00030 #define ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H 00031 00032 #include <iosfwd> 00033 00034 #include "AbstractLinAlgPack_MatrixOp.hpp" 00035 #include "Teuchos_RCP.hpp" 00036 #include "AbstractLinAlgPack_VectorSpace.hpp" 00037 00038 namespace AbstractLinAlgPack { 00039 00050 class MatrixOpSubView : public virtual MatrixOp { 00051 public: 00052 00054 using MatrixOp::syrk; 00055 00057 typedef Teuchos::RCP<MatrixOp> mat_ptr_t; 00058 00061 00064 MatrixOpSubView( 00065 const mat_ptr_t& M_full = Teuchos::null 00066 ,const Range1D& rng_rows = Range1D() 00067 ,const Range1D& rng_cols = Range1D() 00068 ,BLAS_Cpp::Transp M_trans = BLAS_Cpp::no_trans 00069 ); 00070 00104 void initialize( 00105 const mat_ptr_t& M_full 00106 ,const Range1D& rng_rows = Range1D() 00107 ,const Range1D& rng_cols = Range1D() 00108 ,BLAS_Cpp::Transp M_trans = BLAS_Cpp::no_trans 00109 ); 00110 00112 00115 00117 const mat_ptr_t& M_full_ptr(); 00119 MatrixOp& M_full(); 00121 const MatrixOp& M_full() const; 00123 Range1D rng_rows() const; 00125 Range1D rng_cols() const; 00127 BLAS_Cpp::Transp M_trans(); 00128 00130 00133 00135 size_type rows() const; 00137 size_type cols() const; 00139 size_type nz() const; 00140 00142 00145 00147 const VectorSpace& space_cols() const; 00149 const VectorSpace& space_rows() const; 00151 MatrixOp::mat_ptr_t sub_view(const Range1D& row_rng, const Range1D& col_rng) const; 00153 void zero_out(); 00155 void Mt_S( value_type alpha ); 00157 MatrixOp& operator=(const MatrixOp& M); 00159 std::ostream& output(std::ostream& out) const; 00161 bool Mp_StM( 00162 MatrixOp* mwo_lhs, value_type alpha 00163 , BLAS_Cpp::Transp trans_rhs) const; 00165 bool Mp_StMtP( 00166 MatrixOp* mwo_lhs, value_type alpha 00167 , BLAS_Cpp::Transp M_trans 00168 , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00169 ) const; 00171 bool Mp_StPtM( 00172 MatrixOp* mwo_lhs, value_type alpha 00173 , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00174 , BLAS_Cpp::Transp M_trans 00175 ) const; 00177 bool Mp_StPtMtP( 00178 MatrixOp* mwo_lhs, value_type alpha 00179 ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00180 ,BLAS_Cpp::Transp M_trans 00181 ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans 00182 ) const; 00184 bool Mp_StM( 00185 value_type alpha,const MatrixOp& M_rhs, BLAS_Cpp::Transp trans_rhs); 00187 bool Mp_StMtP( 00188 value_type alpha 00189 ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans 00190 ,const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00191 ); 00193 bool Mp_StPtM( 00194 value_type alpha 00195 ,const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00196 ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans 00197 ); 00199 bool Mp_StPtMtP( 00200 value_type alpha 00201 ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00202 ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans 00203 ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans 00204 ); 00206 void Vp_StMtV( 00207 VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00208 , const Vector& v_rhs2, value_type beta) const; 00210 void Vp_StMtV( 00211 VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00212 , const SpVectorSlice& sv_rhs2, value_type beta) const; 00214 void Vp_StPtMtV( 00215 VectorMutable* vs_lhs, value_type alpha 00216 , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00217 , BLAS_Cpp::Transp M_rhs2_trans 00218 , const Vector& v_rhs3, value_type beta) const; 00220 void Vp_StPtMtV( 00221 VectorMutable* vs_lhs, value_type alpha 00222 , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00223 , BLAS_Cpp::Transp M_rhs2_trans 00224 , const SpVectorSlice& sv_rhs3, value_type beta) const; 00226 value_type transVtMtV( 00227 const Vector& v_rhs1, BLAS_Cpp::Transp trans_rhs2 00228 , const Vector& v_rhs3) const; 00230 value_type transVtMtV( 00231 const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2 00232 , const SpVectorSlice& sv_rhs3) const; 00234 void syr2k( 00235 BLAS_Cpp::Transp M_trans, value_type alpha 00236 , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans 00237 , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans 00238 , value_type beta, MatrixSymOp* symwo_lhs ) const; 00240 bool Mp_StMtM( 00241 MatrixOp* mwo_lhs, value_type alpha 00242 , BLAS_Cpp::Transp trans_rhs1, const MatrixOp& mwo_rhs2 00243 , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const; 00245 bool Mp_StMtM( 00246 MatrixOp* mwo_lhs, value_type alpha 00247 , const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1 00248 , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const; 00250 bool Mp_StMtM( 00251 value_type alpha 00252 ,const MatrixOp& mvw_rhs1, BLAS_Cpp::Transp trans_rhs1 00253 ,const MatrixOp& mwo_rhs2,BLAS_Cpp::Transp trans_rhs2 00254 ,value_type beta ); 00256 bool syrk( 00257 BLAS_Cpp::Transp M_trans, value_type alpha 00258 , value_type beta, MatrixSymOp* sym_lhs ) const; 00259 00261 00262 private: 00263 00264 #ifdef DOXYGEN_COMPILE 00265 MatrixOp *M_full; 00266 Range1D rng_rows; 00267 Range1D rng_cols; 00268 #else 00269 mat_ptr_t M_full_; 00270 Range1D rng_rows_; 00271 Range1D rng_cols_; 00272 BLAS_Cpp::Transp M_trans_; 00273 VectorSpace::space_ptr_t space_cols_; 00274 VectorSpace::space_ptr_t space_rows_; 00275 #endif 00276 00277 // 00278 void assert_initialized() const; 00279 00280 }; // end class MatrixOpSubView 00281 00282 // ////////////////////////////////// 00283 // Inline members 00284 00285 inline 00286 const MatrixOpSubView::mat_ptr_t& 00287 MatrixOpSubView::M_full_ptr() 00288 { 00289 return M_full_; 00290 } 00291 00292 inline 00293 MatrixOp& MatrixOpSubView::M_full() 00294 { 00295 return *M_full_; 00296 } 00297 00298 inline 00299 const MatrixOp& MatrixOpSubView::M_full() const 00300 { 00301 return *M_full_; 00302 } 00303 00304 inline 00305 Range1D MatrixOpSubView::rng_rows() const 00306 { 00307 return rng_rows_; 00308 } 00309 00310 inline 00311 Range1D MatrixOpSubView::rng_cols() const 00312 { 00313 return rng_rows_; 00314 } 00315 00316 inline 00317 BLAS_Cpp::Transp MatrixOpSubView::M_trans() 00318 { 00319 return M_trans_; 00320 } 00321 00322 } // end namespace AbstractLinAlgPack 00323 00324 #endif // ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H
1.7.4