AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects Version of the Day
AbstractLinAlgPack_MatrixPermAggr.hpp
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 MATRIX_PERM_AGGR_H
00043 #define MATRIX_PERM_AGGR_H
00044 
00045 #include "AbstractLinAlgPack_MatrixOp.hpp"
00046 
00047 namespace AbstractLinAlgPack {
00048 
00054 class MatrixPermAggr
00055   : virtual public MatrixOp
00056 {
00057 public:
00058 
00061 
00063   typedef Teuchos::RCP<const Permutation>   perm_ptr_t;
00064 
00066 
00069 
00071   MatrixPermAggr();
00072 
00075   MatrixPermAggr(
00076     const mat_ptr_t      &mat_orig
00077     ,const perm_ptr_t    &row_perm
00078     ,const perm_ptr_t    &col_perm
00079     ,const mat_ptr_t     &mat_perm
00080     );
00081 
00110   void initialize(
00111     const mat_ptr_t      &mat_orig
00112     ,const perm_ptr_t    &row_perm
00113     ,const perm_ptr_t    &col_perm
00114     ,const mat_ptr_t     &mat_perm
00115     );
00116 
00121   void set_uninitialized();
00122 
00124   
00127 
00129   const mat_ptr_t& mat_orig() const;
00131   const perm_ptr_t& row_perm() const;
00133   const perm_ptr_t& col_perm() const;
00135   const mat_ptr_t& mat_perm() const;
00136 
00138 
00141 
00143   size_type rows() const;
00145   size_type cols() const;
00147   size_type nz() const;
00148 
00150 
00153 
00155   const VectorSpace& space_cols() const;
00157   const VectorSpace& space_rows() const;
00159   MatrixOp::mat_ptr_t sub_view(const Range1D& row_rng, const Range1D& col_rng) const;
00161   MatrixOp& operator=(const MatrixOp& M);
00163   std::ostream& output(std::ostream& out) const;
00164 
00165 protected:
00166 
00168   bool Mp_StM(
00169     MatrixOp* mwo_lhs, value_type alpha
00170     , BLAS_Cpp::Transp trans_rhs) const;
00172   bool Mp_StMtP(
00173     MatrixOp* mwo_lhs, value_type alpha
00174     , BLAS_Cpp::Transp M_trans
00175     , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00176     ) const;
00178   bool Mp_StPtM(
00179     MatrixOp* mwo_lhs, value_type alpha
00180     , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00181     , BLAS_Cpp::Transp M_trans
00182     ) const;
00184   bool Mp_StPtMtP(
00185     MatrixOp* mwo_lhs, value_type alpha
00186     ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00187     ,BLAS_Cpp::Transp M_trans
00188     ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
00189     ) const;
00191   void Vp_StMtV(
00192     VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00193     , const Vector& v_rhs2, value_type beta) const;
00195   void Vp_StMtV(
00196     VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00197     , const SpVectorSlice& sv_rhs2, value_type beta) const;
00199   void Vp_StPtMtV(
00200     VectorMutable* vs_lhs, value_type alpha
00201     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00202     , BLAS_Cpp::Transp M_rhs2_trans
00203     , const Vector& v_rhs3, value_type beta) const;
00205   void Vp_StPtMtV(
00206     VectorMutable* vs_lhs, value_type alpha
00207     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00208     , BLAS_Cpp::Transp M_rhs2_trans
00209     , const SpVectorSlice& sv_rhs3, value_type beta) const;
00211   value_type transVtMtV(
00212     const Vector& v_rhs1, BLAS_Cpp::Transp trans_rhs2
00213     , const Vector& v_rhs3) const;
00215   value_type transVtMtV(
00216     const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2
00217     , const SpVectorSlice& sv_rhs3) const;
00219   void syr2k(
00220      BLAS_Cpp::Transp M_trans, value_type alpha
00221     , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans
00222     , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans
00223     , value_type beta, MatrixSymOp* symwo_lhs ) const;
00225   bool Mp_StMtM(
00226     MatrixOp* mwo_lhs, value_type alpha
00227     , BLAS_Cpp::Transp trans_rhs1, const MatrixOp& mwo_rhs2
00228     , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const;
00230   bool Mp_StMtM(
00231     MatrixOp* mwo_lhs, value_type alpha
00232     , const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
00233     , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const;
00235   bool syrk(
00236      BLAS_Cpp::Transp M_trans, value_type alpha
00237     , value_type beta, MatrixSymOp* sym_lhs ) const;
00238   
00240 
00241 private:
00242 
00243 #ifdef DOXYGEN_COMPILE
00244   MatrixOp         *mat_orig;
00245   Permutation          *row_perm;
00246   Permutation          *col_perm;
00247   MatrixOp         *mat_perm;
00248 #else
00249   mat_ptr_t            mat_orig_;
00250   perm_ptr_t           row_perm_;
00251   perm_ptr_t           col_perm_;
00252   mat_ptr_t            mat_perm_;
00253 #endif
00254 
00255 }; // end class MatrixPermAggr
00256 
00257 // ////////////////////////////////////
00258 // Inline members
00259 
00260 inline
00261 const MatrixOp::mat_ptr_t&
00262 MatrixPermAggr::mat_orig() const
00263 {
00264   return mat_orig_;
00265 }
00266 
00267 inline
00268 const MatrixPermAggr::perm_ptr_t&
00269 MatrixPermAggr::row_perm() const
00270 {
00271   return row_perm_;
00272 }
00273 
00274 inline
00275 const MatrixPermAggr::perm_ptr_t&
00276 MatrixPermAggr::col_perm() const
00277 {
00278   return col_perm_;
00279 }
00280 
00281 inline
00282 const MatrixOp::mat_ptr_t& MatrixPermAggr::mat_perm() const
00283 {
00284   return mat_perm_;
00285 }
00286 
00287 } // end namespace AbstractLinAlgPack
00288 
00289 #endif // MATRIX_PERM_AGGR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends