Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

unexpected outputs of lapack_cheev

$
0
0

Hello Guys,.

I am using the LAPACKE_cheev now from MKL. I have written a piece of code with this API. However, its outputs are out of my expectation. The code is attached. 

	lapack_complex_float *a = (lapack_complex_float*)malloc(sizeof(lapack_complex_float)*N*N);
	a[0].imag = 0;
	a[0].real = 0;
	a[1].imag = 1;
	a[1].real = 0;
	a[2].imag = 0;
	a[2].real = 1;
	a[3].imag = 0;
	a[3].real = 0;
	a[4].imag = 0;
	a[4].real = 0;
	a[5].imag = 0;
	a[5].real = 0;

	int matrix_order = LAPACK_ROW_MAJOR; //LAPACK_COL_MAJOR
	const char jobz = 'N';
	const char uplo = 'U';
	lapack_int n = N;
	lapack_int lda = N;
	float *w = (float*)malloc(sizeof(float)*N);

LAPACKE_cheev(matrix_order, jobz, uplo, n, a, lda, w);

	for (int i = 0; i < N; i++)
	{
		cout << w[i] << endl;
	}

I expect the outputs as follows:

[-1.414, 0, 1.414]

However, the outputs from my local machine is as follows:

[-4.31602e+008, -1, 1]

Could anybody help me with this issue?


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>