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 4DA8BC2D0 for ; Thu, 12 Jul 2012 13:34:42 +0000 (UTC) Received: (qmail 58059 invoked by uid 500); 12 Jul 2012 13:34:40 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 57776 invoked by uid 500); 12 Jul 2012 13:34:39 -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 57444 invoked by uid 99); 12 Jul 2012 13:34:37 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2012 13:34:37 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 5E075142850 for ; Thu, 12 Jul 2012 13:34:36 +0000 (UTC) Date: Thu, 12 Jul 2012 13:34:36 +0000 (UTC) From: =?utf-8?Q?S=C3=A9bastien_Brisard_=28JIRA=29?= To: issues@commons.apache.org Message-ID: <928135565.41652.1342100076388.JavaMail.jiratomcat@issues-vm> In-Reply-To: <649986181.18558.1341662554499.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Commented] (MATH-812) In RealVector, dotProduct and outerProduct return wrong results due to misuse of sparse iterators 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-812?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D134127= 77#comment-13412777 ]=20 S=C3=A9bastien Brisard commented on MATH-812: ---------------------------------------- In {{r1360668}}, {{RealVector.outerProduct(RealVector)}} now loops through = all entries of the vectors. =20 > In RealVector, dotProduct and outerProduct return wrong results due to mi= suse of sparse iterators > -------------------------------------------------------------------------= ------------------------ > > Key: MATH-812 > URL: https://issues.apache.org/jira/browse/MATH-812 > Project: Commons Math > Issue Type: Bug > Affects Versions: 3.0 > Reporter: S=C3=A9bastien Brisard > Assignee: S=C3=A9bastien Brisard > Labels: linear, sparse > Fix For: 3.1 > > > In class {{RealVector}}, the default implementation of {{RealMatrix outer= Product(RealVector)}} uses sparse iterators on the entries of the two vecto= rs. The rationale behind this is that {{0d * x =3D=3D 0d}} is {{true}} for = all {{double x}}. This assumption is in fact false, since {{0d * NaN =3D=3D= NaN}}. > Proposed fix is to loop through *all* entries of both vectors. This can h= ave a significant impact on the CPU cost, but robustness should probably be= preferred over speed in default implementations. > Same issue occurs with {{double dotProduct(RealVector)}}, which uses spar= se iterators for {{this}} only. > Another option would be to through an exception if {{isNaN()}} is {{true}= }, in which case caching could be used for both {{isNaN()}} and {{isInfinit= e()}}. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs: https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp= a For more information on JIRA, see: http://www.atlassian.com/software/jira