Class documentation of Concepts

Loading...
Searching...
No Matches
anasaziHelper.hh
Go to the documentation of this file.
1
5#pragma once
6
7#define HAVE_CONFIG_H
8
9#include "AnasaziOperator.hpp"
10#include <AnasaziMultiVec.hpp>
11#include "operator.hh"
12#include <Teuchos_SerialDenseMatrix.hpp>
13
14namespace concepts {
15
16template <class ScalarT>
17class AnasaziOp : public Anasazi::Operator<ScalarT> {
18 public:
20
21
23 AnasaziOp(Teuchos::RCP<Operator<ScalarT> > op)
24 : op(op)
25 { }
26
28 virtual ~AnasaziOp() {};
30
32
33
37 virtual void Apply ( const Anasazi::MultiVec<ScalarT>& x, Anasazi::MultiVec<ScalarT>& y ) const;
38
40
41 const Operator<ScalarT>& getOp() {
42 return *op;
43 }
44
45 private:
46 Teuchos::RCP<Operator<ScalarT> > op;
47
48};
49
50template <class ScalarT>
51class AnasaziMV : public Anasazi::MultiVec<ScalarT> {
52public:
53 static const bool NO_ALLOCATE = false;
54 typedef Vector<ScalarT> VectorT;
55
56 AnasaziMV(int dim = 0, int nvecs = 0, bool allocate = true);
57 virtual ~AnasaziMV();
58
59private:
62
63
64public:
65
69 virtual AnasaziMV<ScalarT>* Clone( const int numvecs ) const;
70
75 virtual AnasaziMV<ScalarT>* CloneCopy() const;
76
82 virtual AnasaziMV<ScalarT>* CloneCopy ( const std::vector<int>& index ) const;
83
89 virtual AnasaziMV<ScalarT>* CloneView ( const std::vector<int>& index );
91
93
94
96 int GetVecLength () const { return dim; }
97
99 virtual int GetNumberVecs () const { return nvecs; }
100
102
104
105
108 virtual void MvTimesMatAddMv ( ScalarT alpha, const Anasazi::MultiVec<ScalarT>& A,
109 const Teuchos::SerialDenseMatrix<int,ScalarT>& B, ScalarT beta );
110
113 virtual void MvAddMv ( ScalarT alpha,const Anasazi::MultiVec<ScalarT>& A,
114 ScalarT beta, const Anasazi::MultiVec<ScalarT>& B );
115
119 virtual void MvTransMv ( ScalarT alpha, const Anasazi::MultiVec<ScalarT>& A,
120 Teuchos::SerialDenseMatrix<int,ScalarT>& B
122 , ConjType conj = Anasazi::CONJ
123#endif
124 ) const;
125
129 virtual void MvDot ( const Anasazi::MultiVec<ScalarT>& A, std::vector<ScalarT> & b
131 , ConjType conj = Anasazi::CONJ
132#endif
133 ) const;
134
136
138
142 virtual void MvNorm (
143 std::vector<typename Teuchos::ScalarTraits<ScalarT>::magnitudeType> & normvec
144 ) const;
145
147
149
150
155 virtual void SetBlock ( const Anasazi::MultiVec<ScalarT>& A, const std::vector<int>& index );
156
159 virtual void MvScale ( ScalarT alpha );
160
163 virtual void MvScale ( const std::vector<ScalarT>& alpha );
164
167 virtual void MvRandom ();
168
171 virtual void MvInit ( ScalarT alpha );
172
174
176
178 virtual void MvPrint ( std::ostream& os ) const;
180
181 VectorT* getVec(int i)
182 {
183 return vecs[i];
184 }
185
186 const VectorT* getVec(int i) const
187 {
188 return vecs[i];
189 }
190
191private:
192 const int dim;
193 int nvecs;
194 VectorT** vecs;
195 bool allocate;
196};
197
198}
virtual void MvScale(const std::vector< ScalarT > &alpha)
Scale each element of the i-th vector in *this with alpha[i].
virtual int GetNumberVecs() const
Obtain the number of vectors in *this.
virtual void MvDot(const Anasazi::MultiVec< ScalarT > &A, std::vector< ScalarT > &b) const
Compute a vector b where the components are the individual dot-products, i.e.b[i] = A[i]^H*this[i] wh...
virtual AnasaziMV< ScalarT > * CloneCopy() const
Creates a new Anasazi::MultiVec and copies contents of *this into the new vector (deep copy).
virtual AnasaziMV< ScalarT > * CloneCopy(const std::vector< int > &index) const
Creates a new Anasazi::MultiVec and copies the selected contents of *this into the new vector (deep c...
virtual void MvTransMv(ScalarT alpha, const Anasazi::MultiVec< ScalarT > &A, Teuchos::SerialDenseMatrix< int, ScalarT > &B) const
Compute a dense matrix B through the matrix-matrix multiply alpha * A^T * (*this).
int GetVecLength() const
Obtain the vector length of *this.
virtual void MvInit(ScalarT alpha)
Replace each element of the vectors in *this with alpha.
virtual AnasaziMV< ScalarT > * CloneView(const std::vector< int > &index)
Creates a new Anasazi::MultiVec that shares the selected contents of *this. The index of the numvecs ...
virtual void MvAddMv(ScalarT alpha, const Anasazi::MultiVec< ScalarT > &A, ScalarT beta, const Anasazi::MultiVec< ScalarT > &B)
Replace *this with alpha * A + beta * B.
virtual void MvTimesMatAddMv(ScalarT alpha, const Anasazi::MultiVec< ScalarT > &A, const Teuchos::SerialDenseMatrix< int, ScalarT > &B, ScalarT beta)
Update *this with alpha * A * B + beta * (*this).
virtual void SetBlock(const Anasazi::MultiVec< ScalarT > &A, const std::vector< int > &index)
Copy the vectors in A to a set of vectors in *this. The numvecs vectors in A are copied to a subset o...
virtual void MvRandom()
Fill the vectors in *this with random numbers.
virtual void MvScale(ScalarT alpha)
Scale each element of the vectors in *this with alpha.
virtual void MvPrint(std::ostream &os) const
Print *this multivector to the os output stream.
virtual void MvNorm(std::vector< typename Teuchos::ScalarTraits< ScalarT >::magnitudeType > &normvec) const
Compute the 2-norm of each individual vector of *this. Upon return, normvec[i] holds the 2-norm of ...
virtual AnasaziMV< ScalarT > * Clone(const int numvecs) const
Creates a new empty Anasazi::MultiVec containing numvecs columns.
virtual void Apply(const Anasazi::MultiVec< ScalarT > &x, Anasazi::MultiVec< ScalarT > &y) const
This method takes the Anasazi::MultiVec x and applies the operator to it resulting in the Anasazi::Mu...
virtual ~AnasaziOp()
Destructor.
AnasaziOp(Teuchos::RCP< Operator< ScalarT > > op)
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320