00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00033 #ifndef ANASAZI_MULTI_VEC_HPP
00034 #define ANASAZI_MULTI_VEC_HPP
00035
00036 #include "AnasaziConfigDefs.hpp"
00037 #include "AnasaziMultiVecTraits.hpp"
00038
00039 namespace Anasazi {
00040
00041
00052 template <class ScalarType>
00053 class MultiVec {
00054 public:
00055
00057
00058
00059 MultiVec() {};
00060
00062 virtual ~MultiVec () {};
00063
00065
00066
00067
00073 virtual MultiVec<ScalarType> * Clone ( const int numvecs ) const = 0;
00074
00081 virtual MultiVec<ScalarType> * CloneCopy () const = 0;
00082
00090 virtual MultiVec<ScalarType> * CloneCopy ( const std::vector<int>& index ) const = 0;
00091
00099 virtual MultiVec<ScalarType> * CloneView ( const std::vector<int>& index ) = 0;
00101
00103
00104
00105
00106 virtual int GetVecLength () const = 0;
00107
00109
00110 virtual int GetNumberVecs () const = 0;
00111
00113
00114
00115
00118 virtual void MvTimesMatAddMv ( ScalarType alpha, const MultiVec<ScalarType>& A,
00119 const Teuchos::SerialDenseMatrix<int,ScalarType>& B, ScalarType beta ) = 0;
00120
00124 virtual void MvAddMv ( ScalarType alpha, const MultiVec<ScalarType>& A, ScalarType beta, const MultiVec<ScalarType>& B ) = 0;
00125
00130 virtual void MvTransMv ( ScalarType alpha, const MultiVec<ScalarType>& A, Teuchos::SerialDenseMatrix<int,ScalarType>& B
00131 #ifdef HAVE_ANASAZI_EXPERIMENTAL
00132 , ConjType conj = Anasazi::CONJ
00133 #endif
00134 ) const = 0;
00135
00139 virtual void MvDot ( const MultiVec<ScalarType>& A, std::vector<ScalarType> & b
00140 #ifdef HAVE_ANASAZI_EXPERIMENTAL
00141 , ConjType conj = Anasazi::CONJ
00142 #endif
00143 ) const = 0;
00144
00146
00147
00148
00153 virtual void MvNorm ( std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> & normvec ) const = 0;
00154
00156
00157
00158
00163 virtual void SetBlock ( const MultiVec<ScalarType>& A, const std::vector<int>& index ) = 0;
00164
00168 virtual void MvScale ( ScalarType alpha ) = 0;
00169
00173 virtual void MvScale ( const std::vector<ScalarType>& alpha ) = 0;
00174
00178 virtual void MvRandom () = 0;
00179
00183 virtual void MvInit ( ScalarType alpha ) = 0;
00184
00186
00187
00188
00190 virtual void MvPrint ( std::ostream& os ) const = 0;
00192
00193 };
00194
00195
00197
00198
00199
00201
00210 template<class ScalarType>
00211 class MultiVecTraits<ScalarType,MultiVec<ScalarType> >
00212 {
00213 public:
00214
00216
00217
00222 static Teuchos::RCP<MultiVec<ScalarType> > Clone( const MultiVec<ScalarType>& mv, const int numvecs )
00223 { return Teuchos::rcp( const_cast<MultiVec<ScalarType>&>(mv).Clone(numvecs) ); }
00224
00229 static Teuchos::RCP<MultiVec<ScalarType> > CloneCopy( const MultiVec<ScalarType>& mv )
00230 { return Teuchos::rcp( const_cast<MultiVec<ScalarType>&>(mv).CloneCopy() ); }
00231
00237 static Teuchos::RCP<MultiVec<ScalarType> > CloneCopy( const MultiVec<ScalarType>& mv, const std::vector<int>& index )
00238 { return Teuchos::rcp( const_cast<MultiVec<ScalarType>&>(mv).CloneCopy(index) ); }
00239
00245 static Teuchos::RCP<MultiVec<ScalarType> > CloneView( MultiVec<ScalarType>& mv, const std::vector<int>& index )
00246 { return Teuchos::rcp( mv.CloneView(index) ); }
00247
00253 static Teuchos::RCP<const MultiVec<ScalarType> > CloneView( const MultiVec<ScalarType>& mv, const std::vector<int>& index )
00254 { return Teuchos::rcp( const_cast<MultiVec<ScalarType>&>(mv).CloneView(index) ); }
00255
00257
00259
00260
00262 static int GetVecLength( const MultiVec<ScalarType>& mv )
00263 { return mv.GetVecLength(); }
00264
00266 static int GetNumberVecs( const MultiVec<ScalarType>& mv )
00267 { return mv.GetNumberVecs(); }
00268
00270
00272
00273
00276 static void MvTimesMatAddMv( ScalarType alpha, const MultiVec<ScalarType>& A,
00277 const Teuchos::SerialDenseMatrix<int,ScalarType>& B,
00278 ScalarType beta, MultiVec<ScalarType>& mv )
00279 { mv.MvTimesMatAddMv(alpha, A, B, beta); }
00280
00283 static void MvAddMv( ScalarType alpha, const MultiVec<ScalarType>& A, ScalarType beta, const MultiVec<ScalarType>& B, MultiVec<ScalarType>& mv )
00284 { mv.MvAddMv(alpha, A, beta, B); }
00285
00288 static void MvTransMv( ScalarType alpha, const MultiVec<ScalarType>& A, const MultiVec<ScalarType>& mv, Teuchos::SerialDenseMatrix<int,ScalarType>& B
00289 #ifdef HAVE_ANASAZI_EXPERIMENTAL
00290 , ConjType conj = Anasazi::CONJ
00291 #endif
00292 )
00293 { mv.MvTransMv(alpha, A, B
00294 #ifdef HAVE_ANASAZI_EXPERIMENTAL
00295 , conj
00296 #endif
00297 ); }
00298
00301 static void MvDot( const MultiVec<ScalarType>& mv, const MultiVec<ScalarType>& A, std::vector<ScalarType> & b
00302 #ifdef HAVE_ANASAZI_EXPERIMENTAL
00303 , ConjType conj = Anasazi::CONJ
00304 #endif
00305 )
00306 { mv.MvDot( A, b
00307 #ifdef HAVE_ANASAZI_EXPERIMENTAL
00308 , conj
00309 #endif
00310 ); }
00311
00314 static void MvScale ( MultiVec<ScalarType>& mv, ScalarType alpha )
00315 { mv.MvScale( alpha ); }
00316
00319 static void MvScale ( MultiVec<ScalarType>& mv, const std::vector<ScalarType>& alpha )
00320 { mv.MvScale( alpha ); }
00321
00323
00324
00325
00329 static void MvNorm( const MultiVec<ScalarType>& mv, std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> & normvec )
00330 { mv.MvNorm(normvec); }
00331
00333
00334
00335
00340 static void SetBlock( const MultiVec<ScalarType>& A, const std::vector<int>& index, MultiVec<ScalarType>& mv )
00341 { mv.SetBlock(A, index); }
00342
00345 static void MvRandom( MultiVec<ScalarType>& mv )
00346 { mv.MvRandom(); }
00347
00350 static void MvInit( MultiVec<ScalarType>& mv, ScalarType alpha = Teuchos::ScalarTraits<ScalarType>::zero() )
00351 { mv.MvInit(alpha); }
00352
00354
00356
00357
00360 static void MvPrint( const MultiVec<ScalarType>& mv, std::ostream& os )
00361 { mv.MvPrint(os); }
00362
00364 };
00365
00366
00367 }
00368
00369 #endif
00370
00371