14#ifndef ANASAZI_TRACEMIN_HPP
15#define ANASAZI_TRACEMIN_HPP
21#ifdef HAVE_ANASAZI_EPETRA
22 #include "Epetra_Operator.h"
28#include "Teuchos_ScalarTraits.hpp"
33#include "Teuchos_LAPACK.hpp"
34#include "Teuchos_BLAS.hpp"
35#include "Teuchos_SerialDenseMatrix.hpp"
36#include "Teuchos_SerialDenseSolver.hpp"
37#include "Teuchos_ParameterList.hpp"
38#include "Teuchos_TimeMonitor.hpp"
95 template <
class ScalarType,
class MV,
class OP>
142 const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
146 Teuchos::ParameterList ¶ms
156 typedef Teuchos::ScalarTraits<ScalarType> SCT;
157 typedef typename SCT::magnitudeType MagnitudeType;
158 const MagnitudeType ONE;
159 const MagnitudeType ZERO;
160 const MagnitudeType NANVAL;
163 void addToBasis(
const Teuchos::RCP<const MV> Delta);
165 void harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta);
179 template <
class ScalarType,
class MV,
class OP>
182 const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
186 Teuchos::ParameterList ¶ms
188 TraceMinBase<ScalarType,MV,OP>(problem,sorter,printer,tester,ortho,params),
189 ONE(Teuchos::ScalarTraits<MagnitudeType>::one()),
190 ZERO(Teuchos::ScalarTraits<MagnitudeType>::zero()),
191 NANVAL(Teuchos::ScalarTraits<MagnitudeType>::nan())
196 template <
class ScalarType,
class MV,
class OP>
199 MVT::MvAddMv(ONE,*this->X_,-ONE,*Delta,*this->V_);
203#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
204 Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
206 this->count_ApplyM_+= this->blockSize_;
208 OPT::Apply(*this->MOp_,*this->V_,*this->MV_);
213#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
214 Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
217 if(this->numAuxVecs_ > 0)
219 rank = this->orthman_->projectAndNormalizeMat(*this->V_,this->auxVecs_,
220 Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)),
221 Teuchos::null,this->MV_,this->MauxVecs_);
225 rank = this->orthman_->normalizeMat(*this->V_,Teuchos::null,this->MV_);
234 if(this->Op_ != Teuchos::null)
236#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
237 Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
239 this->count_ApplyOp_+= this->blockSize_;
240 OPT::Apply(*this->Op_,*this->V_,*this->KV_);
246 template <
class ScalarType,
class MV,
class OP>
247 void TraceMin<ScalarType,MV,OP>::harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta)
250 MVT::MvAddMv(ONE,*this->X_,-ONE,*Delta,*this->V_);
253 if(this->numAuxVecs_ > 0)
255#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
256 Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
258 this->orthman_->projectMat(*this->V_,this->auxVecs_);
262 if(this->Op_ != Teuchos::null)
264#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
265 Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
267 this->count_ApplyOp_+= this->blockSize_;
269 OPT::Apply(*this->Op_,*this->V_,*this->KV_);
273 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> > gamma = rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(this->blockSize_,this->blockSize_));
274 int rank = this->orthman_->normalizeMat(*this->KV_,gamma);
279 Teuchos::SerialDenseSolver<int,ScalarType> SDsolver;
280 SDsolver.setMatrix(gamma);
282 RCP<MV> tempMV = MVT::CloneCopy(*this->V_);
283 MVT::MvTimesMatAddMv(ONE,*tempMV,*gamma,ZERO,*this->V_);
288#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
289 Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
291 this->count_ApplyM_+= this->blockSize_;
293 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...
This is an abstract base class for the trace minimization eigensolvers.
This class implements a TraceMIN iteration, a preconditioned iteration for solving linear symmetric p...
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.