delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/05/03/08:42:44

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
Message-ID: <905080.83354.qm@web25508.mail.ukl.yahoo.com>
Date: Mon, 3 May 2010 12:42:23 +0000 (GMT)
From: Marco Atzeri <marco_atzeri AT yahoo DOT it>
Subject: R: Octave 3.2.3: wrong matrix calculation
To: texsit <texsit AT yahoo DOT it>
Cc: cygwin AT cygwin DOT com
In-Reply-To: <877561.49926.qm@web29017.mail.ird.yahoo.com>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--- Lun 3/5/10, texsit  ha scritto:

> Hi All,
> I use octave 3.2.3 under Cygwin (windows 7) for my math
> application.=20
> I discovered a bad calculation calling the function det().
> The step to reproduce is this:
>=20
> > A =3D [1,2,3;4,5,6;7,8,9];
> > det(A)
> ans =3D -9.5171e-16
>=20
> 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).
>=20
> Under Linux=A0the resul has been 0 as I expected.
>=20
> Can anyone suggest me something to solve that problem?
>=20
> I'm using Cygwin 1.7.5-1 with Intel centrino 2 and windows
> 7 64 bit.
>=20
> Thank you in advance.
> Regards.
>=20
> Luca
>=20

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=20
on 64 bits. For this reason the same sequence of operations=20
could provide a slightly different outcome.

Suggested reading:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D323
http://hal.archives-ouvertes.fr/hal-00128124

In any case if you ask also for the matrix reverse=20
condition number

[D, RCOND] =3D det (A)
D =3D -9.5171e-16
RCOND =3D  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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019