Uploaded image for project: 'Mahout'
  1. Mahout
  2. MAHOUT-269

Vector.maxValue() returns Double.MIN_VALUE for vectors with all negative entries.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.1, 0.2
    • Fix Version/s: 0.3
    • Component/s: Math
    • Labels:
      None

      Description

        @Override
        public double maxValue() {
          double result = Double.MIN_VALUE;
          for (int i = 0; i < size(); i++) {
            result = Math.max(result, getQuick(i));
          }
          return result;
        }
      

      Should be:

        @Override
        public double maxValue() {
          double result = 0;
          for (int i = 0; i < size(); i++) {
            result = Math.max(result, Math.abs(getQuick(i)));
          }
          return result;
        }
      

      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?

        Attachments

          Activity

            People

            • Assignee:
              jake.mannix Jake Mannix
              Reporter:
              jake.mannix Jake Mannix
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: