I am using LAPACKE_chbevd
on AGX Orin, which is an embedded device based on arm, to calculate the eigenvalues and eigenvectors of a matrix, but the results are incorrect.
From LAPACKE_chbevd
(ARM Performance Lib):
-11919.6, -8524.17, -6111.67, -2497.23, 2114.36, 3121.9, 9681.48, 14156.4
The correct eigenvalues should be approximately:
-0.0141504, -0.00595834, -0.0012536, 0.000805093, 0.00987138, 204.135, 7947.25, 24044.7.
According to the user manual, I don't think I called LAPACKE_chbevd
in a wrong way.
#define N 8
lapack_complex_float h_cov_arm[N * N] = {
{4140.65f, -2.24197e-06f}, {137.897f, 3938.01f}, {-158.647f, -1241.86f}, {-1936.52f, 2616.06f},
{-743.871f, 2664.88f}, {623.323f, -4050.98f}, {-1115.17f, 1268.56f}, {-1067.13f, 133.398f},
{137.897f, -3938.01f}, {4154.02f, 3.32665e-06f}, {-1563.14f, -967.872f}, {2961.04f, 2489.75f},
{3325.31f, 1229.58f}, {-3941.03f, -737.05f}, {1463.98f, 2163.99f}, {-995.137f, 1257.28f},
{-158.647f, 1241.86f}, {-1563.14f, 967.872f}, {3843.31f, -2.39818e-07f}, {-2763.36f, 255.503f},
{-2805.64f, 1415.83f}, {1326.26f, 228.303f}, {-3621.11f, -722.38f}, {584.441f, -3733.83f},
{-1936.52f, -2616.06f}, {2961.04f, -2489.75f}, {-2763.36f, -255.503f}, {4067.95f, -3.1887e-06f},
{3742.5f, -1311.93f}, {-2992.45f, 1599.3f}, {3214.86f, 1165.23f}, {-611.432f, 2481.71f},
{-743.871f, -2664.88f}, {3325.31f, -1229.58f}, {-2805.64f, -1415.83f}, {3742.5f, 1311.94f},
{4021.9f, -3.66673e-06f}, {-2973.91f, 342.678f}, {2854.54f, 2360.54f}, {-1725.97f, 2476.39f},
{623.323f, 4050.98f}, {-3941.03f, 737.05f}, {1326.26f, -228.303f}, {-2992.45f, -1599.3f},
{-2973.91f, -342.678f}, {4204.25f, 3.96076e-06f}, {-1613.83f, -1059.15f}, {-198.559f, -1266.46f},
{-1115.17f, -1268.56f}, {1463.98f, -2163.99f}, {-3621.11f, 722.38f}, {3214.86f, -1165.23f},
{2854.54f, -2360.54f}, {-1613.83f, 1059.15f}, {3900.07f, -1.04732e-06f}, {171.296f, 3648.69f},
{-1067.13f, -133.398f}, {-995.137f, -1257.28f}, {584.441f, 3733.84f}, {-611.432f, -2481.71f},
{-1725.97f, -2476.39f}, {-198.559f, 1266.46f}, {171.296f, -3648.69f}, {3863.89f, -2.28193e-06f}
};
void ver_armpl(lapack_complex_float *cov_arm) {
float w[N];
lapack_complex_float z[N*N];
armpl_int_t stat = LAPACKE_chbevd(LAPACK_ROW_MAJOR, 'V', 'U', N, N-1, cov_arm, N, w, z, N);
std::cout << stat << std::endl;
std::cout<<"LAPACK:"<<std::endl;
for (int i=0;i<N;++i) {
std::cout<<w[i]<<std::endl;
}
}
The answer will be correct if use LAPACKE_cheev
or LAPACKE_zheev
.
Still don't know why can not use LAPACKE_chbevd
in this case.