1 #ifndef VIENNACL_LINALG_TQL2_HPP
2 #define VIENNACL_LINALG_TQL2_HPP
41 template <
typename SCALARTYPE,
typename VectorType,
typename F>
49 std::vector<SCALARTYPE> cs(n), ss(n);
59 SCALARTYPE eps =
static_cast<SCALARTYPE
>(viennacl::linalg::detail::EPS);
64 tst1 = std::max<SCALARTYPE>(tst1, std::fabs(d[l]) + std::fabs(e[l]));
68 if (std::fabs(e[m]) <= eps * tst1)
83 SCALARTYPE p = (d[l + 1] - g) / (2 * e[l]);
84 SCALARTYPE r = viennacl::linalg::detail::pythag<SCALARTYPE>(p, 1);
90 d[l] = e[l] / (p + r);
91 d[l + 1] = e[l] * (p + r);
92 SCALARTYPE dl1 = d[l + 1];
93 SCALARTYPE h = g - d[l];
106 SCALARTYPE el1 = e[l + 1];
109 for (
int i2 =
int(m) - 1; i2 >= int(l); i2--)
121 p = c * d[i] - s * g;
122 d[i + 1] = h + s * (c * g + s * d[i]);
130 p = -s * s2 * c3 * el1 * e[l] / dl1;
141 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
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
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 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.