OCaml packages for scientific computing

This is a collection of OCaml packages that are potentially useful for scientific computing. (Disclaimer: I have only used some of them. But I choose to list all I found useful here for future reference.)

Numerical computing

  • Owl: The de facto numerical computing library for OCaml. Probably the best maintained OCaml numerical computing package at this moment.
  • gsl: OCaml bindings to the GNU Scientific Library.
  • lacaml: OCaml bindings to BLAS and LAPACK.

Machine learning

Data visualization

Interactive programming

Foreign function interfaces (FFI)

  • ctypes: Modern C FFI in OCaml developed by the OCaml Labs at the University of Cambridge. Note that ctypes-foreign is also required if you need to use Ctypes interactively.
  • py.ml: OCaml bindings for Python implemented using C stubs. This package supports both Python 2 and 3.
  • lymp: Allows OCaml to interact with Python through a Python process. Need to identify the interpreter command to execute it.
  • ocaml-rs: Allows OCaml to interact with extensions written in Rust without C stubs.
  • rust-ocaml-derive (WARNING: experimental): Two-way FFIs between OCaml and Rust. Provides the ocaml_ffi macro in Rust that reduces the amount of boilerplate code to write.

Development tools

  • dune: The official build system for OCaml.
  • merlin: Context-extensive autocompletion for OCaml in Vim and Emacs.
  • opam-depext: Allows OPAM to invoke the system package manager (e.g., brew on macOS) for automated installation.
  • core_bench: Micro-benchmarking for OCaml.
  • ocamlformat: An autoformatter for OCaml code.
  • ocamlfind: A library manager for OCaml.
  • ocamlbuild: A build system for OCaml. This package can be used to compile OCaml to native code. But check your use case before you use it, because dune may suffice for most cases.
  • vscode-reasonml: OCaml and ReasonML support for Visual Studio Code.