32 #ifndef SHARK_LINALG_BLAS_KERNELS_LAPACK_SYEV_HPP 33 #define SHARK_LINALG_BLAS_KERNELS_LAPACK_SYEV_HPP 36 #include "../traits.hpp" 38 #define SHARK_LAPACK_DSYEV FORTRAN_ID(dsyev) 42 const char* jobz,
const char* uplo,
const int *n,
43 double* a,
const int * lda,
double*
w,
44 double* work,
const int * lwork,
int* info
50 namespace shark {
namespace blas {
namespace bindings {
58 int lwork = std::min<int>(130,4*n)*n;
59 double* work =
new double[lwork];
62 char uplo = upper?
'U':
'L';
69 template <
typename MatrA,
typename VectorB>
71 matrix_expression<MatrA>& matA,
72 vector_expression<VectorB>& eigenValues
77 std::size_t n = matA().size1();
80 if(boost::is_same<typename MatrA::orientation, blas::row_major>::value){
85 traits::storage(matA()),
86 traits::leading_dimension(matA()),
87 traits::storage(eigenValues())
93 for (
int i = 0; i < (int)n-i-1; i++)
96 std::swap(eigenValues()( l ),eigenValues()( i ));
98 for (
int j = 0; j < (int)n; j++) {
99 for (
int i = 0; i < (int)n-i-1; i++)
102 std::swap(matA()( j , l ), matA()( j , i ));
109 #undef SHARK_LAPACK_DSYEV