42 #ifndef ANASAZI_HELPER_TRAITS_HPP 
   43 #define ANASAZI_HELPER_TRAITS_HPP 
   62     template <
class ScalarType>
 
   74                     std::vector<
Value<ScalarType> >* RV, std::vector<int>* RO, std::vector<int>* RI );
 
   95     template<
class ScalarType>
 
  104         int curDim = (int)rRV.size();
 
  111         while( i < curDim ) {
 
  112             if ( iRV[i] != MT_ZERO ) {
 
  115                 (*RV)[i].set(rRV[i], iRV[i]);
 
  116                 (*RV)[i+1].set(rRV[i+1], iRV[i+1]);
 
  119                 if ( (*RV)[i].imagpart < MT_ZERO ) {
 
  122                     (*RV)[i] = (*RV)[i+1];
 
  123                     (*RV)[i+1] = tmp_ritz;
 
  125                     int tmp_order = (*RO)[i];
 
  126                     (*RO)[i] = (*RO)[i+1];
 
  127                     (*RO)[i+1] = tmp_order;
 
  130                 RI->push_back(1); RI->push_back(-1);
 
  135                 (*RV)[i].set(rRV[i], MT_ZERO);
 
  143     template<
class ScalarType>
 
  156         int i = 0, curDim = S->
numRows();
 
  158         ScalarType* s_ptr = S->
values();
 
  159         while( i < curDim ) {
 
  160             if ( iRV[i] != MT_ZERO ) {
 
  161                 temp = lapack_mag.
LAPY2( blas.
NRM2( curDim, s_ptr+i*curDim, 1 ), 
 
  162                         blas.
NRM2( curDim, s_ptr+(i+1)*curDim, 1 ) );
 
  163                 blas.
SCAL( curDim, ST_ONE/temp, s_ptr+i*curDim, 1 );
 
  164                 blas.
SCAL( curDim, ST_ONE/temp, s_ptr+(i+1)*curDim, 1 );
 
  167                 temp = blas.
NRM2( curDim, s_ptr+i*curDim, 1 );
 
  168                 blas.
SCAL( curDim, ST_ONE/temp, s_ptr+i*curDim, 1 );
 
  174     template<
class ScalarType>
 
  187         int s_stride = S.
stride();
 
  190         ScalarType* s_ptr = S.
values();
 
  192         while( i < s_cols ) {
 
  193             if ( iRV[i] != MT_ZERO ) {
 
  194                 (*RR)[i] = lapack_mag.
LAPY2( blas.
NRM2(s_rows, s_ptr + i*s_stride, 1),
 
  195                                              blas.
NRM2(s_rows, s_ptr + (i+1)*s_stride, 1) );
 
  196                 (*RR)[i+1] = (*RR)[i];
 
  199                 (*RR)[i] = blas.
NRM2(s_rows, s_ptr + i*s_stride, 1);
 
  205 #ifdef HAVE_TEUCHOS_COMPLEX 
  220               const std::vector<T>& rRV, 
 
  221               const std::vector<T>& iRV,
 
  222               std::vector<
Value<ANSZI_CPLX_CLASS<T> > >* RV, 
 
  223               std::vector<int>* RO, std::vector<int>* RI );
 
  226                 const std::vector<T>& iRV,
 
  230                 const std::vector<T>& iRV,
 
  232                 std::vector<T>* RR );
 
  236     void HelperTraits<ANSZI_CPLX_CLASS<T> >::sortRitzValues( 
 
  237             const std::vector<T>& rRV, 
 
  238             const std::vector<T>& iRV,
 
  239             std::vector<Value<ANSZI_CPLX_CLASS<T> > >* RV, 
 
  240             std::vector<int>* RO, std::vector<int>* RI )
 
  243         int curDim = (int)rRV.size();
 
  250         while( i < curDim ) {
 
  251             (*RV)[i].set(rRV[i], iRV[i]);
 
  258     void HelperTraits<ANSZI_CPLX_CLASS<T> >::scaleRitzVectors( 
 
  259             const std::vector<T>& iRV,
 
  263       typedef ANSZI_CPLX_CLASS<T> ST;
 
  268       int i = 0, curDim = S->numRows();
 
  270       ST* s_ptr = S->values();
 
  271       while( i < curDim ) {
 
  272         temp = blas.
NRM2( curDim, s_ptr+i*curDim, 1 );
 
  273         blas.
SCAL( curDim, ST_ONE/temp, s_ptr+i*curDim, 1 );
 
  279     void HelperTraits<ANSZI_CPLX_CLASS<T> >::computeRitzResiduals( 
 
  280             const std::vector<T>& iRV,
 
  287         int s_stride = S.stride();
 
  288         int s_rows = S.numRows();
 
  289         int s_cols = S.numCols();
 
  290         ANSZI_CPLX_CLASS<T>* s_ptr = S.values();
 
  292         for (
int i=0; i<s_cols; ++i ) {
 
  293             (*RR)[i] = blas.
NRM2(s_rows, s_ptr + i*s_stride, 1);
 
  301 #endif // ANASAZI_HELPER_TRAITS_HPP 
ScalarType * values() const 
 
ScalarTraits< ScalarType >::magnitudeType NRM2(const OrdinalType &n, const ScalarType *x, const OrdinalType &incx) const 
 
static void scaleRitzVectors(const std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &iRV, Teuchos::SerialDenseMatrix< int, ScalarType > *S)
Helper function for correctly scaling the eigenvectors of the projected eigenproblem. 
 
static void sortRitzValues(const std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &rRV, const std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &iRV, std::vector< Value< ScalarType > > *RV, std::vector< int > *RO, std::vector< int > *RI)
Helper function for correctly storing the Ritz values when the eigenproblem is non-Hermitian. 
 
This struct is used for storing eigenvalues and Ritz values, as a pair of real values. 
 
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
 
ScalarType LAPY2(const ScalarType &x, const ScalarType &y) const 
 
OrdinalType numCols() const 
 
void SCAL(const OrdinalType &n, const ScalarType &alpha, ScalarType *x, const OrdinalType &incx) const 
 
Types and exceptions used within Anasazi solvers and interfaces. 
 
static void computeRitzResiduals(const std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &iRV, const Teuchos::SerialDenseMatrix< int, ScalarType > &S, std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > *RR)
Helper function for correctly computing the Ritz residuals of the projected eigenproblem. 
 
OrdinalType stride() const 
 
OrdinalType numRows() const 
 
Class which defines basic traits for working with different scalar types.