32#ifndef REMORA_KERNELS_LAPACK_SYEV_HPP
33#define REMORA_KERNELS_LAPACK_SYEV_HPP
36#include "../../detail/traits.hpp"
38#define REMORA_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
50namespace remora {
namespace bindings {
58 int lwork = std::min<int>(130,4*n)*n;
59 double* work =
new double[lwork];
62 char uplo = upper?
'U':
'L';
69template <
typename MatA,
typename VectorB>
71 matrix_expression<MatA, cpu_tag>& A,
72 vector_expression<VectorB, cpu_tag>& eigenValues
74 REMORA_SIZE_CHECK(A().size1() == A().size2());
75 REMORA_SIZE_CHECK(A().size1() == eigenValues().size());
77 std::size_t n = A().size1();
80 if(std::is_same<typename MatA::orientation, row_major>::value){
83 auto storageA = A().raw_storage();
84 auto storageEig = eigenValues().raw_storage();
88 storageA.leading_dimension,
95 for (
int i = 0; i < (int)n-i-1; i++)
98 std::swap(eigenValues()( l ),eigenValues()( i ));
100 for (
int j = 0; j < (int)n; j++) {
101 for (
int i = 0; i < (int)n-i-1; i++)
104 std::swap(A()( j , l ), A()( j , i ));
111#undef REMORA_LAPACK_DSYEV