Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-1258

compute() method in classes in org.apache.commons.math4.ml.distance package

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0, 3.6
    • None
    • None

    Description

      Hi!

      There are five classes CanberraDistance, ChebyshevDistance, EarthMoversDistance, EuclideanDistance and ManhattanDistance in org.apache.commons.math4.ml.distance package, which compute different types of distances. Each of them contains method compute(double[] a, double[] b) that accepts two double arrays as variables.

      However, if the lengths of array a is greater than the length of array b, the method compute() in all the five classes produces java.lang.ArrayIndexOutOfBoundsException.

      For example,
      private void test0() {
      CanberraDistance distance = new CanberraDistance();

      final double[] a =

      { 1, 2, 3, 4, 9, 4 }

      ;
      final double[] b =

      { -5, -6, 7, 4, 3 }

      ;
      distance.compute(a, b);
      }

      Attachments

        1. pre-MATH-1258.patch
          4 kB
          Gilles Sadowski
        2. patch.diff
          10 kB
          Otmar Ertl

        Activity

          People

            Unassigned Unassigned
            gjahanagirova Gunel Jahangirova
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: