Automatic Differentiation
 
Loading...
Searching...
No Matches
symmetric_eigensolver.hpp
Go to the documentation of this file.
1#ifndef SYMMETRC_EIGENSOLVER_CL_HPP
2#define SYMMETRC_EIGENSOLVER_CL_HPP
3#ifdef STAN_OPENCL
4
8
9namespace stan {
10namespace math {
11
12template <bool need_eigenvectors = true>
16 matrix_cl<double> packed;
17 if (A.rows() <= 2) {
18 packed = A;
19 } else {
21 }
22 matrix_cl<double> diag = diagonal(packed);
24 block_zero_based(packed, 0, 1, packed.rows() - 1, packed.cols() - 1));
25 internal::tridiagonal_eigensolver_cl<need_eigenvectors>(
26 diag, subdiag, eigenvalues, eigenvectors);
27 if (need_eigenvectors && A.rows() > 2) {
29 }
30}
31
32} // namespace math
33} // namespace stan
34
35#endif
36#endif
Represents an arithmetic matrix on the OpenCL device.
Definition matrix_cl.hpp:47
auto block_zero_based(T &&a, int start_row, int start_col, int rows, int cols)
Block of a kernel generator expression.
auto diagonal(T &&a)
Diagonal of a kernel generator expression.
Definition diagonal.hpp:136
void block_householder_tridiag_cl(const matrix_cl< double > &A, matrix_cl< double > &packed, const int r=60)
Tridiagonalize a symmetric matrix using block Housholder algorithm.
void block_apply_packed_Q_cl(const matrix_cl< double > &packed_cl, matrix_cl< double > &A, const int r=200)
Calculates Q*A in-place.
Eigen::Matrix< complex_return_t< value_type_t< EigMat > >, -1, -1 > eigenvectors(const EigMat &m)
Return the eigenvectors of a (real-valued) matrix.
void symmetric_eigensolver(const matrix_cl< double > &A, matrix_cl< double > &eigenvalues, matrix_cl< double > &eigenvectors)
Eigen::Matrix< complex_return_t< value_type_t< EigMat > >, -1, 1 > eigenvalues(const EigMat &m)
Return the eigenvalues of a (real-valued) matrix.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...