Jump to content

OjAlgo

From Alfawiki
Adapted from the English Wikipedia article OjAlgo, available under CC BY-SA 4.0Updated 9 August 2025
oj! Algorithms
Company typeOpen source software library
IndustrySoftware, Mathematics, Finance
Founded2003
ProductsJava library for mathematics, linear algebra, optimization, financial utilities

oj! Algorithms, also known as ojAlgo, is an open source Java library designed for mathematics, linear algebra, and optimization tasks. Introduced in 2003, this library is developed entirely in pure Java without relying on any external libraries. Its capabilities are especially advantageous for applications within the financial sector.

Capabilities

  • Java-based Linear algebra: a comprehensive, multi-threaded package delivering high performance.
  • Optimization functionalities including solvers for LP, QP, and MIP problems.
  • Financial utilities:
    • Management of time series data through CalendarDateSeries, CoordinationSet, and PrimitiveTimeSeries classes.
    • Support for stochastic processes and random number generation facilitating Monte Carlo simulations.
    • Implementations of Modern Portfolio Theory models such as Markowitz and Black-Litterman.
    • Facilities to retrieve data from Yahoo Finance and Google Finance.

Starting with version 38, ojAlgo mandates Java 8 as the minimum runtime environment. From version 44.0 onwards, finance-related components have been modularized into a distinct package called ojAlgo-finance.

Usage example

Example demonstrating singular value decomposition: <syntaxhighlight lang="java"> SingularValue<Double> svd = SingularValueDecomposition.make(matA); svd.compute(matA);

MatrixStore<Double> U = svd.getQ1(); MatrixStore<Double> S = svd.getD(); MatrixStore<Double> V = svd.getQ2(); </syntaxhighlight>

Example illustrating matrix multiplication: <syntaxhighlight lang="java"> PrimitiveDenseStore result = FACTORY.makeZero(matA.getRowDim(), matB.getColDim()); result.fillByMultiplying(matA, matB); </syntaxhighlight>