Return-Path: Delivered-To: apmail-lucene-mahout-dev-archive@minotaur.apache.org Received: (qmail 67395 invoked from network); 19 Feb 2010 23:56:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Feb 2010 23:56:49 -0000 Received: (qmail 914 invoked by uid 500); 19 Feb 2010 23:56:49 -0000 Delivered-To: apmail-lucene-mahout-dev-archive@lucene.apache.org Received: (qmail 847 invoked by uid 500); 19 Feb 2010 23:56:48 -0000 Mailing-List: contact mahout-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mahout-dev@lucene.apache.org Delivered-To: mailing list mahout-dev@lucene.apache.org Received: (qmail 837 invoked by uid 99); 19 Feb 2010 23:56:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2010 23:56:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2010 23:56:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id F329B29A002E for ; Fri, 19 Feb 2010 15:56:27 -0800 (PST) Message-ID: <1102707520.404741266623787994.JavaMail.jira@brutus.apache.org> Date: Fri, 19 Feb 2010 23:56:27 +0000 (UTC) From: "Ted Dunning (JIRA)" To: mahout-dev@lucene.apache.org Subject: [jira] Commented: (MAHOUT-300) Solve performance issues with Vector Implementations In-Reply-To: <398733359.398541266612388149.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MAHOUT-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12836053#action_12836053 ] Ted Dunning commented on MAHOUT-300: ------------------------------------ I think that the min and max functions need to check to see if the number of non-zero elements is < size. If so, then the max element is Math.max(0, max) and the min element is Math.min(0, min). This should subsume the case where there are no elements so I would just replace hasNoElements with a counter that you can then use to compare to the size. > Solve performance issues with Vector Implementations > ---------------------------------------------------- > > Key: MAHOUT-300 > URL: https://issues.apache.org/jira/browse/MAHOUT-300 > Project: Mahout > Issue Type: Improvement > Affects Versions: 0.3 > Reporter: Robin Anil > Fix For: 0.3 > > Attachments: MAHOUT-300.patch > > > AbstractVector operations like times > public Vector times(double x) { > Vector result = clone(); > Iterator iter = iterateNonZero(); > while (iter.hasNext()) { > Element element = iter.next(); > int index = element.index(); > result.setQuick(index, element.get() * x); > } > return result; > } > should be implemented as follows > public Vector times(double x) { > Vector result = clone(); > Iterator iter = result.iterateNonZero(); > while (iter.hasNext()) { > Element element = iter.next(); > element.set(element.get() * x); > } > return result; > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.