Self-hosted service
owlbarn/owl avatar
owlbarn/owl

Owl: An OCaml Scientific Computing Stack With Three Different Ndarray Backends

Owl - OCaml Scientific Computing @ https://ocaml.xyz

1,350 stars131 forksOCamlMIT

At a glance

What is it?
Owl is the long-running numerical library for OCaml, offering n-dimensional arrays, linear algebra, automatic differentiation, optimization, and neural networks. Its README documents three distinct Ndarray implementations, and that split is the thing to understand before adopting it.
Who is it for?
Adopt Owl if your team already writes OCaml and needs tensors, linear algebra, autograd, or neural networks without leaving the language; the MIT licence and the 1.2 release from December 2024 make it a reasonable base for that. Do not adopt it if you need a plotting stack without pulling in owl-plot, or if you cannot tolerate the performance gap the README attributes to the pure OCaml base Ndarray.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 42 days ago.
What is it written in?
Mainly OCaml, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The Gap Owl Fills: Numerical Work Without Leaving OCaml

OCaml is a statically typed functional language with a mature compiler and a small but serious industrial user base. What it has historically lacked is a first-class numerical stack: the kind of library that gives you n-dimensional arrays, slicing and broadcasting, linear algebra, statistics, and the higher-level machinery built on top, such as optimization and neural networks. Owl is that library. The README describes it as a dedicated system for scientific and engineering computing, developed in OCaml and licensed under MIT, originated by Liang Wang and currently led by Jianxin Zhao.

The intended audience is narrow and specific. It is researchers and engineers who already write OCaml, or who are willing to, and who want to keep their numerical code in the same language as the rest of their application instead of shelling out to Python or writing a C extension. The README states the mission plainly: to provide researchers and industry programmers a framework for concise, fast and safe analytical code, and to serve as the de-facto tool for computation intensive tasks in OCaml. That last phrase is the honest framing. Owl is not trying to beat NumPy at NumPy's game. It is trying to make OCaml a viable place to do this work at all.

Three Ndarray Types, and Why the Split Matters

The most important thing in the README is not the feature list. It is the architecture note, which describes three separate Ndarray implementations sharing a common interface.

The first is the main Ndarray, the base data structure for modern numerical computing. It sits on mathematics, linear algebra, and statistics functions built on both OCaml and C functions and libraries. This is the backend that carries the advanced functionality.

The second is the base system Ndarray, implemented in pure OCaml. The README is direct about the consequences: it shares the same interface, but does not implement some advanced functions found in the other Ndarray, and its performance is described as understandably much slower. That is a real constraint, not a footnote. If you pick the pure OCaml path for portability, you are trading function coverage and speed for the absence of a C dependency.

The third is CGraph-Ndarray, which supports symbolic-style computing in the manner of TensorFlow v1. It exists to build computation graphs and perform computation optimization. Critically, CGraph-Ndarray does not execute on its own. It wraps one of the other two Ndarray types, and those perform the actual execution. So the graph layer is a planning and optimization layer over a concrete array backend, not a fourth engine.

All three feed the higher-level modules: algorithmic differentiation, optimization, and neural networks. The README lists regression, ordinary differential equations, discrete Fourier transforms, dataframe processing, and MCMC among the topics, with visualization handled by an external package, owl-plot. The practical consequence of this design is that your choice of backend determines which functions exist and how fast they run, and that choice propagates upward into autograd and neural network code.

Getting Owl Running: The Documented Path

The README does not inline an install command. It points to a tutorial at ocaml.xyz covering installation, and mentions Docker images published as matrixanger/owl on Docker Hub as an alternative starting point. That is the entirety of the installation guidance in the repository README, and it is worth saying so plainly: if you want a copy-pasteable opam invocation, the README will not give it to you, and I cannot supply one from this material.

What the README does document is the contribution path, which tells you something about how changes reach users. In principle any change to the code base is made via a GitHub pull request, and pull requests must be reviewed and approved by at least two key developers. Team members own the issues and PRs in the domain aspects they claim, and are responsible for fixing problems caused by accepting those PRs. Large PRs or ones that touch code structure require a prior issue for community and team discussion, after which the decision rests with the corresponding team member and the project leader. If a PR falls outside every team member's declared domain, the response is best-effort with no guaranteed response time. That last clause is the one to internalize if you are planning to depend on a fix: some areas of the codebase have a named owner, and some do not.

Where Owl Is the Wrong Tool

The pure OCaml base Ndarray is the clearest limitation in the material, and it is a limitation the project states itself. It shares the interface but omits advanced functions and runs much slower. That means a team that chooses it for a clean, C-free build should expect to hit missing functions in exactly the areas where scientific code tends to concentrate: the advanced linear algebra and statistics routines that the main Ndarray gets from its C backing.

The second limitation is structural. CGraph-Ndarray only makes sense if you want graph construction and optimization. If you are writing straightforward imperative numerical code, the graph layer adds a concept without adding value, and you still need one of the two concrete backends underneath.

