14#ifndef ANASAZI_TRACEMIN_DAVIDSON_HPP 
   15#define ANASAZI_TRACEMIN_DAVIDSON_HPP 
   24#include "Teuchos_ScalarTraits.hpp" 
   25#include "Teuchos_SerialDenseMatrix.hpp" 
   26#include "Teuchos_ParameterList.hpp" 
   27#include "Teuchos_TimeMonitor.hpp" 
   47  template <
class ScalarType, 
class MV, 
class OP>
 
   60                      const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
 
   64                      Teuchos::ParameterList ¶ms 
 
   73    typedef Teuchos::ScalarTraits<ScalarType> SCT;
 
   74    typedef typename SCT::magnitudeType MagnitudeType;
 
   77    void addToBasis(
const Teuchos::RCP<const MV> Delta);
 
   79    void harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta);
 
 
   94  template <
class ScalarType, 
class MV, 
class OP>
 
   97        const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
 
  101        Teuchos::ParameterList ¶ms
 
  103    TraceMinBase<ScalarType,MV,OP>(problem,sorter,printer,tester,ortho,params)
 
 
  113  template <
class ScalarType, 
class MV, 
class OP>
 
  117    TEUCHOS_TEST_FOR_EXCEPTION(MVT::GetNumberVecs(*Delta) != this->blockSize_, std::invalid_argument,
 
  118           "Anasazi::TraceMinDavidson::addToBasis(): Delta does not have blockSize_ columns");
 
  122    std::vector<int> curind(this->curDim_), newind(this->blockSize_);
 
  124    Teuchos::RCP<MV> lclV, lclKV, lclMV;
 
  126    Teuchos::Array< Teuchos::RCP<const MV> > projVecs = this->auxVecs_;
 
  129    for(
int i=0; i<this->curDim_; i++)
 
  131    lclV = MVT::CloneViewNonConst(*this->V_,curind);
 
  132    projVecs.push_back(lclV);
 
  135    for (
int i=0; i<this->blockSize_; ++i) 
 
  136      newind[i] = this->curDim_ + i;
 
  137    lclV = MVT::CloneViewNonConst(*this->V_,newind);
 
  140    MVT::SetBlock(*Delta,newind,*this->V_);
 
  141    this->curDim_ += this->blockSize_;
 
  147      Teuchos::Array< Teuchos::RCP<const MV> > MprojVecs = this->MauxVecs_;
 
  148      lclMV = MVT::CloneViewNonConst(*this->MV_,curind);
 
  149      MprojVecs.push_back(lclMV);
 
  152      lclMV = MVT::CloneViewNonConst(*this->MV_,newind);
 
  154        #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 
  155          Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
 
  157        this->count_ApplyM_+= this->blockSize_;
 
  158        OPT::Apply(*this->MOp_,*lclV,*lclMV);
 
  162        #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 
  163          Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
 
  167        rank = this->orthman_->projectAndNormalizeMat(*lclV,projVecs,
 
  168               Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)),
 
  169               Teuchos::null,lclMV,MprojVecs);
 
  172      MprojVecs.pop_back();
 
  176      #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 
  177        Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
 
  181      rank = this->orthman_->projectAndNormalizeMat(*lclV,projVecs);
 
  186    TEUCHOS_TEST_FOR_EXCEPTION(rank != this->blockSize_,TraceMinBaseOrthoFailure,
 
  187           "Anasazi::TraceMinDavidson::addToBasis(): Couldn't generate basis of full rank.");
 
  190    if(this->Op_ != Teuchos::null)
 
  192      #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 
  193        Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
 
  195      this->count_ApplyOp_+= this->blockSize_;
 
  197      lclKV = MVT::CloneViewNonConst(*this->KV_,newind);
 
  198      OPT::Apply(*this->Op_,*lclV,*lclKV);
 
  209  template <
