From bug-octave-request at bevo dot che dot wisc dot edu Thu Oct 3 10:59:11 2002 Subject: Re: Bug in eig() From: Remy Bruno To: bug-octave at bevo dot che dot wisc dot edu Date: Thu, 3 Oct 2002 17:58:58 +0200 On Thursday 03 October at 09:29, Lippert, Ross A. wrote: > > OK, I have run the example directly in LAPACK-3 and the same bug occurs. > > This is an LAPACK bug. Ok, so maybe I will contact them directly and forward them our conversation. Regards, Rémy > > -r > > -----Original Message----- > From: Remy Bruno [mailto:remy dot bruno at libertysurf dot fr] > Sent: Thursday, October 03, 2002 5:58 AM > To: bug-octave at bevo dot che dot wisc dot edu > Subject: Re: Bug in eig() > > > Hi, > > On Wednesday 02 October at 22:10, A S Hodel wrote: > > On 10/2/02 6:35 PM, "Remy Bruno" wrote: > > > > > > The problem is your matrix A has a cluster of eigenvalues at or near 0: > > octave:3> svd(a) > > ans = > > > > 5.3126e-02 > > 2.2939e-18 > > 9.1084e-35 > > 3.9912e-53 > > 3.4228e-84 > > But, well, this is not 4 distinct values, it is 4 zeros! The eig() function > should take the numerical errors into account! Furthermore, with the matrix > given, the 4 eigenvalues are *exactly* 0. The matrix *is* diagonalizable: > The QR decomposition gives (with octave, BTW) : > A=Q*[x1 x2 x3 x4 x5; zeros(4,5)] > So: > A*X=0 gives > [x1 x2 x3 x4 x5; zeros(4,5)] * X = 0 > which is the equation of a space of dimension 4, so this matrix can be > written > A=P*D*inv(P). > > If you are not convinced, take this matrix: > B=ones(5,5)+1e-20*eye(5); > eig(B) > ans = > > -2.7308e-18 > 3.7252e-50 > 2.4586e-33 > 1.6926e-16 > 5.0000e+00 > So 5 different eigenvalues? But this time, eig() returns correct > eigenvectors! > > > > > Doesn't work. You'll get exactly the same result from MATLAB. You've > > picked a particularly icky problem (from a numerical standpoint). > > Yes, it works, I checked! In my previous mail, I gave the results given by > matlab, which are correct. So why could matlab do something octave can't? > > > > > >> [V,L ] = eig(A); > > >> rank(V) > > > > ans = > > > > 3 > > My matlab gives the correct rank (1)... And octave too! > rank(A) > ans = 1 > > Regards, > > Remy Bruno > > > > ------------------------------------------------------------- > Octave is freely available under the terms of the GNU GPL. > > Octave's home on the web: http://www.octave.org > How to fund new projects: http://www.octave.org/funding.html > Subscription information: http://www.octave.org/archive.html > ------------------------------------------------------------- > > > > ------------------------------------------------------------- > Octave is freely available under the terms of the GNU GPL. > > Octave's home on the web: http://www.octave.org > How to fund new projects: http://www.octave.org/funding.html > Subscription information: http://www.octave.org/archive.html > ------------------------------------------------------------- > ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------