Frequently Asked Questions

From Efficient Java Matrix Library
Jump to: navigation, search
  1. summary Frequently Asked Questions

Frequently Asked Questions

Here is a list of frequently asked questions about EJML. Most of these questions have been asked and answered several times already.

Why does EJML crash when I try to process a very large matrix?

If you are working with large matrices first do a quick sanity check. Ask yourself, how much memory is that matrix using and can my computer physically store it? Compute the number of required gigabytes with the following equation:

 memory in gigabytes = (columns * rows*8)/(1024*1024*1024)

Now take the number and multiply it by 3 or 4 to take in account overhead/working memory and that's about how much memory your system will need to do anything useful. This is true for ALL dense linear algebra libraries. EJML is also limited by the size of a Java array, which can have at most 2^32 elements. If you are lucky the system is sparse (mostly zeros) and there problem might actually be feasible using other libraries, see below.

The other potentially fatal problem is that very large matrices are very slow to process. So even if you have enough RAM on your computer the time to compute the solution could well exceed the lifetime of a typical human.

Will EJML work on Android?

Yes EJML has been used for quite some time on Android. The library does include a tinny bit of swing code, which will not cause any problems as long as you do not call anything related to visualization. In Android Studio simply reference the latest jar on the Maven central repository. See [Download] for how to do that.


Currently EJML is entirely single threaded. The plan is to max out single threaded performance by finishing block algorithms implementations, then declare the library to be at version 1.0. After that has happened, start work on multi-threaded implementations. However, there is no schedule in place for when all this will happen.

The main driving factor for when major new features are added is when I personally need such a feature. I'm starting to work on larger scale machine learning problems, so there might be a need soon. Another way to speed up the process is to volunteer your time and help develop it.

Sparse Matrix Support

EJML's current focus is on dense matrices, but could be extended in the future to support sparse matrices. In the mean time the following libraries do provide some support for sparse matrices. Note: I have not used any of these libraries personally with sparse matrices.

 * CSparseJ
 * la4j
 * MTJ

How do I do cross product?

Cross product and other geometric operations are outside of the scope of EJML. EJML is focused on linear algebra and does not aim to mirror tools such as Matlab.

What version of Java?

EJML can be compiled with Java 1.6 and beyond. With a few minor modifications to the source code you can get it to compile with 1.5.