AbstractLinAlgPack_MultiVector.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 ALAP_MULTI_VECTOR_H
00030 #define ALAP_MULTI_VECTOR_H
00031 
00032 #include "AbstractLinAlgPack_MatrixOp.hpp"
00033 #include "RTOpPack_RTOpT.hpp"
00034 #include "Teuchos_RCP.hpp"
00035 
00036 namespace AbstractLinAlgPack {
00037 
00039 enum EApplyBy {
00040   APPLY_BY_ROW        
00041   ,APPLY_BY_COL       
00042 };
00043 
00049 void apply_op(
00050   EApplyBy                        apply_by
00051   ,const RTOpPack::RTOp           &primary_op
00052   ,const size_t                   num_multi_vecs
00053   ,const MultiVector*             multi_vecs[]
00054   ,const size_t                   num_targ_multi_vecs
00055   ,MultiVectorMutable*            targ_multi_vecs[]
00056   ,RTOpPack::ReductTarget*        reduct_objs[]         = NULL
00057   ,const index_type               primary_first_ele     = 1
00058   ,const index_type               primary_sub_dim       = 0
00059   ,const index_type               primary_global_offset = 0
00060   ,const index_type               secondary_first_ele   = 1
00061   ,const index_type               secondary_sub_dim     = 0
00062   );
00063 
00069 void apply_op(
00070   EApplyBy                        apply_by
00071   ,const RTOpPack::RTOp           &primary_op
00072   ,const RTOpPack::RTOp           &secondary_op
00073   ,const size_t                   num_multi_vecs
00074   ,const MultiVector*             multi_vecs[]
00075   ,const size_t                   num_targ_multi_vecs
00076   ,MultiVectorMutable*            targ_multi_vecs[]
00077   ,RTOpPack::ReductTarget         *reduct_obj
00078   ,const index_type               primary_first_ele     = 1
00079   ,const index_type               primary_sub_dim       = 0
00080   ,const index_type               primary_global_offset = 0
00081   ,const index_type               secondary_first_ele   = 1
00082   ,const index_type               secondary_sub_dim     = 0
00083   );
00084 
00157 class MultiVector : virtual public MatrixOp {
00158 public:
00159 
00161   typedef int  access_by_t;
00163   enum {
00164     ROW_ACCESS    = 0x1 
00165     ,COL_ACCESS   = 0x2 
00166     ,DIAG_ACCESS  = 0x4 
00167   };
00169   typedef Teuchos::RCP<const Vector>         vec_ptr_t;
00171   typedef Teuchos::RCP<const MultiVector>    multi_vec_ptr_t;
00172 
00175 
00177   friend
00178   void AbstractLinAlgPack::apply_op(
00179     EApplyBy                        apply_by
00180     ,const RTOpPack::RTOp           &primary_op
00181     ,const size_t                   num_multi_vecs
00182     ,const MultiVector*             multi_vecs[]
00183     ,const size_t                   num_targ_multi_vecs
00184     ,MultiVectorMutable*            targ_multi_vecs[]
00185     ,RTOpPack::ReductTarget*        reduct_objs[]
00186     ,const index_type               primary_first_ele
00187     ,const index_type               primary_sub_dim
00188     ,const index_type               primary_global_offset
00189     ,const index_type               secondary_first_ele
00190     ,const index_type               secondary_sub_dim
00191     );
00193   friend
00194   void AbstractLinAlgPack::apply_op(
00195     EApplyBy                        apply_by
00196     ,const RTOpPack::RTOp           &primary_op
00197     ,const RTOpPack::RTOp           &secondary_op
00198     ,const size_t                   num_multi_vecs
00199     ,const MultiVector*             multi_vecs[]
00200     ,const size_t                   num_targ_multi_vecs
00201     ,MultiVectorMutable*            targ_multi_vecs[]
00202     ,RTOpPack::ReductTarget         *reduct_obj
00203     ,const index_type               primary_first_ele
00204     ,const index_type               primary_sub_dim
00205     ,const index_type               primary_global_offset
00206     ,const index_type               secondary_first_ele
00207     ,const index_type               secondary_sub_dim
00208     );
00209 
00211 
00214 
00219   virtual multi_vec_ptr_t mv_clone() const;
00220 
00222 
00225 
00232   virtual access_by_t access_by() const = 0;
00233 
00241   virtual vec_ptr_t col(index_type j) const = 0;
00249   virtual vec_ptr_t row(index_type i) const = 0;
00256   virtual vec_ptr_t diag(int k) const = 0;
00257 
00259 
00262 
00270   virtual multi_vec_ptr_t mv_sub_view(const Range1D& row_rng, const Range1D& col_rng) const;
00271   
00274   multi_vec_ptr_t mv_sub_view(
00275     const index_type& rl, const index_type& ru
00276     ,const index_type& cl, const index_type& cu
00277     ) const;
00278 
00280 
00281 protected:
00282 
00285 
00299   virtual void apply_op(
00300     EApplyBy apply_by, const RTOpPack::RTOp& primary_op
00301     ,const size_t num_multi_vecs,      const MultiVector*   multi_vecs[]
00302     ,const size_t num_targ_multi_vecs, MultiVectorMutable*  targ_multi_vecs[]
00303     ,RTOpPack::ReductTarget* reduct_objs[]
00304     ,const index_type primary_first_ele,   const index_type primary_sub_dim, const index_type primary_global_offset
00305     ,const index_type secondary_first_ele, const index_type secondary_sub_dim
00306     ) const;
00307 
00321   virtual void apply_op(
00322     EApplyBy apply_by, const RTOpPack::RTOp& primary_op, const RTOpPack::RTOp& secondary_op
00323     ,const size_t num_multi_vecs,      const MultiVector*   multi_vecs[]
00324     ,const size_t num_targ_multi_vecs, MultiVectorMutable*  targ_multi_vecs[]
00325     ,RTOpPack::ReductTarget* reduct_obj
00326     ,const index_type primary_first_ele, const index_type primary_sub_dim, const index_type primary_global_offset
00327     ,const index_type secondary_first_ele, const index_type secondary_sub_dim
00328     ) const;
00329 
00331 
00332 public:
00333 
00336 
00339   mat_ptr_t clone() const;
00340 
00343   mat_ptr_t sub_view(const Range1D& row_rng, const Range1D& col_rng) const;
00344 
00358   bool Mp_StMtM(
00359     MatrixOp* mwo_lhs, value_type alpha
00360     ,const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
00361     ,BLAS_Cpp::Transp trans_rhs2
00362     ,value_type beta
00363     ) const;
00364 
00378   bool Mp_StMtM(
00379     MatrixOp* mwo_lhs, value_type alpha
00380     ,BLAS_Cpp::Transp trans_rhs1
00381     ,const MatrixOp& mwo_rhs2, BLAS_Cpp::Transp trans_rhs2
00382     ,value_type beta
00383     ) const;
00384 
00386 
00387 private:
00388   
00389 #ifdef DOXYGEN_COMPILE
00390   Vector         *rows;
00391   Vector         *columns;
00392   Vector         *diagonals;
00393 #endif  
00394 
00395 }; // end class MultiVector
00396 
00397 // //////////////////////////////////////////////////
00398 // Inlined functions
00399 
00400 inline
00401 MultiVector::multi_vec_ptr_t
00402 MultiVector::mv_sub_view(
00403   const index_type& rl, const index_type& ru
00404   ,const index_type& cl, const index_type& cu
00405   ) const
00406 {
00407   return this->mv_sub_view(Range1D(rl,ru),Range1D(cl,cu));
00408 }
00409 
00410 } // end namespace AbstractLinAlgPack
00411 
00412 #endif // ALAP_MULTI_VECTOR_H

Generated on Tue Jul 13 09:30:50 2010 for MOOCHO (Single Doxygen Collection) by  doxygen 1.4.7