dwuab / information-dynamics-toolkit

Automatically exported from code.google.com/p/information-dynamics-toolkit
GNU General Public License v3.0
0 stars 0 forks source link

Replace org.octave.Matrix calls with our own class #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Conversion between native octave types and java types is not always working 
correctly in octaveToJavaDoubleArray, octaveToJavaDoubleMatrix, 
octaveToJavaIntArray and octaveToJavaIntMatrix, as identified by Christoph 
Hartmann:

"The bug seems to be in the octaveToJavaDoubleMatrix.m. Whenever the Java 
Matrix is created there with javaObject('org.octave.Matrix',...), it sometimes 
returns an int matrix and sometimes a double matrix. Whenever an int-matrix is 
returned, the .asDoubleMatrix() returns null, which leads to the NullPointer 
Exception. I suspect that this happens because the int-constructor is called 
instead of the double-constructor [2], but different forms of casting the 
values to double or the dimensions to int did not help."

The issue appears to be that octave is somehow not identifying the correct 
method signature in org.octave.Matrix. This bug is repeatable in 
octave/example6, which should load an array of doubles from a file, but somehow 
these are read into octave as integers. It is unclear why.

Solution appears to be to make the typing explicit in the method signatures, 
rather than to let octave decide it for us,

Original issue reported on code.google.com by joseph.lizier on 29 Apr 2014 at 1:32

GoogleCodeExporter commented 9 years ago
Patched under r302 and r303, by introducing our own modified org.octave.Matrix 
as infodynamics.utils.OctaveMatrix, which has typing explicit in the method 
signatures, therefore taking octave automated signature matching out of the 
loop.

Need to comment on this in the comments on the wiki for the Octave/Matlab 
examples.

Also need to get Christoph Hartmann to verify.

Original comment by joseph.lizier on 29 Apr 2014 at 1:37

GoogleCodeExporter commented 9 years ago
Patch fixed my problems. Thanks a lot!

-- Christoph Hartmann

Original comment by christop...@gmail.com on 29 Apr 2014 at 12:03

GoogleCodeExporter commented 9 years ago
Thanks for the confirmation Christoph -- I'm moving the status here to Verified 
and closing the issue.

Original comment by joseph.lizier on 29 Apr 2014 at 12:51