49 template <
typename MatrixLayout>
 
   51                       std::vector<ScalarType> & eigenvalues,
 
   52                       std::vector<ScalarType> & d,
 
   53                       std::vector<ScalarType> & e)
 
   55   std::size_t Q_size = Q.
size2();
 
   58   for(std::size_t j = 0; j < Q_size; j++)
 
   61     value = (d[0]- eigenvalues[j]) * Q(0, j) + e[1] * Q(1, j);
 
   66     for(std::size_t i = 1; i < Q_size - 1; i++)
 
   68       value = e[i] * Q(i - 1, j) + (d[i]- eigenvalues[j]) * Q(i, j) + e[i + 1] * Q(i + 1, j);
 
   74     value = e[Q_size - 1] * Q(Q_size - 2, j) + (d[Q_size - 1] - eigenvalues[j]) * Q(Q_size - 1, j);
 
   86 template <
typename MatrixLayout>
 
   92   std::vector<ScalarType> d(sz), e(sz), d_ref(sz), e_ref(sz);
 
   94   std::cout << 
"Testing matrix of size " << sz << 
"-by-" << sz << std::endl << std::endl;
 
   97   for(
unsigned int i = 0; i < sz; ++i)
 
   99     d[i] = ((float)(i % 9)) - 4.5f;
 
  100     e[i] = ((float)(i % 5)) - 4.5f;
 
  111   if(!test_eigen_val_vec<MatrixLayout>(Q, d, d_ref, e_ref))
 
  122   std::cout << std::endl << 
"COMPUTATION OF EIGENVALUES AND EIGENVECTORS" << std::endl;
 
  123   std::cout << std::endl << 
"Testing QL algorithm for symmetric tridiagonal row-major matrices..." << std::endl;
 
  124   test_qr_method_sym<viennacl::row_major>();
 
  126   std::cout << std::endl << 
"Testing QL algorithm for symmetric tridiagonal column-major matrices..." << std::endl;
 
  127   test_qr_method_sym<viennacl::column_major>();
 
  129   std::cout << std::endl <<
"--------TEST SUCCESSFULLY COMPLETED----------" << std::endl;
 
void tql2(matrix_base< SCALARTYPE, F > &Q, VectorType &d, VectorType &e)
Implementation of the tql2-algorithm for eigenvalue computations. 
Represents a vector consisting of 1 at a given index and zeros otherwise. To be used as an initialize...
void test_qr_method_sym()
bool test_eigen_val_vec(viennacl::matrix< ScalarType, MatrixLayout > &Q, std::vector< ScalarType > &eigenvalues, std::vector< ScalarType > &d, std::vector< ScalarType > &e)
size_type size2() const
Returns the number of columns. 
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
Implementation of the ViennaCL scalar class.