class ScalarType, 
class MV, 
class OP>
 
  210  void TraceMinDavidson<ScalarType,MV,OP>::harmonicAddToBasis(Teuchos::RCP<const MV> Delta)
 
  213    TEUCHOS_TEST_FOR_EXCEPTION(MVT::GetNumberVecs(*Delta) != this->blockSize_, std::invalid_argument,
 
  214           "Anasazi::TraceMinDavidson::addToBasis(): Delta does not have blockSize_ columns");
 
  218    std::vector<int> curind(this->curDim_), newind(this->blockSize_);
 
  220    Teuchos::RCP<MV> lclV, lclKV, lclMV, projVecs, KprojVecs;
 
  224    for(
int i=0; i<this->curDim_; i++)
 
  226    projVecs = MVT::CloneViewNonConst(*this->V_,curind);
 
  228    if(this->Op_ != Teuchos::null)
 
  230      lclKV = MVT::CloneViewNonConst(*this->KV_,curind);
 
  235    for (
int i=0; i<this->blockSize_; ++i) 
 
  236      newind[i] = this->curDim_ + i;
 
  237    lclV = MVT::CloneViewNonConst(*this->V_,newind);
 
  240    MVT::SetBlock(*Delta,newind,*this->V_);
 
  241    this->curDim_ += this->blockSize_;
 
  244    if(this->auxVecs_.size() > 0)
 
  245      this->orthman_->projectMat(*lclV,this->auxVecs_);
 
  248    if(this->Op_ != Teuchos::null)
 
  250      #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 
  251        Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
 
  253      this->count_ApplyOp_+= this->blockSize_;
 
  255      lclKV = MVT::CloneViewNonConst(*this->KV_,newind);
 
  256      OPT::Apply(*this->Op_,*lclV,*lclKV);
 
  262    int nauxVecs = MVT::GetNumberVecs(*projVecs);
 
  263    RCP< Teuchos::SerialDenseMatrix<int,ScalarType> > gamma = rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(nauxVecs,this->blockSize_));
 
  265    this->orthman_->innerProdMat(*KprojVecs,*lclKV,*gamma);
 
  268    MVT::MvTimesMatAddMv(-this->ONE,*KprojVecs,*gamma,this->ONE,*lclKV);
 
  271    MVT::MvTimesMatAddMv(-this->ONE,*projVecs,*gamma,this->ONE,*lclV);
 
  274    RCP< Teuchos::SerialDenseMatrix<int,ScalarType> > gamma2 = rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(this->blockSize_,this->blockSize_));
 
  275    rank = this->orthman_->normalizeMat(*lclKV,gamma2);
 
  278    Teuchos::SerialDenseSolver<int,ScalarType> SDsolver;
 
  279    SDsolver.setMatrix(gamma2);
 
  281    RCP<MV> tempMV = MVT::CloneCopy(*lclV);
 
  282    MVT::MvTimesMatAddMv(this->ONE,*tempMV,*gamma2,this->ZERO,*lclV);
 
  284    TEUCHOS_TEST_FOR_EXCEPTION(rank != this->blockSize_,TraceMinBaseOrthoFailure,
 
  285           "Anasazi::TraceMinDavidson::addToBasis(): Couldn't generate basis of full rank.");
 
  290      #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 
  291        Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
 
  293      this->count_ApplyM_+= this->blockSize_;
 
  295      lclMV = MVT::CloneViewNonConst(*this->MV_,newind);
 
  296      OPT::Apply(*this->MOp_,*lclV,*lclMV);
 
Anasazi header file which uses auto-configuration information to include necessary C++ headers.
 
Pure virtual base class which describes the basic interface to the iterative eigensolver.
 
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
 
Declaration of basic traits for the multivector type.
 
Virtual base class which defines basic traits for the operator type.
 
Abstract base class for trace minimization eigensolvers.
 
This class defines the interface required by an eigensolver and status test class to compute solution...
 
This is an abstract base class for the trace minimization eigensolvers.
 
This class implements a TraceMin-Davidson iteration for solving symmetric generalized eigenvalue prob...
 
TraceMinDavidson(const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< SortManager< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > > &sorter, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &tester, const Teuchos::RCP< MatOrthoManager< ScalarType, MV, OP > > &ortho, Teuchos::ParameterList ¶ms)
TraceMinBase constructor with eigenproblem, solver utilities, and parameter list of solver options.
 
Anasazi's templated virtual class for providing routines for orthogonalization and orthonormalization...
 
Traits class which defines basic operations on multivectors.
 
Virtual base class which defines basic traits for the operator type.
 
Output managers remove the need for the eigensolver to know any information about the required output...
 
Anasazi's templated pure virtual class for managing the sorting of approximate eigenvalues computed b...
 
Common interface of stopping criteria for Anasazi's solvers.
 
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package.