1 #ifndef VIENNACL_LINALG_TQL2_HPP
2 #define VIENNACL_LINALG_TQL2_HPP
40 template <
typename SCALARTYPE,
typename VectorType>
53 SCALARTYPE eps =
static_cast<SCALARTYPE
>(1e-6);
59 tst1 = std::max<SCALARTYPE>(tst1, std::fabs(d[l]) + std::fabs(e[l]));
63 if (std::fabs(e[m]) <= eps * tst1)
78 SCALARTYPE p = (d[l + 1] - g) / (2 * e[l]);
79 SCALARTYPE r = viennacl::linalg::detail::pythag<SCALARTYPE>(p, 1);
85 d[l] = e[l] / (p + r);
86 d[l + 1] = e[l] * (p + r);
87 SCALARTYPE h = g - d[l];
99 for (
int i =
int(m - 1); i >= int(l); i--)
103 r = viennacl::linalg::detail::pythag<SCALARTYPE>(p, e[
vcl_size_t(i)]);
114 while (std::fabs(e[l]) > eps * tst1);
130 template <
typename SCALARTYPE,
typename VectorType,
typename F>
138 std::vector<SCALARTYPE> cs(n), ss(n);
148 SCALARTYPE eps =
static_cast<SCALARTYPE
>(viennacl::linalg::detail::EPS);
153 tst1 = std::max<SCALARTYPE>(tst1, std::fabs(d[l]) + std::fabs(e[l]));
157 if (std::fabs(e[m]) <= eps * tst1)
172 SCALARTYPE p = (d[l + 1] - g) / (2 * e[l]);
173 SCALARTYPE r = viennacl::linalg::detail::pythag<SCALARTYPE>(p, 1);
179 d[l] = e[l] / (p + r);
180 d[l + 1] = e[l] * (p + r);
181 SCALARTYPE dl1 = d[l + 1];
182 SCALARTYPE h = g - d[l];
195 SCALARTYPE el1 = e[l + 1];
198 for (
int i =
int(m - 1); i >= int(l); i--)
218 p = -s * s2 * c3 * el1 * e[l] / dl1;
229 while (std::fabs(e[l]) > eps * tst1);
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of the dense matrix class.
vcl_size_t size1(MatrixType const &mat)
Generic routine for obtaining the number of rows of a matrix (ViennaCL, uBLAS, etc.)
void tql2(matrix_base< SCALARTYPE, F > &Q, VectorType &d, VectorType &e)
viennacl::scalar< int > s2
Common routines used for the QR method and SVD. Experimental.
SCALARTYPE pythag(SCALARTYPE a, SCALARTYPE b)
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
void copy(std::vector< NumericT > &cpu_vec, circulant_matrix< NumericT, AlignmentV > &gpu_mat)
Copies a circulant matrix from the std::vector to the OpenCL device (either GPU or multi-core CPU) ...
void tql1(vcl_size_t n, VectorType &d, VectorType &e)
void givens_next(matrix_base< NumericT > &Q, vector_base< NumericT > &tmp1, vector_base< NumericT > &tmp2, int l, int m)
This function updates the matrix Q. It is part of the tql2 algorithm.