[jira] [Created] (MATH-645) MathRuntimeException with simple ebeMultiply on OpenMapRealVector

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (MATH-645) MathRuntimeException with simple ebeMultiply on OpenMapRealVector

ASF GitHub Bot (Jira)
MathRuntimeException with simple ebeMultiply on OpenMapRealVector
-----------------------------------------------------------------

                 Key: MATH-645
                 URL: https://issues.apache.org/jira/browse/MATH-645
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.0
            Reporter: Sébastien Brisard


The following piece of code
{code:java}
import org.apache.commons.math.linear.OpenMapRealVector;
import org.apache.commons.math.linear.RealVector;

public class DemoBugOpenMapRealVector {
    public static void main(String[] args) {
        final RealVector u = new OpenMapRealVector(3, 1E-6);
        u.setEntry(0, 1.);
        u.setEntry(1, 0.);
        u.setEntry(2, 2.);
        final RealVector v = new OpenMapRealVector(3, 1E-6);
        v.setEntry(0, 0.);
        v.setEntry(1, 3.);
        v.setEntry(2, 0.);
        System.out.println(u);
        System.out.println(v);
        System.out.println(u.ebeMultiply(v));
    }
}
{code}
raises an exception
{noformat}
org.apache.commons.math.linear.OpenMapRealVector@7170a9b6
Exception in thread "main" org.apache.commons.math.MathRuntimeException$6: map has been modified while iterating
        at org.apache.commons.math.MathRuntimeException.createConcurrentModificationException(MathRuntimeException.java:373)
        at org.apache.commons.math.util.OpenIntToDoubleHashMap$Iterator.advance(OpenIntToDoubleHashMap.java:564)
        at org.apache.commons.math.linear.OpenMapRealVector.ebeMultiply(OpenMapRealVector.java:372)
        at org.apache.commons.math.linear.OpenMapRealVector.ebeMultiply(OpenMapRealVector.java:1)
        at DemoBugOpenMapRealVector.main(DemoBugOpenMapRealVector.java:17)
{noformat}


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-645) MathRuntimeException with simple ebeMultiply on OpenMapRealVector

ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084678#comment-13084678 ]

Gilles commented on MATH-645:
-----------------------------

Probably fixed in revision 1157403.
Added a unit test for "ebeMultiply" and "ebeDivide".


> MathRuntimeException with simple ebeMultiply on OpenMapRealVector
> -----------------------------------------------------------------
>
>                 Key: MATH-645
>                 URL: https://issues.apache.org/jira/browse/MATH-645
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>              Labels: linear, sparse, vector
>
> The following piece of code
> {code:java}
> import org.apache.commons.math.linear.OpenMapRealVector;
> import org.apache.commons.math.linear.RealVector;
> public class DemoBugOpenMapRealVector {
>     public static void main(String[] args) {
>         final RealVector u = new OpenMapRealVector(3, 1E-6);
>         u.setEntry(0, 1.);
>         u.setEntry(1, 0.);
>         u.setEntry(2, 2.);
>         final RealVector v = new OpenMapRealVector(3, 1E-6);
>         v.setEntry(0, 0.);
>         v.setEntry(1, 3.);
>         v.setEntry(2, 0.);
>         System.out.println(u);
>         System.out.println(v);
>         System.out.println(u.ebeMultiply(v));
>     }
> }
> {code}
> raises an exception
> {noformat}
> org.apache.commons.math.linear.OpenMapRealVector@7170a9b6
> Exception in thread "main" org.apache.commons.math.MathRuntimeException$6: map has been modified while iterating
> at org.apache.commons.math.MathRuntimeException.createConcurrentModificationException(MathRuntimeException.java:373)
> at org.apache.commons.math.util.OpenIntToDoubleHashMap$Iterator.advance(OpenIntToDoubleHashMap.java:564)
> at org.apache.commons.math.linear.OpenMapRealVector.ebeMultiply(OpenMapRealVector.java:372)
> at org.apache.commons.math.linear.OpenMapRealVector.ebeMultiply(OpenMapRealVector.java:1)
> at DemoBugOpenMapRealVector.main(DemoBugOpenMapRealVector.java:17)
> {noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (MATH-645) MathRuntimeException with simple ebeMultiply on OpenMapRealVector

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Gilles resolved MATH-645.
-------------------------

       Resolution: Fixed
    Fix Version/s: 3.0

> MathRuntimeException with simple ebeMultiply on OpenMapRealVector
> -----------------------------------------------------------------
>
>                 Key: MATH-645
>                 URL: https://issues.apache.org/jira/browse/MATH-645
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>              Labels: linear, sparse, vector
>             Fix For: 3.0
>
>
> The following piece of code
> {code:java}
> import org.apache.commons.math.linear.OpenMapRealVector;
> import org.apache.commons.math.linear.RealVector;
> public class DemoBugOpenMapRealVector {
>     public static void main(String[] args) {
>         final RealVector u = new OpenMapRealVector(3, 1E-6);
>         u.setEntry(0, 1.);
>         u.setEntry(1, 0.);
>         u.setEntry(2, 2.);
>         final RealVector v = new OpenMapRealVector(3, 1E-6);
>         v.setEntry(0, 0.);
>         v.setEntry(1, 3.);
>         v.setEntry(2, 0.);
>         System.out.println(u);
>         System.out.println(v);
>         System.out.println(u.ebeMultiply(v));
>     }
> }
> {code}
> raises an exception
> {noformat}
> org.apache.commons.math.linear.OpenMapRealVector@7170a9b6
> Exception in thread "main" org.apache.commons.math.MathRuntimeException$6: map has been modified while iterating
> at org.apache.commons.math.MathRuntimeException.createConcurrentModificationException(MathRuntimeException.java:373)
> at org.apache.commons.math.util.OpenIntToDoubleHashMap$Iterator.advance(OpenIntToDoubleHashMap.java:564)
> at org.apache.commons.math.linear.OpenMapRealVector.ebeMultiply(OpenMapRealVector.java:372)
> at org.apache.commons.math.linear.OpenMapRealVector.ebeMultiply(OpenMapRealVector.java:1)
> at DemoBugOpenMapRealVector.main(DemoBugOpenMapRealVector.java:17)
> {noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira