Say I have the following matrix Pi in Matlab where I need to perform the following code
Pi = [0.2 0.2 0.15; 0.1 0.15 0.48; 0.9 0.96 0.9]
Pia = .5*(Pi-Pi')*1i;
[W,D] = eig(Pia,'vector');
eigenvalues D are [-0.4480 -0.0000 0.4480]
and the eigenvector matrix W is
0.0425 + 0.5956i 0.5357 + 0.0000i 0.0425 - 0.5956i
-0.0665 + 0.3812i -0.8370 + 0.0000i -0.0665 - 0.3812i
0.7027 + 0.0000i -0.1116 + 0.0000i 0.7027 + 0.0000i
I translate this into python like following:
Pi = np.array([[0.2, 0.2, 0.15], [0.1, 0.15, 0.48],[0.9, 0.96, 0.9]])
Piap = 0.5*(Pi-Pi.T)*(0+1j)
Dp,Wp = np.linalg.eigh(Piap)
While the eigenvalues are exactly the same, the eigenvector matrix Wp result
array([[-0.59709305+0.00000000e+00j,-0.535686260.00000000e+00j,-0.59709305+0.00000000e+00j],
[-0.37546463-9.34538627e-02j,0.83700978+5.55111512e-17j,-0.37546463+9.34538627e-2j],
[-0.05006195+7.00903970e-01j,0.1116013 -1.18169661e-16j,-0.05006195-7.00903970e-1j]])
I know eigenvectors are the same up to a sign and scaling constant, but here the two results do not coincide at all. In particular, while the second column is the same in both cases, the first (which is the same as the third) is very different. I tried to see if there was a sort of normalization comparing the first column of W with the one of Wp, but the ratios across the two cases for the same row are not constant. And providede there is a normlization in python, this must be row-wise as the thirs column gives the same results. What to do here?