Efficient Java Matrix Library

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by imported>Deltaspace42 at 15:30, 22 December 2023 (added Category:Software using the Apache license using HotCat). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Efficient Java Matrix Library
Original authorPeter Abeles
Stable release
0.41.1 / December 4, 2022; 3 years ago (2022-12-04)
Repository
  • {{URL|example.com|optional display text}}Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
Engine
    Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
    Operating systemCross-platform
    TypeLibrary
    LicenseApache License
    Websiteejml.org

    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 both small and large 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. The procedural style provides all capabilities of EJML and almost complete control over matrix creation, speed, and specific algorithms. The SimpleMatrix style provides a simplified subset of the core capabilities in an easy to use flow-styled object-oriented API, inspired by JAMA. The Equations style provides a symbolic interface, similar in spirit to Matlab and other CAS, that provides a compact way of writing equations.[1]

    Capabilities

    [edit | edit source]

    EJML provides the following capabilities for dense matrices.

    • 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, ... )
    • Different Internal Formats (row-major, block)
    • Unit Testing

    Usage examples

    [edit | edit source]

    Equation style

    [edit | edit source]

    Computing the Kalman gain:

    eq.process("K = P*H'*inv( H*P*H' + R )");
    

    Procedural style

    [edit | edit source]

    Computing Kalman gain:

    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 style

    [edit | edit source]

    Example of singular value decomposition (SVD):

    SimpleSVD s = matA.svd();
    SimpleMatrix U = s.getU();
    SimpleMatrix W = s.getW();
    SimpleMatrix V = s.getV();
    

    Example of matrix multiplication:

    SimpleMatrix result = matA.mult(matB);
    

    DecompositionFactory

    [edit | edit source]

    Use of a DecompositionFactory to compute a Singular Value Decomposition with a Dense Double Row Major matrix (DDRM):[2]

    SingularValueDecomposition_F64<DenseMatrix64F> svd = 
        DecompositionFactory_DDRM.svd(true, true, true);
    
    if (!DecompositionFactory.decomposeSafe(svd, matA))
        throw new DetectedException("Decomposition failed.");
    
    DenseMatrix64F U = svd.getU(null, false);
    DenseMatrix64F S = svd.getW(null);
    DenseMatrix64F V = svd.getV(null, false);
    

    Example of matrix multiplication:

    CommonOps_DDRM.mult(matA, matB, result);
    

    See also

    [edit | edit source]

    References

    [edit | edit source]
    1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    [edit | edit source]