|
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 ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H 00043 #define ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H 00044 00045 #include <iosfwd> 00046 00047 #include "AbstractLinAlgPack_MatrixOp.hpp" 00048 #include "Teuchos_RCP.hpp" 00049 #include "AbstractLinAlgPack_VectorSpace.hpp" 00050 00051 namespace AbstractLinAlgPack { 00052 00063 class MatrixOpSubView : public virtual MatrixOp { 00064 public: 00065 00067 using MatrixOp::syrk; 00068 00070 typedef Teuchos::RCP<MatrixOp> mat_ptr_t; 00071 00074 00077 MatrixOpSubView( 00078 const mat_ptr_t& M_full = Teuchos::null 00079 ,const Range1D& rng_rows = Range1D() 00080 ,const Range1D& rng_cols = Range1D() 00081 ,BLAS_Cpp::Transp M_trans = BLAS_Cpp::no_trans 00082 ); 00083 00117 void initialize( 00118 const mat_ptr_t& M_full 00119 ,const Range1D& rng_rows = Range1D() 00120 ,const Range1D& rng_cols = Range1D() 00121 ,BLAS_Cpp::Transp M_trans = BLAS_Cpp::no_trans 00122 ); 00123 00125 00128 00130 const mat_ptr_t& M_full_ptr(); 00132 MatrixOp& M_full(); 00134 const MatrixOp& M_full() const; 00136 Range1D rng_rows() const; 00138 Range1D rng_cols() const; 00140 BLAS_Cpp::Transp M_trans(); 00141 00143 00146 00148 size_type rows() const; 00150 size_type cols() const; 00152 size_type nz() const; 00153 00155 00158 00160 const VectorSpace& space_cols() const; 00162 const VectorSpace& space_rows() const; 00164 MatrixOp::mat_ptr_t sub_view(const Range1D& row_rng, const Range1D& col_rng) const; 00166 void zero_out(); 00168 void Mt_S( value_type alpha ); 00170 MatrixOp& operator=(const MatrixOp& M); 00172 std::ostream& output(std::ostream& out) const; 00174 bool Mp_StM( 00175 MatrixOp* mwo_lhs, value_type alpha 00176 , BLAS_Cpp::Transp trans_rhs) const; 00178 bool Mp_StMtP( 00179 MatrixOp* mwo_lhs, value_type alpha 00180 , BLAS_Cpp::Transp M_trans 00181 , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00182 ) const; 00184 bool Mp_StPtM( 00185 MatrixOp* mwo_lhs, value_type alpha 00186 , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00187 , BLAS_Cpp::Transp M_trans 00188 ) const; 00190 bool Mp_StPtMtP( 00191 MatrixOp* mwo_lhs, value_type alpha 00192 ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00193 ,BLAS_Cpp::Transp M_trans 00194 ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans 00195 ) const; 00197 bool Mp_StM( 00198 value_type alpha,const MatrixOp& M_rhs, BLAS_Cpp::Transp trans_rhs); 00200 bool Mp_StMtP( 00201 value_type alpha 00202 ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans 00203 ,const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00204 ); 00206 bool Mp_StPtM( 00207 value_type alpha 00208 ,const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans 00209 ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans 00210 ); 00212 bool Mp_StPtMtP( 00213 value_type alpha 00214 ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00215 ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans 00216 ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans 00217 ); 00219 void Vp_StMtV( 00220 VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00221 , const Vector& v_rhs2, value_type beta) const; 00223 void Vp_StMtV( 00224 VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1 00225 , const SpVectorSlice& sv_rhs2, value_type beta) const; 00227 void Vp_StPtMtV( 00228 VectorMutable* vs_lhs, value_type alpha 00229 , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00230 , BLAS_Cpp::Transp M_rhs2_trans 00231 , const Vector& v_rhs3, value_type beta) const; 00233 void Vp_StPtMtV( 00234 VectorMutable* vs_lhs, value_type alpha 00235 , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans 00236 , BLAS_Cpp::Transp M_rhs2_trans 00237 , const SpVectorSlice& sv_rhs3, value_type beta) const; 00239 value_type transVtMtV( 00240 const Vector& v_rhs1, BLAS_Cpp::Transp trans_rhs2 00241 , const Vector& v_rhs3) const; 00243 value_type transVtMtV( 00244 const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2 00245 , const SpVectorSlice& sv_rhs3) const; 00247 void syr2k( 00248 BLAS_Cpp::Transp M_trans, value_type alpha 00249 , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans 00250 , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans 00251 , value_type beta, MatrixSymOp* symwo_lhs ) const; 00253 bool Mp_StMtM( 00254 MatrixOp* mwo_lhs, value_type alpha 00255 , BLAS_Cpp::Transp trans_rhs1, const MatrixOp& mwo_rhs2 00256 , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const; 00258 bool Mp_StMtM( 00259 MatrixOp* mwo_lhs, value_type alpha 00260 , const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1 00261 , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const; 00263 bool Mp_StMtM( 00264 value_type alpha 00265 ,const MatrixOp& mvw_rhs1, BLAS_Cpp::Transp trans_rhs1 00266 ,const MatrixOp& mwo_rhs2,BLAS_Cpp::Transp trans_rhs2 00267 ,value_type beta ); 00269 bool syrk( 00270 BLAS_Cpp::Transp M_trans, value_type alpha 00271 , value_type beta, MatrixSymOp* sym_lhs ) const; 00272 00274 00275 private: 00276 00277 #ifdef DOXYGEN_COMPILE 00278 MatrixOp *M_full; 00279 Range1D rng_rows; 00280 Range1D rng_cols; 00281 #else 00282 mat_ptr_t M_full_; 00283 Range1D rng_rows_; 00284 Range1D rng_cols_; 00285 BLAS_Cpp::Transp M_trans_; 00286 VectorSpace::space_ptr_t space_cols_; 00287 VectorSpace::space_ptr_t space_rows_; 00288 #endif 00289 00290 // 00291 void assert_initialized() const; 00292 00293 }; // end class MatrixOpSubView 00294 00295 // ////////////////////////////////// 00296 // Inline members 00297 00298 inline 00299 const MatrixOpSubView::mat_ptr_t& 00300 MatrixOpSubView::M_full_ptr() 00301 { 00302 return M_full_; 00303 } 00304 00305 inline 00306 MatrixOp& MatrixOpSubView::M_full() 00307 { 00308 return *M_full_; 00309 } 00310 00311 inline 00312 const MatrixOp& MatrixOpSubView::M_full() const 00313 { 00314 return *M_full_; 00315 } 00316 00317 inline 00318 Range1D MatrixOpSubView::rng_rows() const 00319 { 00320 return rng_rows_; 00321 } 00322 00323 inline 00324 Range1D MatrixOpSubView::rng_cols() const 00325 { 00326 return rng_rows_; 00327 } 00328 00329 inline 00330 BLAS_Cpp::Transp MatrixOpSubView::M_trans() 00331 { 00332 return M_trans_; 00333 } 00334 00335 } // end namespace AbstractLinAlgPack 00336 00337 #endif // ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H
1.7.6.1