11#include "Teuchos_ScalarTraits.hpp" 
   30     Epetra_MV = Teuchos::rcp( 
new Epetra_MultiVector(Map_in, numvecs) );
 
   31     Epetra_MV_Temp = Teuchos::rcp( 
new Epetra_MultiVector(Map_in, numvecs) );
 
 
   35                                      const Epetra_BlockMap& Map_in, 
double * array, 
const int numvecs, 
const int stride)
 
   38     Epetra_MV = Teuchos::rcp( 
new Epetra_MultiVector(Epetra_DataAccess::Copy, Map_in, array, stride, numvecs) ); 
 
   39     Epetra_MV_Temp = Teuchos::rcp( 
new Epetra_MultiVector(Map_in, numvecs) ); 
 
 
   43                                      Epetra_DataAccess CV, 
const Epetra_MultiVector& P_vec, 
const std::vector<int>& index)
 
   46     Epetra_MV = Teuchos::rcp( 
new Epetra_MultiVector(CV, P_vec, &(
const_cast<std::vector<int> &
>(index))[0], index.size()) );
 
   47     Epetra_MV_Temp = Teuchos::rcp( 
new Epetra_MultiVector( P_vec.Map(), index.size()) );
 
 
   51     : Epetra_OP( P_vec.Epetra_OP )
 
   53     Epetra_MV = Teuchos::rcp( 
new Epetra_MultiVector( *(P_vec.Epetra_MV) ) );
 
   54     Epetra_MV_Temp = Teuchos::rcp( 
new Epetra_MultiVector( *(P_vec.Epetra_MV_Temp) ) );
 
 
  107    EpetraOpMultiVec temp_vec(Epetra_OP, Epetra_DataAccess::View, *Epetra_MV, index);
 
  109    int numvecs = index.size();
 
  110    if ( A.GetNumberVecs() != numvecs ) {
 
  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 );
 
 
  131      const Teuchos::SerialDenseMatrix<int,double>& B, 
double beta ) 
 
  133    Epetra_LocalMap LocalMap(B.numRows(), 0, Epetra_MV->Map().Comm());
 
  134    Epetra_MultiVector B_Pvec(Epetra_DataAccess::View, LocalMap, B.values(), B.stride(), B.numCols());
 
  137    TEUCHOS_TEST_FOR_EXCEPTION( A_vec==NULL,  std::invalid_argument, 
"Anasazi::EpetraOpMultiVec::SetBlocks() cast of MultiVec<double> to EpetraOpMultiVec failed.");
 
  139    TEUCHOS_TEST_FOR_EXCEPTION( 
 
  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.");
 
  158    TEUCHOS_TEST_FOR_EXCEPTION( 
 
  159        Epetra_MV->Update( alpha, *(A_vec->GetEpetraMultiVector()), beta, *(B_vec->GetEpetraMultiVector()), 0.0 ) != 0,
 
 
  170                                   Teuchos::SerialDenseMatrix<int,double>& B
 
  171#ifdef HAVE_ANASAZI_EXPERIMENTAL
 
  179      Epetra_LocalMap LocalMap(B.numRows(), 0, Epetra_MV->Map().Comm());
 
  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()" );
 
  186      TEUCHOS_TEST_FOR_EXCEPTION( 
 
  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()" );
 
  212      TEUCHOS_TEST_FOR_EXCEPTION( 
 
  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() ) ) {
 
  231      TEUCHOS_TEST_FOR_EXCEPTION(
 
  232          Epetra_MV_Temp->Dot( *Epetra_MV, &normvec[0] ) != 0,
 
  236    for (
int i=0; i<Epetra_MV->NumVectors(); ++i)
 
  237      normvec[i] = Teuchos::ScalarTraits<double>::squareroot( normvec[i] );
 
 
  249    TEUCHOS_TEST_FOR_EXCEPTION( (
int)alpha.size() != numvecs, std::invalid_argument, 
 
  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++) {
 
  254      Epetra_MultiVector temp_vec(Epetra_DataAccess::View, *Epetra_MV, &tmp_index[0], 1);
 
  255      TEUCHOS_TEST_FOR_EXCEPTION( 
 
  256          temp_vec.Scale( alpha[i] ) != 0,
 
 
Declarations of specialized Anasazi multi-vector and operator classes using Epetra_MultiVector and Ep...
 
Specialized adapter class for Anasazi::MultiVec that uses Epetra_MultiVector and Epetra_Operator to d...
 
void MvScale(double alpha)
Scale each element of the vectors in *this with alpha.
 
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...
 
MultiVec< double > * Clone(const int numvecs) const
Creates a new empty EpetraOpMultiVec containing numvecs columns.
 
void MvAddMv(double alpha, const MultiVec< double > &A, double beta, const MultiVec< double > &B)
Replace *this with .
 
MultiVec< double > * CloneCopy() const
Creates a new EpetraOpMultiVec and copies contents of *this into the new vector (deep copy).
 
const MultiVec< double > * CloneView(const std::vector< int > &index) const
Creates a new EpetraOpMultiVec that shares the selected contents of *this.
 
EpetraOpMultiVec(const Teuchos::RCP< Epetra_Operator > &Op, const Epetra_BlockMap &Map_in, const int numvecs)
Basic EpetraOpMultiVec constructor.
 
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 MvTimesMatAddMv(double alpha, const MultiVec< double > &A, const Teuchos::SerialDenseMatrix< int, double > &B, double beta)
Update *this with .
 
void SetBlock(const MultiVec< double > &A, const std::vector< int > &index)
Copy the vectors in A to a set of vectors in *this.
 
int GetNumberVecs() const
Obtain the vector length of *this.
 
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 ...
 
MultiVec< double > * CloneViewNonConst(const std::vector< int > &index)
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...
 
Interface for multivectors used by Anasazi's linear solvers.
 
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package.
 
ConjType
Enumerated types used to specify conjugation arguments.