0

I need to use matrix exponential function for my Android application. I have used the library jblas (jblas.org). But it returns the following error and the application crashes!

java.lang.UnsatisfiedLinkError: No implementation found for void         
org.jblas.NativeBlas.dgemm(char, char, int, int, int, double, double[], 
int, int, double[], int, int, double, double[], int, int) (tried 
Java_org_jblas_NativeBlas_dgemm and 
Java_org_jblas_NativeBlas_dgemm__CCIIID_3DII_3DIID_3DII)
        at org.jblas.NativeBlas.dgemm(Native Method)
        at org.jblas.SimpleBlas.gemm(SimpleBlas.java:247)
        at org.jblas.DoubleMatrix.mmuli(DoubleMatrix.java:1781)
        at org.jblas.DoubleMatrix.mmul(DoubleMatrix.java:3138)
        at org.jblas.MatrixFunctions.expm(MatrixFunctions.java:428)
shizhen
  • 12,251
  • 9
  • 52
  • 88
Chaitanya_klk
  • 51
  • 1
  • 4
  • you need have the corresponding `.so` in place for the required ABI, e.g. `arm64-v8a` for most of devices and `x86` or `x86_64` for emulators. So, do check if you have them inside your apk. – shizhen Nov 19 '18 at 01:18
  • @shizhen If possible may I know the respective .so I need and how to include it in my apk? – Chaitanya_klk Nov 19 '18 at 02:41
  • **jblas** was not originally for Android, in order to make it work on Android, maybe you need to add the jar but also need to compile its C source code for the required ABIs. – shizhen Nov 19 '18 at 02:54

1 Answers1

0

Try these steps to get an Android version of jblas:

  1. Checkout the source code of jblas from: https://github.com/mikiobraun/jblas
  2. Recompile the c source code: https://github.com/mikiobraun/jblas/tree/master/src/main/c using Android CMake tool chains. You will get the required shared libs, e.g. arm64-v8a, x86 or x86_64.
shizhen
  • 12,251
  • 9
  • 52
  • 88
  • It generates the following warnings if I run the code : 1) warning: incompatible pointer types passing 'void **' to parameter of type 'JNIEnv **' (aka 'const struct JNINativeInterface ***') [-Wincompatible-pointer-types] (*JVMcache)->AttachCurrentThread(JVMcache, (void **)&envPtr, NULL); // attach this thread to the globally cache JVM – Chaitanya_klk Nov 19 '18 at 04:39
  • And also, warning: implicitly declaring library function 'cimag' with type 'double (_Complex double)' [-Wimplicit-function-declaration] return createObject(env, CORE_PACKAGE "ComplexDouble", "(DD)V", creal(dc), cimag(dc)); note: include the header or explicitly provide a declaration for 'cimag' Even if the header is already included!! – Chaitanya_klk Nov 19 '18 at 04:41