
Efficient Java Matrix Library (EJML) is a linear algebra library for manipulating real/complex/dense/sparse matrices. Its design goals are; 1) to be as computationally and memory efficient as possible for small and large, dense and sparse, real and complex matrices, and 2) to be accessible to both novices and experts. These goals are accomplished by dynamically selecting the best algorithms to use at runtime, clean API, and multiple interfaces. EJML is free, written in 100% Java and has been released under an Apache v2.0 license.
EJML has three distinct ways to interact with it: 1) procedural, 2) SimpleMatrix, and 3) Equations. Procedure provides all capabilities of EJML and almost complete control over memory creation, speed, and specific algorithms. SimpleMatrix provides a simplified subset of the core capabilities in an easy to use flow styled objectoriented API, inspired by Jama. Equations is a symbolic interface, similar in spirit to Matlab and other CAS, that provides a compact way of writing equations.

News


 Read and write EJML in Matlab format with MFL from HEBI Robotics
 Graph BLAS continues to be flushed out with masks being added to latest SNAPSHOT
 Concurrency/threading has been added to some operations

Code Examples
Demonstrations on how to compute the Kalman gain "K" using each interface in EJML.
Procedural
mult(H,P,c);
multTransB(c,H,S);
addEquals(S,R);
if( !invert(S,S_inv) )
throw new RuntimeException("Invert failed");
multTransA(H,S_inv,d);
mult(P,d,K);
SimpleMatrix
SimpleMatrix S = H.mult(P).mult(H.transpose()).plus(R);
SimpleMatrix K = P.mult(H.transpose().mult(S.invert()));
Equations
eq.process("K = P*H'*inv( H*P*H' + R )");

Functionality
Data Structures 
Operations

 Fixed Sized
 Matrix 2x2 to 6x6
 Vector 2 to 6
 Dense Real
 Dense Complex
 Sparse Real

 Full support for floats and doubles
 Basic Operators (addition, multiplication, ... )
 Matrix Manipulation (extract, insert, combine, ... )
 Linear Solvers (linear, least squares, incremental, ... )
 Decompositions (LU, QR, Cholesky, SVD, Eigenvalue, ...)
 Matrix Features (rank, symmetric, definitiveness, ... )
 Random Matrices (covariance, orthogonal, symmetric, ... )
 Unit Testing

.
Decomposition 
Dense Real 
Dense Complex 
Sparse Real 
Sparse Complex

LU 
X 
X 
X 

Cholesky LL 
X 
X 
X 

Cholesky LDL 
X 



QR 
X 
X 
X 

QRP 
X 



SVD 
X 



EigenSymmetric 
X 



EigenGeneral 
X 



Support for floats (32bit) and doubles (64bit) is available. Sparse matrix support is only available for basic operations at this time.