49 #ifndef ANASAZI_TRACEMIN_HPP
50 #define ANASAZI_TRACEMIN_HPP
56 #ifdef HAVE_ANASAZI_EPETRA
57 #include "Epetra_Operator.h"
63 #include "Teuchos_ScalarTraits.hpp"
68 #include "Teuchos_LAPACK.hpp"
69 #include "Teuchos_BLAS.hpp"
70 #include "Teuchos_SerialDenseMatrix.hpp"
71 #include "Teuchos_SerialDenseSolver.hpp"
72 #include "Teuchos_ParameterList.hpp"
73 #include "Teuchos_TimeMonitor.hpp"
130 template <
class ScalarType,
class MV,
class OP>
177 const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
181 Teuchos::ParameterList ¶ms
191 typedef Teuchos::ScalarTraits<ScalarType> SCT;
192 typedef typename SCT::magnitudeType MagnitudeType;
193 const MagnitudeType ONE;
194 const MagnitudeType ZERO;
195 const MagnitudeType NANVAL;
198 void addToBasis(
const Teuchos::RCP<const MV> Delta);
200 void harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta);
214 template <
class ScalarType,
class MV,
class OP>
217 const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
221 Teuchos::ParameterList ¶ms
223 TraceMinBase<ScalarType,MV,OP>(problem,sorter,printer,tester,ortho,params),
224 ONE(Teuchos::ScalarTraits<MagnitudeType>::one()),
225 ZERO(Teuchos::ScalarTraits<MagnitudeType>::zero()),
226 NANVAL(Teuchos::ScalarTraits<MagnitudeType>::nan())
231 template <
class ScalarType,
class MV,
class OP>
234 MVT::MvAddMv(ONE,*this->X_,-ONE,*Delta,*this->V_);
238 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
239 Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
241 this->count_ApplyM_+= this->blockSize_;
243 OPT::Apply(*this->MOp_,*this->V_,*this->MV_);
248 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
249 Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
252 if(this->numAuxVecs_ > 0)
254 rank = this->orthman_->projectAndNormalizeMat(*this->V_,this->auxVecs_,
255 Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)),
256 Teuchos::null,this->MV_,this->MauxVecs_);
260 rank = this->orthman_->normalizeMat(*this->V_,Teuchos::null,this->MV_);
269 if(this->Op_ != Teuchos::null)
271 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
272 Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
274 this->count_ApplyOp_+= this->blockSize_;
275 OPT::Apply(*this->Op_,*this->V_,*this->KV_);
281 template <
class ScalarType,
class MV,
class OP>
282 void TraceMin<ScalarType,MV,OP>::harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta)
285 MVT::MvAddMv(ONE,*this->X_,-ONE,*Delta,*this->V_);
288 if(this->numAuxVecs_ > 0)
290 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
291 Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
293 this->orthman_->projectMat(*this->V_,this->auxVecs_);
297 if(this->Op_ != Teuchos::null)
299 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
300 Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
302 this->count_ApplyOp_+= this->blockSize_;
304 OPT::Apply(*this->Op_,*this->V_,*this->KV_);
308 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> > gamma = rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(this->blockSize_,this->blockSize_));
309 int rank = this->orthman_->normalizeMat(*this->KV_,gamma);
314 Teuchos::SerialDenseSolver<int,ScalarType> SDsolver;
315 SDsolver.setMatrix(gamma);
317 RCP<MV> tempMV = MVT::CloneCopy(*this->V_);
318 MVT::MvTimesMatAddMv(ONE,*tempMV,*gamma,ZERO,*this->V_);
323 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
324 Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
326 this->count_ApplyM_+= this->blockSize_;
328 OPT::Apply(*this->MOp_,*this->V_,*this->MV_);