I was working on an Android app that requires some linear algebra with matrices. The matrices will be somewhat medium-sized as they are not too small or too big. I was originally using jBlas because of the benchmarks I have seen online but after visiting multiple forums, they have all said that jBlas would be nowhere near as fast as what the benchmarks originally state. I have also heard about the Snapdragon Math Library to help improve the speed but I have not heard too much about it. From the general community, what linear-algebra libraries do you recommend that will be the fastest to use on Android? All help is greatly appreciated!

  • $\begingroup$ Welcom to SciComp! Can you give some range for 'medium' size? Scientific computation spans 2x2 to millions of entries. Do you know anything about what kind of matrix we are talking about? Will these be sparse, symmetric, or is it some image-data which is expected to be dense? $\endgroup$
    – MPIchael
    Apr 27, 2020 at 9:05
  • $\begingroup$ Also, what fraction of your code's runtime will actually be spent in linear algebra? Is a 20% increase in performance for the linear algebra part of your program actually going to make a difference to the runtime of the overall program? $\endgroup$ Apr 27, 2020 at 12:57
  • $\begingroup$ I would say that close to 1/3 of the whole code's runtime will be spent doing several linear algebra operations. The matrix size will be close to 6 x 6 so it will not be sparse. $\endgroup$ Apr 27, 2020 at 16:30
  • $\begingroup$ I presume that jBlas is the Java frontend for BLAS/Lapack. These are very performant libraries on their own, but I can not say anything about their java performance. You could help us help you if you give us more info. Will you be doing lots of Matrix-vector products? Are you multiplying matrices a lot? Are you multiplying one matrix a zillion times, or a zillion matrix one time. This information can make a huge difference. $\endgroup$
    – MPIchael
    Apr 28, 2020 at 14:14
  • $\begingroup$ It sounds like this is either a convolutional neural network application or a graphics application where you apply few kernels over and over again. Did you check any libraries which supports those operations? Are you trying to create one yourself? I was checking Qualcomm Math Library for a demo I was preparing for some high school students. It is all good if you have a phone with Qualcomm processor but not so well with other devices, in my experience with 4 or 5 phones. I pivoted and just used my laptop in the end, it was both easier and more accessible though limited. $\endgroup$ Apr 29, 2020 at 3:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.