public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Octave 3.2.3: wrong matrix calculation
@ 2010-05-03  8:40 texsit
  2010-05-03 12:42 ` R: " Marco Atzeri
  0 siblings, 1 reply; 2+ messages in thread
From: texsit @ 2010-05-03  8:40 UTC (permalink / raw)
  To: cygwin

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




--
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* R: Octave 3.2.3: wrong matrix calculation
  2010-05-03  8:40 Octave 3.2.3: wrong matrix calculation texsit
@ 2010-05-03 12:42 ` Marco Atzeri
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Atzeri @ 2010-05-03 12:42 UTC (permalink / raw)
  To: texsit; +Cc: cygwin

--- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-03 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-03  8:40 Octave 3.2.3: wrong matrix calculation texsit
2010-05-03 12:42 ` R: " Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).