oj! Algorithms – ojAlgo – is Open Source Java code to do mathematics,
linear algebra and optimisation.
High Performance on a Rich Feature Set with Zero Dependencies
Download the latest released version of
ojAlgo from SourceForge,
fork the source code at GitHub
or add the dependency from The
Central Repository with your favourite build tool.
- Latest released version is 46.3.0
- As of v38 ojAlgo requires Java 8.
- Java 7 users should instead use ojAlgo v37.1.1
- Up until v33 Java 5 was enough (effectively developed against Java
2018-10-12: Released ojAlgo v46.3
A minor release with big changes for the future:
- The BasicMatrix interface has been deprecated!!! The various
implementations will remain - all of them - but you should use those
directly/explicitly. Don't type anything as BasicMatrix. This version
changes nothing, The idea is that it'll be gone by v47.
- Now builds a separate test-jar artefact. It contains a test
utilities class that can be used by libraries that extend ojAlgo to
help test some ojAlgo specific types. This primarily changes how
ojAlgo-finance and ojAlgo-extensions depend on ojAlgo.
2018-10-04: Released ojAlgo v46.2
- Fixed a bug related to transposing ElementConsumer/Supplier
- Performance improvements on some SparseStore operations
- New feature: Artificial Neural Network support
- MIP (IntegerSolver) refactoring and improvements
- Clean-up of the BasicMatrix interface
- A few other
2018-06-18: Released ojAlgo v45.1.1
A couple of bugs fixed:
- The getEigenpair(int) method of the Eigenvalue interface threw an
- A couple of issues related to calculating the nullspace (using QR or
2018-06-09: Released ojAlgo-finance v1.1
No new features. This is just to make it compatible with the latest
version of ojAlgo.
It appears downloading historical data from Google and Yahoo broke
(again). The code related to this is marked as deprecated, and the tests
2018-05-15: New Java Matrix Benchmark Results
There are new results for the Java Matrix Benchmark coming. Keep track
these sites for updates in the coming weeks:
There are already, now, some new results published.
2018-04-13: Released ojAlgo v45.1
- Everything "Big" is deprecated. The intention is that RationalNumber
based implementations will be the replacements
- Introduction of 3 new interfaces Structure2D.ReducibleTo1D,
StructureAnyD.ReducibleTo1D and StructureAnyD.ReducibleTo2D as well as
implementations of those.
- Several bugs fixed
- Switched to using JUnit 5, and initiated a comprehensive test code
covering the latest 10 releases, will give more details on what's new.
Download the latest released version of ojAlgo from SourceForge,
fork the source code at GitHub
or add the dependency from The
Central Repository with your favourite build tool.
2018-02-03: Introducing okAlgo
ojAlgo is programmed in Java, but is often used by developers
programming in other JVM languages like Scala or Kotlin, or targeting a
platform like Android. All of this works fine with ojAlgo as it is, but
to fully exploit the capabilities of those other languages/platforms
some extensions may be desirable.
okAlgo contains thin wrappers of ojAlgo classes that enable idiomatic
Kotlin usage. Check
2017-09-27: Released ojAlgo v44 and ojAlgo-finance v1
The main news this time is that the finance specific code (the
org.ojalgo.finance package) has been moved to its own project/module
named ojAlgo-finance. Other than that the most important new features
- Improvements related to sparse and structured matrices.
- Several major improvements to the various optimisation solvers. Both
the LP and QP solvers now make better use of sparsity, and all solvers
have improved numerical stability.
2017-09-24: New/updated wiki pages about sparse and
custom data structures
2017-06-19: Downloading from Yahoo Finance fixed
About a month ago Yahoo deliberately broke downloading historical data
from their web site. This was not a problem with ojAlgo – it broke for
everyone. ojAlgo has now adapted to Yahoo's new method. The new code in
the master branch of the repository at GitHub,
and will of course be part the next release.
2017-04-22: Released ojAlgo v43
- Performance improvements to the SVD and EvD implementations. ojAlgo
was already a top performer among pure Java implementations – now it's
- Adapted to Yahoo Finance's new requirement to use https rather than
http when downloading historical financial data. (All finance related
– domain specific – code will be moved to its own project
ojAlgo-finance before the release of v44.)
- New package: org.ojalgo.tensor
2017-02-03: Stopped using the CVS repository at
With the v42 release the CVS repository at SourceForge
will be abandoned. From now on the source code will be maintained at
The author of EJML benchmark his library against several
other libraries – ojAlgo is one of them. To do that he created the Java
Matrix Benchmark. Executing that benchmark takes about 2 weeks. It
doesn't get executed very often! It is almost 2 years since the Java
Matrix Benchmark site last published any results. Now, finally the
wait is over...
2015-05-15: Now at The Central (Maven) Repository
ojAlgo is now available at The
Central Repository to be used with your favourite dependency
management tool. v38.0, that was released today, is the first official
Maven release. The versions currently existing as downloads from SourceForge
will also be made available. (Previously v31.0 existed by a third party
independent effort.) The intention is that all future releases will be
available at The Central Repository.
What's in ojAlgo?
- ojAlgo is the fastest pure Java linear algebra library available.
That statement is backed by the latest Java
Matrix Benchmark results – that's a third party independent
benchmark (not written by anyone associated with ojAlgo).
- Optimisation (mathematical programming) tools including LP, QP and
MIP solvers – again this is pure Java with zero dependencies.
- A collection of "array" classes that can be sparse or dense and
arbitrarily large. They can be used as 1-, 2- or N/Any-dimensional
arrays, and may contain/handle a multitude of different number types
including complex numbers, rational numbers and quaternions. The
memory for the arrays can alternatively be allocated off heap or in a
file. The linear algebra part of ojAlgo builds on these arrays –
they're fast and efficient.
- Various other things like time series, random numbers, stochastic
processes, descriptive statistics...
Much of the development has been motivated by various financial
applications. Up until (v44) ojAlgo contained domain (finance) specific
code. With v44 this has been moved to its own code repository and will
be released as a separate artefact: ojAlgo-finance
It contains code that allow you to:
- Download historical data from Yahoo Finance or Google Finance
- Patch, transform and analyse time series data
- Construct/optimise portfolios
- Generate future market scenarios
- Simulate the behaviour of portfolios
Everything necessary to do that is in ojAlgo-finance – it has no
dependencies other than ojAlgo (the core/base artefact).
BLaadin Edge Financial Systems
BLaadin is a financial market simulation tool. It facilitates market
analysis and forecasting as well as making portfolio recommendations. In
particular it asserts consistency between forecasts and recommendations.
At its core it makes use of the Black-Litterman model.
Information about BLaadin is currently maintained at the BLaadin
Edge Financial Systems site.
There is a "public beta" version of BLaadin available on-line as a
cloud service. The BLaadin Edge Financial
Systems site contains information about how to find and use it.
BLaadin has its origin in a cooperation between Optimatika and the
Royal Institute of Technology in Stockholm (KTH). That cooperation aimed
to develop a prototype system/application using the Black-Litterman
model, and to use that application in a behavioural finance case study.
The case study resulted in a PhD thesis.
That was years ago... The prototype died and was revitalised several
times until it was finally completely rewritten with a much more
ambitious goal. BLaadin is now a full-fledged market simulation and
portfolio construction tool.
BLaadin is programmed in Java, and everything related to mathematics
and financials is in ojAlgo. BLaadin is NOT open source! ojAlgo is, but
not BLaadin. The on-line "public beta" is free for you to try.
ojAlgo has zero dependencies, but through various extension modules it
integrates with 3:d party libraries.
Copyright and License
ojAlgo is an Open Source project. It is available as source code, and
every single source code file contain a copyright statement and a
license agreement. All files have the same copyright and license. Optimatika
holds the copyright, and the license used is the generous and easy to
license. Please read and comply with the license agreement – it's
- Code for the JVM: There are no calls to native (C or Fortran)
libraries. ojAlgo is primarily a Java library, but will, if posible,
adapt its code so that other languages that run on the JVM can also
use it. (Scala, Android and Kotlin programmers are already sucessfully
- No dependencies: NOTHING besides a JDK is needed to compile or
execute the code. In fact ojAlgo only requires the Compact Profile
- Write code that scales: When choosing algorithms and data structures
ojAlgo often favours designs that perform well on larger more complex
cases, even if it's more than what's currently required.
- Anything and everything may change in the future (breaking API
compatibility). Part of the code is "in production" in commercial
systems – but will be changed if improvements require it.
Documentation, Support & Services
User documentation with code examples is at the GitHub
wiki. Don't forget to check out the various README files in the
Programming questions related to ojAlgo are best asked at
overflow. Just remember to actually mention ojAlgo and tag the
question using 'ojalgo' and whatever other tags you find suitable.
Bug reports, and to some extent feature requests should be posted at GitHub
Issues. (Please do not use GitHub Issues for general discussions
or support requests!)
mailing list can be used for just about anything as long as it
relates to ojAlgo. Regarding the list:
- You have to be a member to be able to post to the list - anyone can
- All new members are moderated until the administrator decides to
trust them (usually with their first post).
- There is a searchable
list archive. It's a low volume list, but it's been around since
2003 so there is content to search and information to find.
ojAlgo is Open Source, and you are strongly encouraged to
clone or fork the repository and work directly with the source code. The
source code is (part of) the documentation, and you should read it.
Optimatika is a software consulting company specialising
in decision support systems – particularly optimisation and applied
maths related to finance.
- Optimatika offers commercial support for ojAlgo.
- Optimatika accepts commissions to extend ojAlgo.
- Even without ojAlgo, Optimatika can help you build high performance
In these cases please contact
- In the late 90:s the MathWorks and NIST released JAMA,
a public-domain Java matrix package reference implementation. It's
still available and still widely used. More so its matrix
decomposition implementations have been used (copied) in many other
linear algebra packages. ojAlgo also contains code that originates
from JAMA. ojAlgo has surpassed JAMA in every way, but probably
wouldn't be here without it. The earliest ojAlgo versions contained
simple optimisation algorithms using JAMA for linear algebra.
- Peter Abeles created the Java
Matrix Benchmark (to benchmark his EJML against other Java
linear algebra packages). ojAlgo was included in the benchmark and
right from the start performed fairly well, but the benchmark did
identify a few areas that could be improved. By now those "problems"
are fixed, and whether you benchmark numerical accuracy, memory
consumption or (cpu time) performance you'll see that ojAlgo is a top
- For many years now ej-technologies have provided a JProfiler
license for the development of ojAlgo. Having an easy to use profiler
has been very valuable to the development of ojAlgo. It's not a tool
you use every day, but every time we use it we learn something about
Project and site sponsored by Optimatika
Copyright © 1997 - 2017