help-octave
[Top][All Lists]

## Re: How does Octave choose a phase when calculating eigenvectors?

 From: Brett Green Subject: Re: How does Octave choose a phase when calculating eigenvectors? Date: Fri, 13 Mar 2020 16:44:16 -0400

On Fri, Mar 13, 2020 at 3:54 PM James Sherman Jr. <address@hidden> wrote:

Oh, ok, I haven't done much with eigenvalues of complex matrices, but that makes sense.  I don't have any particular behind the scenes knowledge of the QZ algorithm, or what the LAPACK function that (I assume) octave uses to perform the heavy lifting of this, but just making a couple small random complex matrices, it seems that it rotates the complex eigenvectors so that the entry with the largest magnitude is real.  So, just to check on a larger data set, I ran the following code, which seems to indicate this is the case, i.e. in all 100 trials, the largest magnitude element in each eigenvector was real.

Hope this helps.

for ii = 1:100,
A = rand(3,3)+j*rand(3,3);
[v, lambda] = eig(A);
[a, indices] = max(abs(v));
for jj = 1:3
if isreal(v(indices(jj), jj)) != 1
disp('nonreal');
endif
endfor
endfor

This is interesting to note. Thank you!