42 #ifndef ANASAZI_MULTI_VEC_HPP
43 #define ANASAZI_MULTI_VEC_HPP
89 template <
class ScalarType>
160 virtual void MvScale ( ScalarType alpha ) = 0;
163 virtual void MvScale (
const std::vector<ScalarType>& alpha ) = 0;
169 #ifdef HAVE_ANASAZI_EXPERIMENTAL
180 #ifdef HAVE_ANASAZI_EXPERIMENTAL
209 virtual void MvInit ( ScalarType alpha ) = 0;
216 virtual void MvPrint ( std::ostream& os )
const = 0;
219 #ifdef HAVE_ANASAZI_TSQR
248 const bool forceNonnegativeDiagonal=
false)
252 "are using does not implement the TSQR-related method factorExplicit().");
295 "are using does not implement the TSQR-related method revealRank().");
299 #endif // HAVE_ANASAZI_TSQR
320 template<
class ScalarType>
324 typedef ScalarType scalar_type;
325 typedef int ordinal_type;
326 typedef int node_type;
335 const bool forceNonnegativeDiagonal=
false)
337 A.factorExplicit (Q, R, forceNonnegativeDiagonal);
344 const magnitude_type& tol)
346 return Q.revealRank (R, tol);
360 template<
class ScalarType>
432 { mv.
MvAddMv(alpha, A, beta, B); }
437 #ifdef HAVE_ANASAZI_EXPERIMENTAL
442 #ifdef HAVE_ANASAZI_EXPERIMENTAL
450 #ifdef HAVE_ANASAZI_EXPERIMENTAL
455 #ifdef HAVE_ANASAZI_EXPERIMENTAL
509 #ifdef HAVE_ANASAZI_TSQR
518 #endif // HAVE_ANASAZI_TSQR
virtual void MvRandom()=0
Fill all the vectors in *this with random numbers.
static void MvScale(MultiVec< ScalarType > &mv, ScalarType alpha)
Scale each element of the vectors in *this with alpha.
static void MvPrint(const MultiVec< ScalarType > &mv, std::ostream &os)
Print the mv multi-vector to the os output stream.
void factorExplicit(MV &A, MV &Q, dense_matrix_type &R, const bool forceNonnegativeDiagonal=false)
Compute QR factorization A = QR, using TSQR.
virtual void MvInit(ScalarType alpha)=0
Replace each element of the vectors in *this with alpha.
static void MvInit(MultiVec< ScalarType > &mv, ScalarType alpha=Teuchos::ScalarTraits< ScalarType >::zero())
Replace each element of the vectors in mv with alpha.
virtual void SetBlock(const MultiVec< ScalarType > &A, const std::vector< int > &index)=0
Copy the vectors in A to a set of vectors in *this.
virtual void MvDot(const MultiVec< ScalarType > &A, std::vector< ScalarType > &b) const =0
Compute the dot product of each column of *this with the corresponding column of A.
virtual void MvAddMv(ScalarType alpha, const MultiVec< ScalarType > &A, ScalarType beta, const MultiVec< ScalarType > &B)=0
Replace *this with alpha * A + beta * B.
virtual void MvPrint(std::ostream &os) const =0
Print *this multivector to the os output stream.
virtual ptrdiff_t GetGlobalLength() const =0
The number of rows in the multivector.
Declaration of basic traits for the multivector type.
static void SetBlock(const MultiVec< ScalarType > &A, const std::vector< int > &index, MultiVec< ScalarType > &mv)
Copy the vectors in A to a set of vectors in mv indicated by the indices given in index...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static Teuchos::RCP< MultiVec< ScalarType > > Clone(const MultiVec< ScalarType > &mv, const int numvecs)
Create a new empty MultiVec containing numvecs columns.
static void MvAddMv(ScalarType alpha, const MultiVec< ScalarType > &A, ScalarType beta, const MultiVec< ScalarType > &B, MultiVec< ScalarType > &mv)
Replace mv with .
static void MvNorm(const MultiVec< ScalarType > &mv, std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &normvec)
Compute the 2-norm of each individual vector of mv. Upon return, normvec[i] holds the value of ...
static void MvRandom(MultiVec< ScalarType > &mv)
Replace the vectors in mv with random vectors.
virtual const MultiVec< ScalarType > * CloneView(const std::vector< int > &index) const =0
Creates a new Anasazi::MultiVec that shares the selected contents of *this. The index of the numvecs ...
int revealRank(MV &Q, dense_matrix_type &R, const magnitude_type &tol)
Compute rank-revealing decomposition using results of factorExplicit().
static void MvDot(const MultiVec< ScalarType > &mv, const MultiVec< ScalarType > &A, std::vector< ScalarType > &b)
Compute a vector b where the components are the individual dot-products of the i-th columns of A and ...
virtual void MvNorm(std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &normvec) const =0
Compute the 2-norm of each vector in *this.
static Teuchos::RCP< MultiVec< ScalarType > > CloneViewNonConst(MultiVec< ScalarType > &mv, const std::vector< int > &index)
Creates a new Anasazi::MultiVec that shares the selected contents of mv (shallow copy).
ConjType
Enumerated types used to specify conjugation arguments.
virtual int GetNumberVecs() const =0
The number of vectors (i.e., columns) in the multivector.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual void MvTransMv(ScalarType alpha, const MultiVec< ScalarType > &A, Teuchos::SerialDenseMatrix< int, ScalarType > &B) const =0
Compute a dense matrix B through the matrix-matrix multiply alpha * A^T * (*this).
TSQR adapter for MultiVec.
MultiVec()
Default constructor.
Traits class which defines basic operations on multivectors.
static Teuchos::RCP< MV > CloneCopy(const MV &mv)
Creates a new MV and copies contents of mv into the new vector (deep copy).
static Teuchos::RCP< const MultiVec< ScalarType > > CloneView(const MultiVec< ScalarType > &mv, const std::vector< int > &index)
Creates a new const Anasazi::MultiVec that shares the selected contents of mv (shallow copy)...
static int GetNumberVecs(const MultiVec< ScalarType > &mv)
Obtain the number of vectors in mv.
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
static void MvTimesMatAddMv(ScalarType alpha, const MultiVec< ScalarType > &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, ScalarType beta, MultiVec< ScalarType > &mv)
Update mv with .
static Teuchos::RCP< const MV > CloneView(const MV &mv, const std::vector< int > &index)
Creates a new const MV that shares the selected contents of mv (shallow copy).
static Teuchos::RCP< MultiVec< ScalarType > > CloneCopy(const MultiVec< ScalarType > &mv)
Creates a new Anasazi::MultiVec and copies contents of mv into the new vector (deep copy)...
static void MvTransMv(ScalarType alpha, const MultiVec< ScalarType > &A, const MultiVec< ScalarType > &mv, Teuchos::SerialDenseMatrix< int, ScalarType > &B)
Compute a dense matrix B through the matrix-matrix multiply .
virtual void MvScale(ScalarType alpha)=0
Scale each element of the vectors in *this with alpha.
virtual MultiVec< ScalarType > * CloneViewNonConst(const std::vector< int > &index)=0
Creates a new Anasazi::MultiVec that shares the selected contents of *this. The index of the numvecs ...
virtual MultiVec< ScalarType > * CloneCopy() const =0
Create a new MultiVec and copy contents of *this into it (deep copy).
virtual void MvTimesMatAddMv(ScalarType alpha, const MultiVec< ScalarType > &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, ScalarType beta)=0
Update *this with alpha * A * B + beta * (*this).
virtual ~MultiVec()
Destructor (virtual for memory safety of derived classes).
virtual MultiVec< ScalarType > * Clone(const int numvecs) const =0
Create a new MultiVec with numvecs columns.
static Teuchos::RCP< MultiVec< ScalarType > > CloneCopy(const MultiVec< ScalarType > &mv, const std::vector< int > &index)
Creates a new Anasazi::MultiVec and copies the selected contents of mv into the new vector (deep copy...
static void MvScale(MultiVec< ScalarType > &mv, const std::vector< ScalarType > &alpha)
Scale each element of the i-th vector in *this with alpha[i].
Interface for multivectors used by Anasazi's linear solvers.
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
static ptrdiff_t GetGlobalLength(const MultiVec< ScalarType > &mv)
Obtain the vector length of mv.