27 const int numvecs,
const int stride)
41 const std::vector<int>& index )
42 :
Epetra_MultiVector(CV, P_vec, &(const_cast<std::vector<int> &>(index))[0], index.size())
105 int numvecs = index.size();
107 std::vector<int> index2( numvecs );
108 for(
int i=0; i<numvecs; i++)
111 TEUCHOS_TEST_FOR_EXCEPTION( tmp_vec==NULL, std::invalid_argument,
"Anasazi::EpetraMultiVec::SetBlocks() cast of MultiVec<double> to EpetraMultiVec failed.");
113 temp_vec.
MvAddMv( 1.0, A_vec, 0.0, A_vec );
116 temp_vec.
MvAddMv( 1.0, A, 0.0, A );
133 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraMultiVec::SetBlocks() cast of MultiVec<double> to EpetraMultiVec failed.");
136 Multiply(
'N',
'N', alpha, *A_vec, B_Pvec, beta ) != 0,
137 EpetraMultiVecFailure,
"Anasazi::EpetraMultiVec::MvTimesMatAddMv() call to Epetra_MultiVec::Multiply() returned a nonzero value.");
150 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraMultiVec::MvAddMv() cast of MultiVec<double> to EpetraMultiVec failed.");
152 TEUCHOS_TEST_FOR_EXCEPTION( B_vec==NULL, std::invalid_argument,
"Anasazi::EpetraMultiVec::MvAddMv() cast of MultiVec<double> to EpetraMultiVec failed.");
155 Update( alpha, *A_vec, beta, *B_vec, 0.0 ) != 0,
156 EpetraMultiVecFailure,
"Anasazi::EpetraMultiVec::MvAddMv() call to Epetra_MultiVec::Update() returned a nonzero value.");
167 #ifdef HAVE_ANASAZI_EXPERIMENTAL
176 Epetra_MultiVector B_Pvec(Epetra_DataAccess::View, LocalMap, B.values(), B.stride(), B.numCols());
179 B_Pvec.Multiply(
'T',
'N', alpha, *A_vec, *
this, 0.0 ) != 0,
180 EpetraMultiVecFailure,
"Anasazi::EpetraMultiVec::MvTransMv() call to Epetra_MultiVec::Multiply() returned a nonzero value.");
191 #ifdef HAVE_ANASAZI_EXPERIMENTAL
197 TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL, std::invalid_argument,
"Anasazi::EpetraMultiVec::MvDot() cast of MultiVec<double> to EpetraMultiVec failed.");
199 if (( (
int)b.size() >= A_vec->NumVectors() ) ) {
201 this->Dot( *A_vec, &b[0] ) != 0,
202 EpetraMultiVecFailure,
"Anasazi::EpetraMultiVec::MvDot() call to Epetra_MultiVec::Dot() returned a nonzero value.");
214 int numvecs = this->NumVectors();
216 "Anasazi::EpetraMultiVec::MvScale() alpha argument size was inconsistent with number of vectors in mv.");
218 std::vector<int> tmp_index( 1, 0 );
219 for (
int i=0; i<numvecs; i++) {
222 temp_vec.Scale( alpha[i] ) != 0,
223 EpetraMultiVecFailure,
"Anasazi::EpetraMultiVec::MvScale() call to Epetra_MultiVec::Scale() returned a nonzero value.");
258 TEUCHOS_TEST_FOR_EXCEPTION( vec_X==NULL, std::invalid_argument,
"Anasazi::EpetraOp::Apply() cast of MultiVec<double> to Epetra_MultiVector failed.");
259 TEUCHOS_TEST_FOR_EXCEPTION( vec_Y==NULL, std::invalid_argument,
"Anasazi::EpetraOp::Apply() cast of MultiVec<double> to Epetra_MultiVector failed.");
261 int info = Epetra_Op->
Apply( *vec_X, *vec_Y );
263 "Anasazi::EpetraOp::Apply(): Error returned from Epetra_Operator::Apply()" );
279 : isAInverse( isAInverse_ ), Epetra_AOp(AOp), Epetra_MOp(MOp)
300 TEUCHOS_TEST_FOR_EXCEPTION( vec_X==NULL, std::invalid_argument,
"Anasazi::EpetraGenOp::Apply() cast of MultiVec<double> to Epetra_MultiVector failed.");
301 TEUCHOS_TEST_FOR_EXCEPTION( vec_Y==NULL, std::invalid_argument,
"Anasazi::EpetraGenOp::Apply() cast of MultiVec<double> to Epetra_MultiVector failed.");
307 info = Epetra_MOp->
Apply( *vec_X, temp_Y );
309 "Anasazi::EpetraGenOp::Apply(): Error returned from Epetra_Operator::Apply()" );
315 info = Epetra_AOp->
Apply( temp_Y, *vec_Y );
318 "Anasazi::EpetraGenOp::Apply(): Error returned from Epetra_Operator::Apply()" );
330 info = Epetra_MOp->
Apply( X, temp_Y );
331 if (info!=0)
return info;
337 info = Epetra_AOp->
Apply( temp_Y, Y );
352 info = Epetra_AOp->
Apply( X, temp_Y );
355 if (info!=0)
return info;
374 : Epetra_Op(Op), isTrans_(isTrans)
394 vec_X->NumVectors() );
396 TEUCHOS_TEST_FOR_EXCEPTION( vec_X==NULL , std::invalid_argument,
"Anasazi::EpetraSymOp::Apply() cast of MultiVec<double> to Epetra_MultiVector failed.");
397 TEUCHOS_TEST_FOR_EXCEPTION( vec_Y==NULL , std::invalid_argument,
"Anasazi::EpetraSymOp::Apply() cast of MultiVec<double> to Epetra_MultiVector failed.");
398 TEUCHOS_TEST_FOR_EXCEPTION( temp_vec==NULL, std::invalid_argument,
"Anasazi::EpetraSymOp::Apply() allocation Epetra_MultiVector failed.");
409 "Anasazi::EpetraSymOp::Apply(): Error returned from Epetra_Operator::Apply()" );
415 info=Epetra_Op->
Apply( *vec_X, *temp_vec );
419 "Anasazi::EpetraSymOp::Apply(): Error returned from Epetra_Operator::Apply()" );
427 "Anasazi::EpetraSymOp::Apply(): Error returned from Epetra_Operator::Apply()" );
431 info=Epetra_Op->
Apply( *temp_vec, *vec_Y );
435 "Anasazi::EpetraSymOp::Apply(): Error returned from Epetra_Operator::Apply()" );
442 "Anasazi::EpetraSymOp::Apply(): Error returned from Epetra_Operator::Apply()" );
455 if (info!=0) {
return info; }
460 info=Epetra_Op->
Apply( X, temp_vec );
461 if (info!=0) {
return info; }
465 if (info!=0) {
return info; }
468 info=Epetra_Op->
Apply( temp_vec, Y );
469 if (info!=0) {
return info; }
486 if (info!=0) {
return info; }
492 if (info!=0) {
return info; }
496 if (info!=0) {
return info; }
499 info=Epetra_Op->
Apply( temp_vec, Y );
500 if (info!=0) {
return info; }
518 : Epetra_MV(MV), isTrans_(isTrans)
541 info = temp_vec.Multiply(
'T',
'N', 1.0, *Epetra_MV, *vec_X, 0.0 );
543 "Anasazi::EpetraSymMVOp::Apply(): Error returned from Epetra_MultiVector::Multiply()" );
546 info = vec_Y->Multiply(
'N',
'N', 1.0, *Epetra_MV, temp_vec, 0.0 );
548 "Anasazi::EpetraSymMVOp::Apply(): Error returned from Epetra_MultiVector::Multiply()" );
555 info = temp_vec.Multiply(
'N',
'N', 1.0, *Epetra_MV, *vec_X, 0.0 );
557 "Anasazi::EpetraSymMVOp::Apply(): Error returned from Epetra_MultiVector::Multiply()" );
560 info = vec_Y->Multiply(
'T',
'N', 1.0, *Epetra_MV, temp_vec, 0.0 );
562 "Anasazi::EpetraSymMVOp::Apply(): Error returned from Epetra_MultiVector::Multiply()" );
577 : Epetra_MV(MV), Epetra_OP(OP)
581 Epetra_OP->
Apply( *Epetra_MV, *Epetra_WMV );
597 info = temp_vec.Multiply(
'N',
'N', 1.0, *Epetra_WMV, *vec_X, 0.0 );
599 "Anasazi::EpetraWSymMVOp::Apply(): Error returned from Epetra_MultiVector::Multiply()" );
602 info = vec_Y->Multiply(
'T',
'N', 1.0, *Epetra_MV, temp_vec, 0.0 );
604 "Anasazi::EpetraWSymMVOp::Apply(): Error returned from Epetra_MultiVector::Multiply()" );
618 : Epetra_MV(MV), Epetra_OP(OP)
622 Epetra_OP->
Apply( *Epetra_MV, *Epetra_WMV );
638 info = temp_vec.Multiply(
'N',
'N', 1.0, *Epetra_WMV, *vec_X, 0.0 );
640 "Anasazi::EpetraW2SymMVOp::Apply(): Error returned from Epetra_MultiVector::Multiply()" );
643 info = vec_Y->Multiply(
'T',
'N', 1.0, *Epetra_WMV, temp_vec, 0.0 );
645 "Anasazi::EpetraW2SymMVOp::Apply(): Error returned from Epetra_MultiVector::Multiply()" );
ScalarType * values() const
EpetraMultiVecAccessor is an interfaceto allow any Anasazi::MultiVec implementation that is based on ...
MultiVec< double > * CloneViewNonConst(const std::vector< int > &index)
Creates a new EpetraMultiVec that shares the selected contents of *this.
void SetBlock(const MultiVec< double > &A, const std::vector< int > &index)
Copy the vectors in A to a set of vectors in *this.
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
virtual int SetUseTranspose(bool UseTranspose)=0
void Apply(const MultiVec< double > &X, MultiVec< double > &Y) const
Apply method.
void Apply(const MultiVec< double > &X, MultiVec< double > &Y) const
Apply method [inherited from Anasazi::Operator class].
void MvTransMv(double alpha, const MultiVec< double > &A, Teuchos::SerialDenseMatrix< int, double > &B) const
Compute a dense matrix B through the matrix-matrix multiply .
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
void Apply(const MultiVec< double > &X, MultiVec< double > &Y) const
Apply method.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
~EpetraGenOp()
Destructor.
virtual const Epetra_Map & OperatorDomainMap() const =0
void Apply(const MultiVec< double > &X, MultiVec< double > &Y) const
Apply method.
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
EpetraSymMVOp(const Teuchos::RCP< const Epetra_MultiVector > &MV, bool isTrans=false)
Basic constructor for applying operator [default] or .
virtual const Epetra_Map & OperatorRangeMap() const =0
void MvTimesMatAddMv(double alpha, const MultiVec< double > &A, const Teuchos::SerialDenseMatrix< int, double > &B, double beta)
Update *this with .
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 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...
EpetraSymOp(const Teuchos::RCP< Epetra_Operator > &Op, bool isTrans=false)
Basic constructor for applying operator [default] or .
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
void MvAddMv(double alpha, const MultiVec< double > &A, double beta, const MultiVec< double > &B)
Replace *this with .
~EpetraSymOp()
Destructor.
void MvScale(double alpha)
Scale each element of the vectors in *this with alpha.
MultiVec< double > * Clone(const int numvecs) const
Creates a new empty EpetraMultiVec containing numvecs columns.
OrdinalType numCols() const
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Apply inverse method [inherited from Epetra_Operator class].
EpetraW2SymMVOp(const Teuchos::RCP< const Epetra_MultiVector > &MV, const Teuchos::RCP< Epetra_Operator > &OP)
Basic constructor for applying operator .
MultiVec< double > * CloneCopy() const
Creates a new EpetraMultiVec and copies contents of *this into the new vector (deep copy)...
EpetraWSymMVOp(const Teuchos::RCP< const Epetra_MultiVector > &MV, const Teuchos::RCP< Epetra_Operator > &OP)
Basic constructor for applying operator .
EpetraMultiVecFailure is thrown when a return value from an Epetra call on an Epetra_MultiVector is n...
EpetraGenOp(const Teuchos::RCP< Epetra_Operator > &AOp, const Teuchos::RCP< Epetra_Operator > &MOp, bool isAInverse=true)
Basic constructor for applying operator [default] or .
EpetraMultiVec(const Epetra_BlockMap &Map_in, const int numvecs)
Basic EpetraMultiVec constructor.
EpetraOp(const Teuchos::RCP< Epetra_Operator > &Op)
Basic constructor. Accepts reference-counted pointer to an Epetra_Operator.
Declarations of Anasazi multi-vector and operator classes using Epetra_MultiVector and Epetra_Operato...
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Apply inverse method [inherited from Epetra_Operator class].
OrdinalType stride() const
void Apply(const MultiVec< double > &X, MultiVec< double > &Y) const
This method takes the Anasazi::MultiVec X and applies the operator to it resulting in the Anasazi::Mu...
OrdinalType numRows() const
const MultiVec< double > * CloneView(const std::vector< int > &index) const
Creates a new EpetraMultiVec that shares the selected contents of *this.
Exceptions thrown to signal error in operator application.
Basic adapter class for Anasazi::MultiVec that uses Epetra_MultiVector.
void Apply(const MultiVec< double > &X, MultiVec< double > &Y) const
Apply method [inherited from Anasazi::Operator class].