67 const Epetra_BlockMap& Map_in,
double * array,
const int numvecs,
const int stride)
83 : Epetra_OP( P_vec.Epetra_OP )
139 EpetraOpMultiVec temp_vec(Epetra_OP, Epetra_DataAccess::View, *Epetra_MV, index);
141 int numvecs = index.size();
143 std::vector<int> index2( numvecs );
144 for(
int i=0; i<numvecs; i++)
147 TEUCHOS_TEST_FOR_EXCEPTION( tmp_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::SetBlocks() cast of MultiVec<double> to EpetraOpMultiVec failed.");
148 EpetraOpMultiVec A_vec(Epetra_OP, Epetra_DataAccess::View, *(tmp_vec->GetEpetraMultiVector()), index2);
149 temp_vec.
MvAddMv( 1.0, A_vec, 0.0, A_vec );
152 temp_vec.
MvAddMv( 1.0, A, 0.0, A );
169 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::SetBlocks() cast of MultiVec<double> to EpetraOpMultiVec failed.");
172 Epetra_MV->Multiply(
'N',
'N', alpha, *(A_vec->GetEpetraMultiVector()), B_Pvec, beta ) != 0,
186 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::MvAddMv() cast of MultiVec<double> to EpetraOpMultiVec failed.");
188 TEUCHOS_TEST_FOR_EXCEPTION( B_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::MvAddMv() cast of MultiVec<double> to EpetraOpMultiVec failed.");
191 Epetra_MV->Update( alpha, *(A_vec->GetEpetraMultiVector()), beta, *(B_vec->GetEpetraMultiVector()), 0.0 ) != 0,
203 #ifdef HAVE_ANASAZI_EXPERIMENTAL
212 Epetra_MultiVector B_Pvec(Epetra_DataAccess::View, LocalMap, B.values(), B.stride(), B.numCols());
214 int info = Epetra_OP->
Apply( *Epetra_MV, *Epetra_MV_Temp );
216 "Anasazi::EpetraOpMultiVec::MvTransMv(): Error returned from Epetra_Operator::Apply()" );
219 B_Pvec.Multiply(
'T',
'N', alpha, *(A_vec->GetEpetraMultiVector()), *Epetra_MV_Temp, 0.0 ) != 0,
231 #ifdef HAVE_ANASAZI_EXPERIMENTAL
237 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraOpMultiVec::MvDot() cast of MultiVec<double> to EpetraOpMultiVec failed.");
239 int info = Epetra_OP->
Apply( *Epetra_MV, *Epetra_MV_Temp );
241 "Anasazi::EpetraOpMultiVec::MvDot(): Error returned from Epetra_Operator::Apply()" );
245 Epetra_MV_Temp->Dot( *(A_vec->GetEpetraMultiVector()), &b[0] ) != 0,
258 int info = Epetra_OP->
Apply( *Epetra_MV, *Epetra_MV_Temp );
260 "Anasazi::EpetraOpMultiVec::MvNorm(): Error returned from Epetra_Operator::Apply()" );
262 if (( (
int)normvec.size() >= Epetra_MV->NumVectors() ) ) {
264 Epetra_MV_Temp->Dot( *Epetra_MV, &normvec[0] ) != 0,
268 for (
int i=0; i<Epetra_MV->NumVectors(); ++i)
282 "Anasazi::EpetraOpMultiVec::MvScale() alpha argument size was inconsistent with number of vectors in mv.");
284 std::vector<int> tmp_index( 1, 0 );
285 for (
int i=0; i<numvecs; i++) {
288 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