14#ifndef ANASAZI_TRACEMIN_HPP
15#define ANASAZI_TRACEMIN_HPP
24#include "Teuchos_ScalarTraits.hpp"
29#include "Teuchos_LAPACK.hpp"
30#include "Teuchos_BLAS.hpp"
31#include "Teuchos_SerialDenseMatrix.hpp"
32#include "Teuchos_SerialDenseSolver.hpp"
33#include "Teuchos_ParameterList.hpp"
34#include "Teuchos_TimeMonitor.hpp"
39namespace Experimental {
91 template <
class ScalarType,
class MV,
class OP>
138 const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
142 Teuchos::ParameterList ¶ms
152 typedef Teuchos::ScalarTraits<ScalarType> SCT;
153 typedef typename SCT::magnitudeType MagnitudeType;
154 const MagnitudeType ONE;
155 const MagnitudeType ZERO;
156 const MagnitudeType NANVAL;
159 void addToBasis(
const Teuchos::RCP<const MV> Delta);
161 void harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta);
175 template <
class ScalarType,
class MV,
class OP>
178 const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
182 Teuchos::ParameterList ¶ms
184 TraceMinBase<ScalarType,MV,OP>(problem,sorter,printer,tester,ortho,params),
185 ONE(Teuchos::ScalarTraits<MagnitudeType>::one()),
186 ZERO(Teuchos::ScalarTraits<MagnitudeType>::zero()),
187 NANVAL(Teuchos::ScalarTraits<MagnitudeType>::nan())
192 template <
class ScalarType,
class MV,
class OP>
193 void TraceMin<ScalarType,MV,OP>::addToBasis(
const Teuchos::RCP<const MV> Delta)
195 MVT::MvAddMv(ONE,*this->X_,-ONE,*Delta,*this->V_);
199#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
200 Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
202 this->count_ApplyM_+= this->blockSize_;
204 OPT::Apply(*this->MOp_,*this->V_,*this->MV_);
209#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
210 Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
213 if(this->numAuxVecs_ > 0)
215 rank = this->orthman_->projectAndNormalizeMat(*this->V_,this->auxVecs_,
216 Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)),
217 Teuchos::null,this->MV_,this->MauxVecs_);
221 rank = this->orthman_->normalizeMat(*this->V_,Teuchos::null,this->MV_);
230 if(this->Op_ != Teuchos::null)
232#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
233 Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
235 this->count_ApplyOp_+= this->blockSize_;
236 OPT::Apply(*this->Op_,*this->V_,*this->KV_);
242 template <
class ScalarType,
class MV,
class OP>
243 void TraceMin<ScalarType,MV,OP>::harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta)
246 MVT::MvAddMv(ONE,*this->X_,-ONE,*Delta,*this->V_);
249 if(this->numAuxVecs_ > 0)
251#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
252 Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
254 this->orthman_->projectMat(*this->V_,this->auxVecs_);
258 if(this->Op_ != Teuchos::null)
260#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
261 Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
263 this->count_ApplyOp_+= this->blockSize_;
265 OPT::Apply(*this->Op_,*this->V_,*this->KV_);
269 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> > gamma = rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(this->blockSize_,this->blockSize_));
270 int rank = this->orthman_->normalizeMat(*this->KV_,gamma);
275 Teuchos::SerialDenseSolver<int,ScalarType> SDsolver;
276 SDsolver.setMatrix(gamma);
278 RCP<MV> tempMV = MVT::CloneCopy(*this->V_);
279 MVT::MvTimesMatAddMv(ONE,*tempMV,*gamma,ZERO,*this->V_);
284#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
285 Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
287 this->count_ApplyM_+= this->blockSize_;
289 OPT::Apply(*this->MOp_,*this->V_,*this->MV_);
Basic implementation of the Anasazi::SortManager class.
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.
Class which provides internal utilities for the Anasazi solvers.
Abstract base class for trace minimization eigensolvers.
Types and exceptions used within Anasazi solvers and interfaces.
This class defines the interface required by an eigensolver and status test class to compute solution...
TraceMinBase(const RCP< Eigenproblem< ScalarType, MV, OP > > &problem, const RCP< SortManager< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > > &sorter, const RCP< OutputManager< ScalarType > > &printer, const RCP< StatusTest< ScalarType, MV, OP > > &tester, const RCP< MatOrthoManager< ScalarType, MV, OP > > &ortho, Teuchos::ParameterList ¶ms)
TraceMinBase constructor with eigenproblem, solver utilities, and parameter list of solver options.
TraceMin(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)
TraceMin 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, static class providing utilities for the solvers.
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.