Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 122DDDC24 for ; Mon, 22 Oct 2012 13:50:14 +0000 (UTC) Received: (qmail 94849 invoked by uid 500); 22 Oct 2012 13:50:13 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 94384 invoked by uid 500); 22 Oct 2012 13:50:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 94359 invoked by uid 99); 22 Oct 2012 13:50:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Oct 2012 13:50:12 +0000 Date: Mon, 22 Oct 2012 13:50:12 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: <1604295583.9653.1350913812748.JavaMail.jiratomcat@arcas> In-Reply-To: <665728963.588.1339267902813.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Updated] (MATH-803) Bugs in RealVector.ebeMultiply(RealVector) and ebeDivide(RealVector) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MATH-803?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles updated MATH-803: ------------------------ Fix Version/s: 4.0 =20 > Bugs in RealVector.ebeMultiply(RealVector) and ebeDivide(RealVector) > -------------------------------------------------------------------- > > Key: MATH-803 > URL: https://issues.apache.org/jira/browse/MATH-803 > Project: Commons Math > Issue Type: Bug > Affects Versions: 3.0 > Reporter: S=C3=A9bastien Brisard > Fix For: 4.0 > > > {{OpenMapRealVector.ebeMultiply(RealVector)}} and {{OpenMapRealVector.ebe= Divide(RealVector)}} return wrong values when one entry of the specified {{= RealVector}} is nan or infinity. The bug is easy to understand. Here is the= current implementation of {{ebeMultiply}} > {code:java} > public OpenMapRealVector ebeMultiply(RealVector v) { > checkVectorDimensions(v.getDimension()); > OpenMapRealVector res =3D new OpenMapRealVector(this); > Iterator iter =3D entries.iterator(); > while (iter.hasNext()) { > iter.advance(); > res.setEntry(iter.key(), iter.value() * v.getEntry(iter.key()= )); > } > return res; > } > {code} > The assumption is that for any double {{x}}, {{x * 0d =3D=3D 0d}} holds, = which is not true. The bug is easy enough to identify, but more complex to = solve. The only solution I can come up with is to loop through *all* entrie= s of v (instead of those entries which correspond to non-zero entries of th= is). I'm afraid about performance losses. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira