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,