The state of linear algebra in OCaml

Hello everyone,

How is the state of linear algebra in OCaml compared to languages like Julia where there’s a lot going on in Linear algebra field. A lot of algorithm and methods are implemented, I’m interested mainly in matrix decomposition methods and some iterative methods as well. So

  • How is the support in OCaml?
  • Will a float32 type ever be available on OCaml base?
  • Is there a good linear algebra module written in pure OCaml with high performance?

For matrix decomposition methods (including iterative ones), I think that Owl is currently the most comprehensive library. There are also bindings to BLAS and LAPACK available through Lacaml. It is also worth mentioning Raven, which is currently under development.

In terms of performance, matrix operations are comparable to NumPy in Python or Julia, as they are ultimately based on OpenBLAS (see also this link)

  • Will a float32 type ever be available on OCaml base?

I think that float16, float32 and float64 (arrays) are supported from longtime ago in OCaml, see for example Bigarray library

  • Is there a good linear algebra module written in pure OCaml with high performance?

To my knowledge, the most promising pure OCaml solution for high-performance computing is nx-raven (currently under development).

1 Like

Thank you for your reply.

Right now I think Owl is useful for me and it cover all my needs. There’s this nice owl-tutorial that cover a lot of stuffs.

And I will keep an eye on nx-raven, even if it’s not released yet and still under development.