35 const Epetra_BlockMap& Map_in,
double * array,
const int numvecs,
const int stride)
51 : Epetra_OP( P_vec.Epetra_OP )
107 EpetraOpMultiVec temp_vec(Epetra_OP, Epetra_DataAccess::View, *Epetra_MV, index);
109 int numvecs = index.size();
111 std::vector<int> index2( numvecs );
112 for(
int i=0; i<numvecs; i++)
115 TEUCHOS_TEST_FOR_EXCEPTION( tmp_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::SetBlocks() cast of MultiVec<double> to EpetraOpMultiVec failed.");
116 EpetraOpMultiVec A_vec(Epetra_OP, Epetra_DataAccess::View, *(tmp_vec->GetEpetraMultiVector()), index2);
117 temp_vec.
MvAddMv( 1.0, A_vec, 0.0, A_vec );
120 temp_vec.
MvAddMv( 1.0, A, 0.0, A );
137 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::SetBlocks() cast of MultiVec<double> to EpetraOpMultiVec failed.");
140 Epetra_MV->Multiply(
'N',
'N', alpha, *(A_vec->GetEpetraMultiVector()), B_Pvec, beta ) != 0,
154 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::MvAddMv() cast of MultiVec<double> to EpetraOpMultiVec failed.");
156 TEUCHOS_TEST_FOR_EXCEPTION( B_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::MvAddMv() cast of MultiVec<double> to EpetraOpMultiVec failed.");
159 Epetra_MV->Update( alpha, *(A_vec->GetEpetraMultiVector()), beta, *(B_vec->GetEpetraMultiVector()), 0.0 ) != 0,
171 #ifdef HAVE_ANASAZI_EXPERIMENTAL
180 Epetra_MultiVector B_Pvec(Epetra_DataAccess::View, LocalMap, B.values(), B.stride(), B.numCols());
182 int info = Epetra_OP->
Apply( *Epetra_MV, *Epetra_MV_Temp );
184 "Anasazi::EpetraOpMultiVec::MvTransMv(): Error returned from Epetra_Operator::Apply()" );
187 B_Pvec.Multiply(
'T',
'N', alpha, *(A_vec->GetEpetraMultiVector()), *Epetra_MV_Temp, 0.0 ) != 0,
199 #ifdef HAVE_ANASAZI_EXPERIMENTAL
205 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::MvDot() cast of MultiVec<double> to EpetraOpMultiVec failed.");
207 int info = Epetra_OP->
Apply( *Epetra_MV, *Epetra_MV_Temp );
209 "Anasazi::EpetraOpMultiVec::MvDot(): Error returned from Epetra_Operator::Apply()" );
213 Epetra_MV_Temp->Dot( *(A_vec->GetEpetraMultiVector()), &b[0] ) != 0,
226 int info = Epetra_OP->
Apply( *Epetra_MV, *Epetra_MV_Temp );
228 "Anasazi::EpetraOpMultiVec::MvNorm(): Error returned from Epetra_Operator::Apply()" );
230 if (( (
int)normvec.size() >= Epetra_MV->NumVectors() ) ) {
232 Epetra_MV_Temp->Dot( *Epetra_MV, &normvec[0] ) != 0,
236 for (
int i=0; i<Epetra_MV->NumVectors(); ++i)
250 "Anasazi::EpetraOpMultiVec::MvScale() alpha argument size was inconsistent with number of vectors in mv.");
252 std::vector<int> tmp_index( 1, 0 );
253 for (
int i=0; i<numvecs; i++) {
256 temp_vec.Scale( alpha[i] ) != 0,
ScalarType * values() const
Declarations of specialized Anasazi multi-vector and operator classes using Epetra_MultiVector and Ep...
void MvTransMv(double alpha, const MultiVec< double > &A, Teuchos::SerialDenseMatrix< int, double > &B) const
Compute a dense matrix B through the matrix-matrix multiply .
void MvDot(const MultiVec< double > &A, std::vector< double > &b) const
Compute a vector b where the components are the individual dot-products, i.e. where A[i] is the i-th...
const MultiVec< double > * CloneView(const std::vector< int > &index) const
Creates a new EpetraOpMultiVec that shares the selected contents of *this.
EpetraSpecializedMultiVecFailure is thrown when a return value from an Epetra call on an Epetra_Multi...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
int GetNumberVecs() const
Obtain the vector length of *this.
EpetraOpMultiVec(const Teuchos::RCP< Epetra_Operator > &Op, const Epetra_BlockMap &Map_in, const int numvecs)
Basic EpetraOpMultiVec constructor.
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
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)
void MvScale(double alpha)
Scale each element of the vectors in *this with alpha.
Specialized adapter class for Anasazi::MultiVec that uses Epetra_MultiVector and Epetra_Operator to d...
MultiVec< double > * CloneViewNonConst(const std::vector< int > &index)
Creates a new EpetraOpMultiVec that shares the selected contents of *this.
MultiVec< double > * CloneCopy() const
Creates a new EpetraOpMultiVec and copies contents of *this into the new vector (deep copy)...
MultiVec< double > * Clone(const int numvecs) const
Creates a new empty EpetraOpMultiVec containing numvecs columns.
OrdinalType numCols() const
void SetBlock(const MultiVec< double > &A, const std::vector< int > &index)
Copy the vectors in A to a set of vectors in *this.
void MvTimesMatAddMv(double alpha, const MultiVec< double > &A, const Teuchos::SerialDenseMatrix< int, double > &B, double beta)
Update *this with .
void MvNorm(std::vector< double > &normvec) const
Compute the 2-norm of each individual vector of *this. Upon return, normvec[i] holds the 2-norm of th...
void MvAddMv(double alpha, const MultiVec< double > &A, double beta, const MultiVec< double > &B)
Replace *this with .
OrdinalType stride() const
OrdinalType numRows() const