Eigenvalues mismatch in MATLAB and cusolver

Hi,

I’m making programs to compute eigenvalues and eigenvectors using ‘cusolverDnDsygvd’, but the eigenvectors obtained from ‘cusolverDnDsygvd’ are different from result obtaiend from MATLB.
Would you tell me why this problem occurs?
I have used HPC SDK 21.11, and a simple program of MATLB is shown below, Fortran programs are attached.

MATLB program:
clear all;
close all;
clc;
format longEng;

A=[ 0.24 0.39 0.42 -0.16;
0.39 -0.11 0.79 0.63;
0.42 0.79 -0.25 0.48;
-0.16 0.63 0.48 -0.03];

B=[ 4.16 -3.12 0.56 -0.10;
-3.12 5.03 -0.83 1.09;
0.56 -0.83 0.76 0.34;
-0.10 1.09 0.34 1.18];

[v,d] = eig(A,B);

Fortran program:
cusolver_dsygvd.f90 (1.7 KB)
eigen_test.f90 (763 Bytes)

Eigenvectors are NOT unique, different libraries can sometimes choose different normalizations. Change the sign, multiply by any constant, and an eigenvector is still an eigenvector for the corresponding eigenvalue.

octave:

-0.06900576466434739      0.3079549832532105     -0.4469449873466135     -0.5527879009382728
 -0.5740148629476287       0.532857411797549    -0.03708402336823755     -0.6766017879787899
  -1.542757922913696     -0.3496445223979069     0.05047697975905175     -0.9275921094539308
   1.400407038190329      -0.621109377486434      0.4742517962681757      0.2509547958988896

Your code with more digits

0.069005764664348 -0.307954983253210 0.446944987346614 -0.552787900938272
0.574014862947629 -0.532857411797549 0.037084023368238 -0.676601787978789
1.542757922913696 0.349644522397907 -0.050476979759052 -0.927592109453930
-1.400407038190329 0.621109377486433 -0.474251796268176 0.250954795898889

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.