MyMultiVec.hpp
1 #ifndef SELDON_FILE_MY_MULTIVEC_HPP
2 #define SELDON_FILE_MY_MULTIVEC_HPP
3 
4 namespace Anasazi
5 {
6 
8 
18  template <class ScalarType>
19  class MyMultiVec : public Anasazi::MultiVec<ScalarType>
20  {
21  public:
22 
23 
24  MyMultiVec(const int Length, const int NumberVecs);
25  MyMultiVec(const int Length, const std::vector<ScalarType*>& rhs);
26  MyMultiVec(const MyMultiVec& rhs);
27 
28  ~MyMultiVec();
29 
30  MyMultiVec<ScalarType>* Clone(const int NumberVecs) const;
31  MyMultiVec<ScalarType>* CloneCopy() const;
32  MyMultiVec<ScalarType>* CloneCopy(const std::vector< int > &index) const;
33  MyMultiVec<ScalarType>* CloneViewNonConst(const std::vector< int > &index);
34  const MyMultiVec<ScalarType>* CloneView(const std::vector< int > &index) const;
35 
36  int GetVecLength () const;
37  int GetNumberVecs () const;
38  ptrdiff_t GetGlobalLength () const;
39 
40  void MvTimesMatAddMv (ScalarType alpha, const Anasazi::MultiVec<ScalarType> &A,
41  const Teuchos::SerialDenseMatrix<int, ScalarType> &B,
42  ScalarType beta);
43 
44  void MvAddMv (ScalarType alpha, const Anasazi::MultiVec<ScalarType>& A,
45  ScalarType beta, const Anasazi::MultiVec<ScalarType>& B);
46 
47  void MvTransMv (ScalarType alpha, const Anasazi::MultiVec<ScalarType>& A,
48  Teuchos::SerialDenseMatrix< int, ScalarType >& B
49 #ifdef HAVE_ANASAZI_EXPERIMENTAL
50  , Anasazi::ConjType conj
51 #endif
52  ) const;
53 
54  void MvDot (const Anasazi::MultiVec<ScalarType>& A, std::vector<ScalarType> &b
55 #ifdef HAVE_ANASAZI_EXPERIMENTAL
56  , Anasazi::ConjType conj
57 #endif
58  ) const;
59 
60  void MvNorm ( std::vector<typename Teuchos::
61  ScalarTraits<ScalarType>::magnitudeType> &normvec ) const;
62 
63  void SetBlock (const Anasazi::MultiVec<ScalarType>& A,
64  const std::vector<int> &index);
65 
66  void MvScale( ScalarType alpha );
67 
68  void MvScale( const std::vector<ScalarType>& alpha );
69 
70  void MvRandom ();
71  void MvInit (ScalarType alpha);
72  void MvPrint (std::ostream &os) const;
73 
74  ScalarType& operator()(const int i, const int j);
75  const ScalarType& operator()(const int i, const int j) const;
76  ScalarType* operator[](int v);
77  ScalarType* operator[](int v) const;
78 
79  private:
80  void Check();
81 
83  const int Length_;
85  const int NumberVecs_;
87  std::vector<ScalarType*> data_;
89  std::vector<bool> ownership_;
90 
91  };
92 
93  template <typename ScalarType>
94  std::ostream& operator<<(std::ostream& os, const MyMultiVec<ScalarType>& Obj);
95 
96 
97 }
98 
99 #endif // MY_MULTIVECTOR_HPP
Anasazi::MyMultiVec::CloneViewNonConst
MyMultiVec< ScalarType > * CloneViewNonConst(const std::vector< int > &index)
Returns a view of current vector (shallow copy)
Definition: MyMultiVec.cpp:184
Anasazi::MyMultiVec
Simple example of a user's defined Anasazi::MultiVec class.
Definition: MyMultiVec.hpp:19
Anasazi::MyMultiVec::CloneView
const MyMultiVec< ScalarType > * CloneView(const std::vector< int > &index) const
Returns a view of current vector (shallow copy), const version.
Definition: MyMultiVec.cpp:199
Anasazi::MyMultiVec::~MyMultiVec
~MyMultiVec()
Destructor.
Definition: MyMultiVec.cpp:135
Anasazi::MyMultiVec::MyMultiVec
MyMultiVec(const int Length, const int NumberVecs)
Constructor for a NumberVecs vectors of length Length.
Definition: MyMultiVec.cpp:65
Anasazi::MyMultiVec::Clone
MyMultiVec< ScalarType > * Clone(const int NumberVecs) const
Returns a clone of the current vector.
Definition: MyMultiVec.cpp:145