|
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 MATRIX_PERM_AGGR_H 00030 #define MATRIX_PERM_AGGR_H 00031 00032 #include "AbstractLinAlgPack_MatrixOp.hpp" 00033 00034 namespace AbstractLinAlgPack { 00035 00041 class MatrixPermAggr 00042 : virtual public MatrixOp 00043 { 00044 public: 00045 00048 00050 typedef Teuchos::RCP<const Permutation> perm_ptr_t; 00051 00053 00056 00058 MatrixPermAggr(); 00059 00062 MatrixPermAggr( 00063 const mat_ptr_t &mat_orig 00064 ,const perm_ptr_t &row_perm 00065 ,const perm_ptr_t &col_perm 00066 ,const mat_ptr_t &mat_perm 00067 ); 00068 00097 void initialize( 00098 const mat_ptr_t &mat_orig 00099 ,const perm_ptr_t &row_perm 00100 ,const perm_ptr_t &col_perm 00101 ,const mat_ptr_t &mat_perm 00102 ); 00103 00108 void set_uninitialized(); 00109 00111 00114 00116 const mat_ptr_t& mat_orig() const; 00118 const perm_ptr_t& row_perm() const; 00120 const perm_ptr_t& col_perm() const; 00122 const mat_ptr_t& mat_perm() const; 00123 00125 00128 00130 size_type rows() const; 00132 size_type cols() const; 00134 size_type nz() const; 00135 00137 00140 00142 const VectorSpace& space_cols() const; 00144 const VectorSpace& space_rows() const; 00146 MatrixOp::mat_ptr_t sub_view(const Range1D& row_rng, const Range1D& col_rng) const; 00148 MatrixOp& operator=(const MatrixOp& M); 00150 std::ostream& output(std::ostream& out) const; 00151 00152 protected: 00153 00155 bool Mp_StM( 00156 MatrixOp* mwo_lhs, value_type alpha 00157 , BLAS_Cpp::Transp trans_rhs) const; 00159 bool Mp_StMtP( 00160 MatrixOp* mwo_lhs, value_type alpha 00161 , BLAS_Cpp::Transp M_trans 00162 , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00163 ) const; 00165 bool Mp_StPtM( 00166 MatrixOp* mwo_lhs, value_type alpha 00167 , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00168 , BLAS_Cpp::Transp M_trans 00169 ) const; 00171 bool Mp_StPtMtP( 00172 MatrixOp* mwo_lhs, value_type alpha 00173 ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00174 ,BLAS_Cpp::Transp M_trans 00175 ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans 00176 ) const; 00178 void Vp_StMtV( 00179 VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00180 , const Vector& v_rhs2, value_type beta) const; 00182 void Vp_StMtV( 00183 VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00184 , const SpVectorSlice& sv_rhs2, value_type beta) const; 00186 void Vp_StPtMtV( 00187 VectorMutable* vs_lhs, value_type alpha 00188 , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00189 , BLAS_Cpp::Transp M_rhs2_trans 00190 , const Vector& v_rhs3, value_type beta) const; 00192 void Vp_StPtMtV( 00193 VectorMutable* vs_lhs, value_type alpha 00194 , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00195 , BLAS_Cpp::Transp M_rhs2_trans 00196 , const SpVectorSlice& sv_rhs3, value_type beta) const; 00198 value_type transVtMtV( 00199 const Vector& v_rhs1, BLAS_Cpp::Transp trans_rhs2 00200 , const Vector& v_rhs3) const; 00202 value_type transVtMtV( 00203 const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2 00204 , const SpVectorSlice& sv_rhs3) const; 00206 void syr2k( 00207 BLAS_Cpp::Transp M_trans, value_type alpha 00208 , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans 00209 , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans 00210 , value_type beta, MatrixSymOp* symwo_lhs ) const; 00212 bool Mp_StMtM( 00213 MatrixOp* mwo_lhs, value_type alpha 00214 , BLAS_Cpp::Transp trans_rhs1, const MatrixOp& mwo_rhs2 00215 , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const; 00217 bool Mp_StMtM( 00218 MatrixOp* mwo_lhs, value_type alpha 00219 , const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1 00220 , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const; 00222 bool syrk( 00223 BLAS_Cpp::Transp M_trans, value_type alpha 00224 , value_type beta, MatrixSymOp* sym_lhs ) const; 00225 00227 00228 private: 00229 00230 #ifdef DOXYGEN_COMPILE 00231 MatrixOp *mat_orig; 00232 Permutation *row_perm; 00233 Permutation *col_perm; 00234 MatrixOp *mat_perm; 00235 #else 00236 mat_ptr_t mat_orig_; 00237 perm_ptr_t row_perm_; 00238 perm_ptr_t col_perm_; 00239 mat_ptr_t mat_perm_; 00240 #endif 00241 00242 }; // end class MatrixPermAggr 00243 00244 // //////////////////////////////////// 00245 // Inline members 00246 00247 inline 00248 const MatrixOp::mat_ptr_t& 00249 MatrixPermAggr::mat_orig() const 00250 { 00251 return mat_orig_; 00252 } 00253 00254 inline 00255 const MatrixPermAggr::perm_ptr_t& 00256 MatrixPermAggr::row_perm() const 00257 { 00258 return row_perm_; 00259 } 00260 00261 inline 00262 const MatrixPermAggr::perm_ptr_t& 00263 MatrixPermAggr::col_perm() const 00264 { 00265 return col_perm_; 00266 } 00267 00268 inline 00269 const MatrixOp::mat_ptr_t& MatrixPermAggr::mat_perm() const 00270 { 00271 return mat_perm_; 00272 } 00273 00274 } // end namespace AbstractLinAlgPack 00275 00276 #endif // MATRIX_PERM_AGGR_H
1.7.4