AbstractLinAlgPack_MatrixOpSerial.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 // 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 SPARSE_LINALG_PACK_MATRIX_WITH_OP_SERIAL_H
00030 #define SPARSE_LINALG_PACK_MATRIX_WITH_OP_SERIAL_H
00031 
00032 #include <iosfwd>
00033 
00034 #include "AbstractLinAlgPack_Types.hpp"
00035 #include "AbstractLinAlgPack_MatrixOp.hpp"
00036 #include "AbstractLinAlgPack_VectorSpaceSerial.hpp"
00037 
00038 namespace AbstractLinAlgPack {
00039 
00064 class MatrixOpSerial
00065   : virtual public AbstractLinAlgPack::MatrixOp // doxygen needs full name
00066 {
00067 public:
00068 
00070   using MatrixOp::Mp_StM;
00072   using MatrixOp::Mp_StMtP;
00074   using MatrixOp::Mp_StPtM;
00076   using MatrixOp::Mp_StPtMtP;
00078   using MatrixOp::Vp_StMtV;
00080   using MatrixOp::Mp_StMtM;
00081 
00084 
00086   virtual void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha
00087     , BLAS_Cpp::Transp trans_rhs) const;
00088 
00090   virtual void Mp_StMtP(DMatrixSlice* gms_lhs, value_type alpha
00091     , BLAS_Cpp::Transp M_trans
00092     , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00093     ) const;
00094 
00096   virtual void Mp_StPtM(DMatrixSlice* gms_lhs, value_type alpha
00097     , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00098     , BLAS_Cpp::Transp M_trans
00099     ) const;
00100 
00102   virtual void Mp_StPtMtP(DMatrixSlice* gms_lhs, value_type alpha
00103     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00104     , BLAS_Cpp::Transp M_trans
00105     , const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
00106     ) const;
00107 
00109 
00112 
00114   virtual void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00115     , const DVectorSlice& vs_rhs2, value_type beta) const = 0;
00116 
00118   virtual void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00119     , const SpVectorSlice& sv_rhs2, value_type beta) const;
00120 
00122   virtual void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha
00123     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00124     , BLAS_Cpp::Transp M_rhs2_trans
00125     , const DVectorSlice& vs_rhs3, value_type beta) const;
00126 
00128   virtual void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha
00129     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00130     , BLAS_Cpp::Transp M_rhs2_trans
00131     , const SpVectorSlice& sv_rhs3, value_type beta) const;
00132 
00134   virtual value_type transVtMtV(const DVectorSlice& vs_rhs1, BLAS_Cpp::Transp trans_rhs2
00135     , const DVectorSlice& vs_rhs3) const;
00136 
00148   virtual void syr2k(
00149      BLAS_Cpp::Transp M_trans, value_type alpha
00150     , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans
00151     , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans
00152     , value_type beta, DMatrixSliceSym* sym_lhs ) const;
00153 
00155 
00158 
00160   virtual void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha
00161     , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2
00162     , BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
00163 
00165   virtual void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1
00166     , BLAS_Cpp::Transp trans_rhs1, BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
00167 
00169   virtual void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha
00170     , BLAS_Cpp::Transp trans_rhs1, const MatrixOpSerial& mwo_rhs2
00171     , BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
00172 
00174   virtual void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha
00175     , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceSym& sym_rhs2
00176     , BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
00177 
00179   virtual void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceSym& sym_rhs1
00180     , BLAS_Cpp::Transp trans_rhs1, BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
00181 
00183   virtual void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha
00184     , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2
00185     , BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
00186 
00188   virtual void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1
00189     , BLAS_Cpp::Transp trans_rhs1, BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
00190 
00191 
00200   virtual void syrk(
00201      BLAS_Cpp::Transp M_trans, value_type alpha
00202     , value_type beta, DMatrixSliceSym* sym_lhs ) const;
00203 
00205 
00208 
00210   const VectorSpace& space_cols() const;
00212   const VectorSpace& space_rows() const;
00214   std::ostream& output(std::ostream& out) const;
00216   bool Mp_StM(
00217     MatrixOp* mwo_lhs, value_type alpha
00218     ,BLAS_Cpp::Transp trans_rhs
00219     ) const;
00221   bool Mp_StMtP(
00222     MatrixOp* mwo_lhs, value_type alpha
00223     , BLAS_Cpp::Transp M_trans
00224     , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00225     ) const;
00227   bool Mp_StPtM(
00228     MatrixOp* mwo_lhs, value_type alpha
00229     , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00230     , BLAS_Cpp::Transp M_trans
00231     ) const;
00233   bool Mp_StPtMtP(
00234     MatrixOp* mwo_lhs, value_type alpha
00235     ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00236     ,BLAS_Cpp::Transp M_trans
00237     ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
00238     ) const;
00240   void Vp_StMtV(
00241     VectorMutable* v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00242     , const Vector& v_rhs2, value_type beta) const;
00244   void Vp_StMtV(
00245     VectorMutable* v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
00246     , const SpVectorSlice& sv_rhs2, value_type beta) const;
00248   void Vp_StPtMtV(
00249     VectorMutable* v_lhs, value_type alpha
00250     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00251     , BLAS_Cpp::Transp M_rhs2_trans
00252     , const Vector& v_rhs3, value_type beta) const;
00254   void Vp_StPtMtV(
00255     VectorMutable* v_lhs, value_type alpha
00256     , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00257     , BLAS_Cpp::Transp M_rhs2_trans
00258     , const SpVectorSlice& sv_rhs3, value_type beta) const;
00260   value_type transVtMtV(
00261     const Vector& v_rhs1, BLAS_Cpp::Transp trans_rhs2
00262     , const Vector& v_rhs3) const;
00264   value_type transVtMtV(
00265     const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2
00266     , const SpVectorSlice& sv_rhs3) const;
00268   void syr2k(
00269      BLAS_Cpp::Transp M_trans, value_type alpha
00270     , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans
00271     , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans
00272     , value_type beta, MatrixSymOp* symwo_lhs ) const;
00274   bool Mp_StMtM(
00275     MatrixOp* mwo_lhs, value_type alpha
00276     ,BLAS_Cpp::Transp trans_rhs1
00277     ,const MatrixOp& mwo_rhs2, BLAS_Cpp::Transp trans_rhs2
00278     ,value_type beta ) const;
00280   bool syrk(
00281     BLAS_Cpp::Transp M_trans, value_type alpha
00282     ,value_type beta, MatrixSymOp* sym_lhs ) const;
00283 
00285 
00286 private:
00287 
00288   // ////////////////////////////////////
00289   // Private data members
00290 
00291   mutable VectorSpaceSerial       space_cols_;
00292   mutable VectorSpaceSerial       space_rows_;
00293 
00294   // ////////////////////////////////////
00295   // Private member functions
00296 
00297 };  // end class MatrixOpSerial
00298 
00305 
00308 
00310 inline void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, const MatrixOpSerial& M_rhs
00311   , BLAS_Cpp::Transp trans_rhs)
00312 {
00313   M_rhs.Mp_StM(gms_lhs,alpha,trans_rhs);
00314 }
00315 
00317 inline void Mp_StMtP(DMatrixSlice* gms_lhs, value_type alpha
00318   , const MatrixOpSerial& M_rhs, BLAS_Cpp::Transp M_trans
00319   , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00320   )
00321 {
00322   M_rhs.Mp_StMtP(gms_lhs,alpha,M_trans,P_rhs,P_rhs_trans);
00323 }
00324 
00326 inline void Mp_StPtM(DMatrixSlice* gms_lhs, value_type alpha
00327   , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
00328   , const MatrixOpSerial& M_rhs, BLAS_Cpp::Transp M_trans
00329   )
00330 {
00331   M_rhs.Mp_StPtM(gms_lhs,alpha,P_rhs,P_rhs_trans,M_trans);
00332 }
00333 
00335 inline void Mp_StPtMtP(DMatrixSlice* gms_lhs, value_type alpha
00336   , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00337   , const MatrixOpSerial& M_rhs, BLAS_Cpp::Transp trans_rhs
00338   , const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
00339   )
00340 {
00341   M_rhs.Mp_StPtMtP(gms_lhs,alpha,P_rhs1,P_rhs1_trans,trans_rhs,P_rhs2,P_rhs2_trans);
00342 }
00343 
00345 
00348 
00350 inline void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, const MatrixOpSerial& M_rhs1
00351   , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta = 1.0)
00352 {
00353   M_rhs1.Vp_StMtV(vs_lhs,alpha,trans_rhs1,vs_rhs2,beta);
00354 }
00355 
00357 inline void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, const MatrixOpSerial& M_rhs1
00358   , BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice& sv_rhs2, value_type beta = 1.0)
00359 {
00360   M_rhs1.Vp_StMtV(vs_lhs,alpha,trans_rhs1,sv_rhs2,beta);
00361 }
00362 
00364 inline void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha
00365   , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00366   , const MatrixOpSerial& M_rhs2, BLAS_Cpp::Transp M_rhs2_trans
00367   , const DVectorSlice& vs_rhs3, value_type beta = 1.0) 
00368 {
00369   M_rhs2.Vp_StPtMtV(vs_lhs,alpha,P_rhs1,P_rhs1_trans,M_rhs2_trans,vs_rhs3,beta);
00370 }
00371 
00373 inline void Vp_StPtMtV(DVectorSlice* vs_lhs, value_type alpha
00374   , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
00375   , const MatrixOpSerial& M_rhs2, BLAS_Cpp::Transp M_rhs2_trans
00376   , const SpVectorSlice& sv_rhs3, value_type beta = 1.0)
00377 {
00378   M_rhs2.Vp_StPtMtV(vs_lhs,alpha,P_rhs1,P_rhs1_trans,M_rhs2_trans,sv_rhs3,beta);
00379 }
00380 
00382 inline value_type transVtMtV(const DVectorSlice& vs_rhs1, const MatrixOpSerial& M_rhs2
00383   , BLAS_Cpp::Transp trans_rhs2, const DVectorSlice& vs_rhs3)
00384 {
00385   return M_rhs2.transVtMtV(vs_rhs1,trans_rhs2,vs_rhs3);
00386 }
00387 
00389 inline value_type transVtMtV(const SpVectorSlice& sv_rhs1, const MatrixOpSerial& M_rhs2
00390   , BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice& sv_rhs3)
00391 {
00392   return M_rhs2.transVtMtV(sv_rhs1,trans_rhs2,sv_rhs3);
00393 }
00394 
00396 
00399 
00401 inline void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const MatrixOpSerial& M_rhs1
00402   , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2
00403   , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0)
00404 {
00405   M_rhs1.Mp_StMtM(gms_lhs,alpha,trans_rhs1,gms_rhs2,trans_rhs2,beta);
00406 }
00407 
00409 inline void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1
00410   , BLAS_Cpp::Transp trans_rhs1, const MatrixOpSerial& M_rhs2, BLAS_Cpp::Transp trans_rhs2
00411   , value_type beta = 1.0)
00412 {
00413   M_rhs2.Mp_StMtM(gms_lhs,alpha,gms_rhs1,trans_rhs1,trans_rhs2,beta);
00414 }
00415 
00417 inline void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const MatrixOpSerial& mwo_rhs1
00418   , BLAS_Cpp::Transp trans_rhs1, const MatrixOpSerial& gms_rhs2
00419   , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0)
00420 {
00421   mwo_rhs1.Mp_StMtM(gms_lhs,alpha,trans_rhs1,gms_rhs2,trans_rhs2,beta);
00422 }
00423 
00425 inline void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const MatrixOpSerial& M_rhs1
00426   , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceSym& sym_rhs2
00427   , BLAS_Cpp::Transp trans_rhs2, value_type beta = 1.0)
00428 {
00429   M_rhs1.Mp_StMtM(gms_lhs,alpha,trans_rhs1,sym_rhs2,trans_rhs2,beta);
00430 }
00431 
00433 inline void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceSym& sym_rhs1
00434   , BLAS_Cpp::Transp trans_rhs1, const MatrixOpSerial& M_rhs2, BLAS_Cpp::Transp trans_rhs2
00435   , value_type beta = 1.0)
00436 {
00437   M_rhs2.Mp_StMtM(gms_lhs,alpha,sym_rhs1,trans_rhs1,trans_rhs2,beta);
00438 }
00439 
00441 inline void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const MatrixOpSerial& M_rhs1
00442   , BLAS_Cpp::Transp trans_rhs1, const DMatrixSliceTri& tri_rhs2, BLAS_Cpp::Transp trans_rhs2
00443   , value_type beta = 1.0)
00444 {
00445   M_rhs1.Mp_StMtM(gms_lhs,alpha,trans_rhs1,tri_rhs2,trans_rhs2,beta);
00446 }
00447 
00449 inline void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSliceTri& tri_rhs1
00450   , BLAS_Cpp::Transp trans_rhs1, const MatrixOpSerial& M_rhs2, BLAS_Cpp::Transp trans_rhs2
00451   , value_type beta = 1.0)
00452 {
00453   M_rhs2.Mp_StMtM(gms_lhs,alpha,tri_rhs1,trans_rhs1,trans_rhs2,beta);
00454 }
00455 
00457 
00459 
00460 } // end namespace AbstractLinAlgPack 
00461 
00462 #endif  // SPARSE_LINALG_PACK_MATRIX_WITH_OP_SERIAL_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Generated on Wed Apr 13 10:09:15 2011 for AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects by  doxygen 1.6.3