AbstractLinAlgPack_MatrixOpSubView.hpp

Go to the documentation of this file.
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   typedef Teuchos::RCP<MatrixOp>   mat_ptr_t;
00055 
00058 
00061   MatrixOpSubView(
00062     const mat_ptr_t&   M_full    = Teuchos::null
00063     ,const Range1D&    rng_rows  = Range1D()
00064     ,const Range1D&    rng_cols  = Range1D()
00065     ,BLAS_Cpp::Transp   M_trans  = BLAS_Cpp::no_trans
00066     );
00067     
00101   void initialize(
00102     const mat_ptr_t&   M_full
00103     ,const Range1D&    rng_rows  = Range1D()
00104     ,const Range1D&    rng_cols  = Range1D()
00105     ,BLAS_Cpp::Transp  M_trans = BLAS_Cpp::no_trans
00106     );
00107 
00109 
00112 
00114   const mat_ptr_t& M_full_ptr();
00116   MatrixOp& M_full();
00118   const MatrixOp& M_full() const;
00120   Range1D rng_rows() const;
00122   Range1D rng_cols() const;
00124   BLAS_Cpp::Transp M_trans();
00125 
00127 
00130 
00132   size_type rows() const;
00134   size_type cols() const;
00136   size_type nz() const;
00137 
00139 
00142 
00144   const VectorSpace& space_cols() const;
00146   const VectorSpace& space_rows() const;
00148   MatrixOp::mat_ptr_t sub_view(const Range1D& row_rng, const Range1D& col_rng) const;
00150   void zero_out();
00152   void Mt_S( value_type alpha );
00154   MatrixOp& operator=(const MatrixOp& M);
00156   std::ostream& output(std::ostream& out) const;
00158   bool Mp_StM(
00159     MatrixOp* mwo_lhs, value_type alpha
00160     , BLAS_Cpp::Transp trans_rhs) const;
00162   bool Mp_StMtP(
00163     MatrixOp* mwo_lhs, value_type alpha
00164     , BLAS_Cpp::Transp M_trans
00165     , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00166     ) const;
00168   bool Mp_StPtM(
00169     MatrixOp* mwo_lhs, value_type alpha
00170     , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00171     , BLAS_Cpp::Transp M_trans
00172     ) const;
00174   bool Mp_StPtMtP(
00175     MatrixOp* mwo_lhs, value_type alpha
00176     ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00177     ,BLAS_Cpp::Transp M_trans
00178     ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
00179     ) const;
00181   bool Mp_StM(
00182     value_type alpha,const MatrixOp& M_rhs, BLAS_Cpp::Transp trans_rhs);
00184   bool Mp_StMtP(
00185     value_type alpha
00186     ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans
00187     ,const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00188     );
00190   bool Mp_StPtM(
00191     value_type alpha
00192     ,const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00193     ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans
00194     );
00196   bool Mp_StPtMtP(
00197     value_type alpha
00198     ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00199     ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans
00200     ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
00201     );
00203   void Vp_StMtV(
00204     VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00205     , const Vector& v_rhs2, value_type beta) const;
00207   void Vp_StMtV(
00208     VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00209     , const SpVectorSlice& sv_rhs2, value_type beta) const;
00211   void Vp_StPtMtV(
00212     VectorMutable* vs_lhs, value_type alpha
00213     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00214     , BLAS_Cpp::Transp M_rhs2_trans
00215     , const Vector& v_rhs3, value_type beta) const;
00217   void Vp_StPtMtV(
00218     VectorMutable* vs_lhs, value_type alpha
00219     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00220     , BLAS_Cpp::Transp M_rhs2_trans
00221     , const SpVectorSlice& sv_rhs3, value_type beta) const;
00223   value_type transVtMtV(
00224     const Vector& v_rhs1, BLAS_Cpp::Transp trans_rhs2
00225     , const Vector& v_rhs3) const;
00227   value_type transVtMtV(
00228     const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2
00229     , const SpVectorSlice& sv_rhs3) const;
00231   void syr2k(
00232      BLAS_Cpp::Transp M_trans, value_type alpha
00233     , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans
00234     , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans
00235     , value_type beta, MatrixSymOp* symwo_lhs ) const;
00237   bool Mp_StMtM(
00238     MatrixOp* mwo_lhs, value_type alpha
00239     , BLAS_Cpp::Transp trans_rhs1, const MatrixOp& mwo_rhs2
00240     , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const;
00242   bool Mp_StMtM(
00243     MatrixOp* mwo_lhs, value_type alpha
00244     , const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
00245     , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const;
00247   bool Mp_StMtM(
00248     value_type alpha
00249     ,const MatrixOp& mvw_rhs1, BLAS_Cpp::Transp trans_rhs1
00250     ,const MatrixOp& mwo_rhs2,BLAS_Cpp::Transp trans_rhs2
00251     ,value_type beta );
00253   bool syrk(
00254      BLAS_Cpp::Transp M_trans, value_type alpha
00255     , value_type beta, MatrixSymOp* sym_lhs ) const;
00256   
00258 
00259 private:
00260   
00261 #ifdef DOXYGEN_COMPILE  
00262   MatrixOp              *M_full;
00263   Range1D                   rng_rows;
00264   Range1D                   rng_cols;
00265 #else
00266   mat_ptr_t                 M_full_;
00267   Range1D                   rng_rows_;
00268   Range1D                   rng_cols_;
00269   BLAS_Cpp::Transp          M_trans_;
00270   VectorSpace::space_ptr_t  space_cols_;
00271   VectorSpace::space_ptr_t  space_rows_;
00272 #endif
00273 
00274   //
00275   void assert_initialized() const;
00276   
00277 };  // end class MatrixOpSubView
00278 
00279 // //////////////////////////////////
00280 // Inline members
00281 
00282 inline
00283 const MatrixOpSubView::mat_ptr_t&
00284 MatrixOpSubView::M_full_ptr()
00285 {
00286   return M_full_;
00287 }
00288 
00289 inline
00290 MatrixOp& MatrixOpSubView::M_full()
00291 {
00292   return *M_full_;
00293 }
00294 
00295 inline
00296 const MatrixOp& MatrixOpSubView::M_full() const
00297 {
00298   return *M_full_;
00299 }
00300 
00301 inline
00302 Range1D MatrixOpSubView::rng_rows() const
00303 {
00304   return rng_rows_;
00305 }
00306 
00307 inline
00308 Range1D MatrixOpSubView::rng_cols() const
00309 {
00310   return rng_rows_;
00311 }
00312 
00313 inline
00314 BLAS_Cpp::Transp MatrixOpSubView::M_trans()
00315 {
00316   return M_trans_;
00317 }
00318 
00319 } // end namespace AbstractLinAlgPack
00320 
00321 #endif  // ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H

Generated on Wed May 12 21:52:27 2010 for MOOCHO (Single Doxygen Collection) by  doxygen 1.4.7