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 (JIRA)" <ji...@apache.org> on 2010/01/27 20:47:34 UTC

[jira] Commented: (MAHOUT-269) Vector.maxValue() returns Double.MIN_VALUE for vectors with all negative entries.

    [ https://issues.apache.org/jira/browse/MAHOUT-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805628#action_12805628 ] 

Ted Dunning commented on MAHOUT-269:
------------------------------------


This code looks like it uses Math.max to aggregate values.  

That seems fine.

> Vector.maxValue() returns Double.MIN_VALUE for vectors with all negative entries.
> ---------------------------------------------------------------------------------
>
>                 Key: MAHOUT-269
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-269
>             Project: Mahout
>          Issue Type: Bug
>          Components: Math
>    Affects Versions: 0.1, 0.2
>            Reporter: Jake Mannix
>            Priority: Minor
>             Fix For: 0.3
>
>
> {code}
>   @Override
>   public double maxValue() {
>     double result = Double.MIN_VALUE;
>     for (int i = 0; i < size(); i++) {
>       result = Math.max(result, getQuick(i));
>     }
>     return result;
>   }
> {code}
> Should be:
> {code}
>   @Override
>   public double maxValue() {
>     double result = 0;
>     for (int i = 0; i < size(); i++) {
>       result = Math.max(result, Math.abs(getQuick(i)));
>     }
>     return result;
>   }
> {code}
> Right?  MaxValue should be returning the max of the absolute value, not the real max, right?  And the maxValue of the zero vector is 0, not MIN_VALUE, yes?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.