You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gunel Jahangirova (JIRA)" <ji...@apache.org> on 2015/08/19 14:56:45 UTC

[jira] [Updated] (MATH-1258) compute() method in classes in org.apache.commons.math4.ml.distance package

     [ https://issues.apache.org/jira/browse/MATH-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gunel Jahangirova updated MATH-1258:
------------------------------------
    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);
       }

  was:
Hi!

There are five classes CanberraDistance, ChebyshevDistance, EarthMoversDistance, EuclideanDistance and ManhattanDistance in org.apache.commons.math4.ml.distance classes, 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 b is greater than the length of array a, the method compute() in all the five classes produces java.lang.ArrayIndexOutOfBoundsException.

For example,
 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);


> compute() method in classes in org.apache.commons.math4.ml.distance package
> ---------------------------------------------------------------------------
>
>                 Key: MATH-1258
>                 URL: https://issues.apache.org/jira/browse/MATH-1258
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gunel Jahangirova
>            Priority: Minor
>
> 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);
>        }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)