You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by Ted Dunning <te...@gmail.com> on 2009/08/09 20:40:34 UTC

Re: svn commit: r802515 - in /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix: AbstractVector.java Vector.java

Shouldn't this iterate over non-zeros instead of over all elements?

On Sun, Aug 9, 2009 at 4:08 AM, <gs...@apache.org> wrote:

>       // this is the number of non-zero elements
>       double val = 0.0;
>       for (int i = 0; i < size(); i++) {
>         val += getQuick(i) == 0 ? 0 : 1;
>       }
> -      return divide(val);
> +      return val;
>



-- 
Ted Dunning, CTO
DeepDyve

Re: svn commit: r802515 - in /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix: AbstractVector.java Vector.java

Posted by Grant Ingersoll <gs...@apache.org>.
Yes, will fix.

On Aug 9, 2009, at 2:40 PM, Ted Dunning wrote:

> Shouldn't this iterate over non-zeros instead of over all elements?
>
> On Sun, Aug 9, 2009 at 4:08 AM, <gs...@apache.org> wrote:
>
>>      // this is the number of non-zero elements
>>      double val = 0.0;
>>      for (int i = 0; i < size(); i++) {
>>        val += getQuick(i) == 0 ? 0 : 1;
>>      }
>> -      return divide(val);
>> +      return val;
>>
>
>