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.

Reply via email to