The third is scope. Visualization is not in Owl. The README lists it as a functionality but immediately attributes it to the external package owl-plot. If plotting is central to your workflow, you are adopting two packages, not one, and the README tells you nothing about owl-plot's own maturity or installation.

Finally, there is the question of fit. Owl is written in OCaml. If your team does not write OCaml, the cost of adoption is not the library, it is the language, its build tooling, and its ecosystem. The README's own framing, that the project aims to actively maintain and keep stable utilizing the limited time and human resource available, is a signal about pace rather than a promise about scope.

The Real Alternative Is Not Another OCaml Library

For most teams evaluating Owl, the honest alternative is Python with NumPy and the surrounding scientific stack, not a different OCaml package. The difference is not a feature checklist, it is where the boundary of the system sits.

In the Python model, the array library, the plotting library, the dataframe library, and the deep learning framework are separate projects with separate release cycles and separate dependency graphs. You assemble them. In Owl, the README describes a single system that spans tensors, linear algebra, statistics, ODEs, FFTs, algorithmic differentiation, optimization, regression, neural networks, dataframe processing, and topic modeling, with plotting delegated to one external package. The interfaces are shared: the same Ndarray interface is implemented three times, and the higher-level modules are written against it.

That consolidation is the actual argument for Owl. If you are already in OCaml, you get one dependency instead of five, one type system instead of a language boundary, and one set of array semantics across autograd, optimization, and neural network code. If you are not in OCaml, that argument evaporates, because the cost of switching languages dwarfs the cost of assembling Python packages. The CGraph layer is the one place where Owl's approach differs from modern Python frameworks in a way that matters: symbolic graph construction with optimization, in the TensorFlow v1 style, is a design that the Python ecosystem has largely moved away from in favor of eager execution. Owl keeps both, since CGraph wraps the eager backends rather than replacing them.

Maintenance, Releases, and the MIT Licence

The release history in the repository is sparse. Version 1.2 landed on 2024-12-24, version 1.1 on 2023-02-15, and version 1.0.2 on 2022-02-14. That is a cadence measured in roughly a year between minor releases, which is consistent with the README's statement that the project aims to keep stable using limited time and human resources. Plan for the possibility that a bug you report sits for a while, particularly if it falls outside a team member's declared domain, since the README explicitly says such responses are best-effort with no guaranteed response time.

Upgrade cost is hard to estimate from the material alone. The README does not describe a deprecation policy, a versioning scheme beyond the numbers, or a changelog. What it does tell you is that the codebase is designed to be concise and self-contained, and that contributors who want to build their own tools on top are encouraged to create new repositories in the Owlbarn organization. That suggests a deliberate preference for keeping the core small and pushing extensions outward, which tends to make the core more stable but means adjacent functionality may live in repositories with their own maintenance situations.

The licence is MIT. That is permissive: it allows use, modification, and redistribution with minimal conditions, typically requiring preservation of the copyright notice and licence text. I am not giving legal advice, and the exact obligations depend on your distribution model and jurisdiction. Read the LICENSE file in the repository and, if you are shipping a product, have counsel review it. The relevant point for an engineering decision is that MIT is the least restrictive common option and is unlikely to be the reason a legal review blocks adoption.

Who Should Adopt Owl, and What to Check First

Adopt Owl if you write OCaml and need tensors, linear algebra, statistics, automatic differentiation, optimization, or neural networks in the same language as your application. The feature surface described in the README is broad, the licence is permissive, and the project is actively maintained at a stable, unhurried pace. The three-backend design gives you a genuine choice between maximum functionality with C dependencies and a pure OCaml build with reduced coverage and speed.

Do not adopt Owl if your team is not in OCaml and has no intention of moving there. Do not adopt it if you need plotting as part of the core dependency, since that lives in owl-plot. Do not adopt the pure OCaml base Ndarray expecting parity with the main one; the README states the opposite.

Before you commit, verify three things against your own environment. First, which Ndarray backend the functions you need are implemented in, since the base version omits advanced functions. Second, that your toolchain satisfies whatever the installation tutorial at ocaml.xyz requires, because the README itself does not specify versions. Third, that any C libraries the main Ndarray links against are present and buildable in your target deployment image, including in CI. Those three checks come directly from the repository's own description of its architecture, and they are where an adoption attempt is most likely to stall.

Editorial conclusion

Adopt Owl if your team already writes OCaml and needs tensors, linear algebra, autograd, or neural networks without leaving the language; the MIT licence and the 1.2 release from December 2024 make it a reasonable base for that. Do not adopt it if you need a plotting stack without pulling in owl-plot, or if you cannot tolerate the performance gap the README attributes to the pure OCaml base Ndarray. Before committing, verify which backend your target functions actually live in, check that your OCaml and opam versions match what the tutorial expects, and confirm whether the C libraries Owl links against are available in your deployment image.

Official sources

  1. Issues
  2. License: MIT
  3. owlbarn/owl on GitHub
  4. README
  5. Releases
Community notes

Community notes