#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <omp.h>
#include <mkl_lapack.h>
#include <mkl_cblas.h>

#include <sys/time.h>


void calc_mkl(int n, double *A, double * w){

 
  // lapack variables
  int info;
  char uplo='L';
  char jobz='V';      
  int lwork;
  double wkopt;
  double* work;
  
  lwork = -1;
  printf("Quering space...\n");
  dsyev( &jobz, &uplo, &n, A, &n, work, &wkopt, &lwork, &info );
  
  lwork = (int)wkopt;
  work = (double*)malloc( lwork*sizeof(double) );
  
  // Solve eigenproblem 
  printf("Solving eigenvalues...\n");
  dsyev( &jobz, &uplo, &n, A, &n, w, work, &lwork, &info );
  if(info!=0){
    printf("Error: - return value %d \n",info);
    exit(1);
  }
 
  
}
