This is the mail archive of the
cygwin
mailing list for the Cygwin project.
R: Octave 3.2.3: wrong matrix calculation
- From: Marco Atzeri <marco_atzeri at yahoo dot it>
- To: texsit <texsit at yahoo dot it>
- Cc: cygwin at cygwin dot com
- Date: Mon, 3 May 2010 12:42:23 +0000 (GMT)
- Subject: R: Octave 3.2.3: wrong matrix calculation
--- Lun 3/5/10, texsit ha scritto:
> Hi All,
> I use octave 3.2.3 under Cygwin (windows 7) for my math
> application.
> I discovered a bad calculation calling the function det().
> The step to reproduce is this:
>
> > A = [1,2,3;4,5,6;7,8,9];
> > det(A)
> ans = -9.5171e-16
>
> The matrix is singular so I expected the resul was 0 and
> not a very very little number. I problem is the same also
> with Octave 3.2.4.
> At the begin I thougth it was only a round error, but I've
> made the same proof with Octave under Debian Linux (lenny).
>
> Under Linux?the resul has been 0 as I expected.
>
> Can anyone suggest me something to solve that problem?
>
> I'm using Cygwin 1.7.5-1 with Intel centrino 2 and windows
> 7 64 bit.
>
> Thank you in advance.
> Regards.
>
> Luca
>
Dear Luca,
it is not an error , it is a rounding feature ;-)
On cygwin most of the calculation are performed with 80 bits
but data are stored with 64 bits, while on Linux both are
on 64 bits. For this reason the same sequence of operations
could provide a slightly different outcome.
Suggested reading:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
http://hal.archives-ouvertes.fr/hal-00128124
In any case if you ask also for the matrix reverse
condition number
[D, RCOND] = det (A)
D = -9.5171e-16
RCOND = 2.2030e-18
you can recognize that the matrix is very bad conditioned
Regards
Marco Atzeri
octave cygwin maintainer
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple