Coder Social home page Coder Social logo

la4j's Introduction

la4j logo

The la4j is open source and 100% Java library that provides Linear Algebra primitives (matrices and vectors) and algorithms. The la4j was initially designed to be lightweight and simple tool for passionate Java developers. It has been started as student project and turned into one of the most popular Java packages for matrices and vectors.

The key features of the la4j are listed bellow:

  • Great performance allied with beautiful design
  • No dependencies and tiny size (~150kb jar)
  • Fluent and object-oriented/functional API
  • Sparse (CRS, CCS) and dense (1D/2D arrays) matrices and vectors
  • Linear systems solving (Gaussian, Jacobi, Zeidel, Square Root, Sweep and other)
  • Matrices decomposition (Eigenvalues/Eigenvectors, SVD, QR, LU, Cholesky and other)
  • Functors support: predicates, functions, procedures and accumulators
  • MatrixMarket/CSV IO formats support

Brief Examples

Matrix inversion

// We want simple dense matrix that uses 2D array as internal representation
Matrix a = new Basic2DMatrix(new double[][] {
   { 1.0, 2.0, 3.0 },
   { 4.0, 5.0, 6.0 },
   { 7.0, 8.0, 9.0 }
});

// We will use Gauss-Jordan method for inverting
MatrixInverter inverter = a.withInverter(LinearAlgebra.GAUSS_JORDAN);
// The 'b' matrix will be dense
Matrix b = inverter.invert(LinearAlgebra.DENSE_FACTORY);

System of linear equations

// The coefficient matrix 'a' is a CRS (Compressed Sparse Row) matrix 
Matrix a = new CRSMatrix(new double[][] {
   { 1.0, 2.0, 3.0 },
   { 4.0, 5.0, 6.0 },
   { 7.0, 8.0, 9.0 }
});

// A right hand side vector, which is simple dense vector
Vector b = new BasicVector(new double[] {
   1.0, 2.0, 3.0
});

// We will use standard Forward-Back Substitution method,
// which is based on LU decomposition and can be used with square systems
LinearSystemSolver solver = a.withSolver(LinearAlgebra.FORWARD_BACK_SUBSTITUTION);
// The 'x' vector will be sparse
Vector x = solver.solve(b, LinearAlgebra.SPARSE_FACTORY);

Matrix decomposition

// We want simple dense matrix, which is based on 1D double array
Matrix a = new Basic1DMatrix(new double[][] {
   { 1.0, 2.0, 3.0 },
   { 4.0, 5.0, 6.0 },
   { 7.0, 8.0, 9.0 }
});

// We will use LU decompositor
MatrixDecompositor decompositor = a.withDecompositor(LinearAlgebra.LU);
// The result should be treated as: L = lup[0], U = lup[1], P = lup[2]
Matrix[] lup = decompositor.decompose(LinearAlgebra.DENSE_FACTORY);

Changelog

See CHANGELOG.md

Download

Details of the last version of the la4j can be found on the project web site http://la4j.org or its GitHub page https://github.com/vkostyukov/la4j.

Licensing

This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

How To Contribute

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

Contributors

See CONTRIBUTORS.md


by Vladimir Kostyukov, 2011-2014

Bitdeli Badge

la4j's People

Contributors

vkostyukov avatar samoylovmd avatar jakobmoellers avatar maseev avatar yuronew avatar hisohito avatar danielrenshaw avatar nfgrusk avatar philmes avatar acharuva avatar toddinportland avatar cskau avatar dexterp37 avatar jakrin avatar aash avatar bitdeli-chef avatar cjmay avatar kalaidin avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.