45 template <
typename NumericT>
54 void initInputData(std::vector<NumericT> &diagonal, std::vector<NumericT> &superdiagonal,
const unsigned int mat_size)
58 bool randomValues =
false;
61 if(randomValues ==
true)
64 for (
unsigned int i = 0; i < mat_size; ++i)
66 diagonal[i] =
static_cast<NumericT>(2.0 * (((double)rand()
67 / (double) RAND_MAX) - 0.5));
68 superdiagonal[i] =
static_cast<NumericT>(2.0 * (((double)rand()
69 / (double) RAND_MAX) - 0.5));
77 for(
unsigned int i = 0; i < mat_size; ++i)
79 diagonal[i] = ((
NumericT)(i % 8)) - 4.5f;
80 superdiagonal[i] = ((
NumericT)(i % 5)) - 4.5f;
86 superdiagonal[0] = 0.0f;
98 unsigned int mat_size = 30;
103 std::vector<NumericT> diagonal(mat_size);
104 std::vector<NumericT> superdiagonal(mat_size);
105 std::vector<NumericT> eigenvalues_bisect(mat_size);
116 std::cout <<
"Start the bisection algorithm" << std::endl;
118 std::cout << std::endl <<
"---TUTORIAL COMPLETED---" << std::endl;
131 exit(bResult ==
true ? EXIT_SUCCESS : EXIT_FAILURE);
Implementation of the dense matrix class.
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...
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 ViennaCL scalar class.