Return-Path: X-Original-To: apmail-mahout-dev-archive@www.apache.org Delivered-To: apmail-mahout-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E0DBA1032D for ; Wed, 24 Apr 2013 22:25:37 +0000 (UTC) Received: (qmail 97419 invoked by uid 500); 24 Apr 2013 22:25:37 -0000 Delivered-To: apmail-mahout-dev-archive@mahout.apache.org Received: (qmail 97373 invoked by uid 500); 24 Apr 2013 22:25:37 -0000 Mailing-List: contact dev-help@mahout.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mahout.apache.org Delivered-To: mailing list dev@mahout.apache.org Received: (qmail 97353 invoked by uid 99); 24 Apr 2013 22:25:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Apr 2013 22:25:37 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of robin.anil@gmail.com designates 209.85.220.182 as permitted sender) Received: from [209.85.220.182] (HELO mail-vc0-f182.google.com) (209.85.220.182) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Apr 2013 22:25:31 +0000 Received: by mail-vc0-f182.google.com with SMTP id ht11so2318494vcb.27 for ; Wed, 24 Apr 2013 15:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=DEwog7GcpuI2i/7va/HE0yEZEvMZNZDQBPXDOgItHqE=; b=kFYY5t5WsCvt8UFJ5ZGPtZGPnryht2wjH69VOIIueHPqZrehiSNKKyYlYPH6Rb6tjw XlG0z42Uk2NZPzludcys2JiPi8X7dmVC/N9BYvQ1hQW7OwtobWBomtMZrRWEKwrSB62V eWUDdrMUPN3Rudw6iwU2JCr4eDDYDzZhigtKDRKl92AHPuapTTadpxMy4hT3fwFGw7kq V4fvjcuYLwhk2K3TK3C9qctyHVp4LRL4lisy7pHSOiXDfIFGtL0s15AP1o6P9tSMg6p6 5y+HKyxsmPXXvMyrRYq4l1I0Tqhbzwt6HywnrYzeixj0TOURrYITuQNTbEg+O+zQmb6T 3fog== X-Received: by 10.52.93.78 with SMTP id cs14mr22641279vdb.17.1366842310396; Wed, 24 Apr 2013 15:25:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.221.8.131 with HTTP; Wed, 24 Apr 2013 15:24:50 -0700 (PDT) In-Reply-To: References: From: Robin Anil Date: Wed, 24 Apr 2013 17:24:50 -0500 Message-ID: Subject: Re: [jira] [Created] (MAHOUT-1197) AbstractVector#cross is only appropriately efficient for dense vectors To: Mahout-Dev Content-Type: multipart/alternative; boundary=bcaec50162e360475b04db22c6f1 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec50162e360475b04db22c6f1 Content-Type: text/plain; charset=UTF-8 I second. Kill everything thats not used. Dan's assign work will improve the speed of assignRow. But I can imagine there are even more smarter way to do this for sparse vectors On Wed, Apr 24, 2013 at 5:07 PM, Jake Mannix (JIRA) wrote: > Jake Mannix created MAHOUT-1197: > ----------------------------------- > > Summary: AbstractVector#cross is only appropriately efficient > for dense vectors > Key: MAHOUT-1197 > URL: https://issues.apache.org/jira/browse/MAHOUT-1197 > Project: Mahout > Issue Type: Bug > Components: Math > Affects Versions: 0.6 > Reporter: Jake Mannix > Fix For: 0.8 > > > Nobody overrides this implementation: > [code] > @Override > public Matrix cross(Vector other) { > Matrix result = matrixLike(size, other.size()); > for (int row = 0; row < size; row++) { > result.assignRow(row, other.times(getQuick(row))); > } > return result; > } > [code] > > I think you can imagine what kind of performance this has on sparse > vectors (k non-zeroes) with high cardinality (N) - scales as O(N^2) instead > of O(k^2). > > I think the right approach is to *not* implement this in AbstractVector at > all, and force concrete implementations to properly implement it > performantly. > > Alternatively, killing this method entirely might be appropriate. If > anyone was using it (and uses sparse vectors), they'd have complained about > this by now. > > -- > This message is automatically generated by JIRA. > If you think it was sent incorrectly, please contact your JIRA > administrators > For more information on JIRA, see: http://www.atlassian.com/software/jira > --bcaec50162e360475b04db22c6f1--