Essentially I want to call LAPACK's dlange with an empty workspace array, which is considered valid with the Fortran implementation.
Using JavaLAPACK and the old netlib-java by fommil, it is ok to pass null for the workspace array.
However, it seems to be required to pass new double[0] to NativeLAPACK in order to circumvent a segfault.
My guess is that it is always tried to resolve the workspace array in the JNI wrapper of the local native LAPACK,
which fails if the array is passed as null on the Java side.
My vague idea for a fix is to introduce an additional check in the JNI wrapper that maps a null array from the Java side to NULL passed to the native LAPACK method.
It would be great if you could fix this, since it would allow us to really use this library as a drop-in replacement for netlib-java.
Thanks in advance for your efforts in this case!
I am happy to provide more details on the problem and test potential fixes.
@jonathanschilling sorry for the delayed response. Yes, that seems like a no brainer, let me fix it. If you want to provide a test, that would be ideal.
Hi,
I just stumbled across an issue that popped up with JNILAPACK (which gets used by default on my machine). A minimal non-working example is found here: https://github.com/jonathanschilling/netlib_mnwe/blob/master/src/test/java/de/labathome/netlib_mnwe/NetlibMNWE.java
Essentially I want to call LAPACK's
dlange
with an empty workspace array, which is considered valid with the Fortran implementation. Using JavaLAPACK and the old netlib-java by fommil, it is ok to passnull
for the workspace array. However, it seems to be required to passnew double[0]
to NativeLAPACK in order to circumvent a segfault.My guess is that it is always tried to resolve the workspace array in the JNI wrapper of the local native LAPACK, which fails if the array is passed as
null
on the Java side. My vague idea for a fix is to introduce an additional check in the JNI wrapper that maps anull
array from the Java side toNULL
passed to the native LAPACK method.It would be great if you could fix this, since it would allow us to really use this library as a drop-in replacement for netlib-java.
Thanks in advance for your efforts in this case! I am happy to provide more details on the problem and test potential fixes.