43 bool runTest(
unsigned int mat_size);
 
   52 template<
typename NumericT>
 
   53 void initInputData(std::vector<NumericT> &diagonal, std::vector<NumericT> &superdiagonal, 
unsigned int mat_size)
 
   58 #define RANDOM_VALUES false 
   63     for (
unsigned int i = 0; i < mat_size; ++i)
 
   65         diagonal[i] =      
static_cast<NumericT>(2.0 * (((double)rand()
 
   66                                      / (double) RAND_MAX) - 0.5));
 
   67         superdiagonal[i] = 
static_cast<NumericT>(2.0 * (((double)rand()
 
   68                                      / (double) RAND_MAX) - 0.5));
 
   75     for (
unsigned int i = 0; i < mat_size; ++i)
 
   77        diagonal[i] = ((
NumericT)(i % 3)) - 4.5f;
 
   78        superdiagonal[i] = ((
NumericT)(i % 3)) - 5.5f;
 
   84   superdiagonal[0] = 0.0f; 
 
   93     bool test_result = 
false;
 
   97     if(test_result == 
true)
 
   99       std::cout << 
"First Test Succeeded!" << std::endl << std::endl;
 
  103       std::cout << 
"---TEST FAILED---" << std::endl;
 
  110     if(test_result == 
true)
 
  112       std::cout << std::endl << 
"---TEST SUCCESSFULLY COMPLETED---" << std::endl;
 
  117       std::cout << 
"---TEST FAILED---" << std::endl;
 
  127     bool bResult = 
false;
 
  129     std::vector<NumericT> diagonal(mat_size);
 
  130     std::vector<NumericT> superdiagonal(mat_size);
 
  131     std::vector<NumericT> eigenvalues_bisect(mat_size);
 
  138     std::cout << 
"Start the bisection algorithm" << std::endl;
 
  139     std::cout << 
"Matrix size: " << mat_size << std::endl;
 
  142     if (bResult == 
false)
 
  148     std::vector<NumericT> diagonal_tql(mat_size);
 
  149     std::vector<NumericT> superdiagonal_tql(mat_size);
 
  150     diagonal_tql = diagonal;
 
  151     superdiagonal_tql = superdiagonal;
 
  154     std::cout << 
"Start the tql algorithm..." << std::endl;
 
  155     viennacl::linalg::tql1<NumericT>(mat_size, diagonal_tql, superdiagonal_tql);
 
  158     std::sort(diagonal_tql.begin(), diagonal_tql.end());
 
  162     std::cout << 
"Start comparison..." << std::endl;
 
  163     for (
unsigned int i = 0; i < mat_size; i++)
 
  165        if (std::abs(diagonal_tql[i] - eigenvalues_bisect[i]) > 
EPS)
 
  167          std::cout << std::setprecision(12) << diagonal_tql[i] << 
"  != " << eigenvalues_bisect[i] << 
"\n";
 
Implementation of the tql2-algorithm for eigenvalue computations. 
Implementation of an bisection algorithm for eigenvalues. 
std::vector< typename viennacl::result_of::cpu_value_type< typename VectorT::value_type >::type > bisect(VectorT const &alphas, VectorT const &betas)
Implementation of the bisect-algorithm for the calculation of the eigenvalues of a tridiagonal matrix...
bool runTest(unsigned int mat_size)
Run a simple test. 
void initInputData(std::vector< NumericT > &diagonal, std::vector< NumericT > &superdiagonal, unsigned int mat_size)
initInputData Initialize the diagonal and superdiagonal elements of the matrix 
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
Implementation of the algorithm for finding eigenvalues of a tridiagonal matrix. 
Implementation of the ViennaCL scalar class.