https://github.com/ocamlpro/numcaml
Scientific Computing Tools For OCaml
https://github.com/ocamlpro/numcaml
Last synced: about 1 year ago
JSON representation
Scientific Computing Tools For OCaml
- Host: GitHub
- URL: https://github.com/ocamlpro/numcaml
- Owner: OCamlPro
- Created: 2011-04-07T11:15:53.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2014-06-25T18:48:06.000Z (about 12 years ago)
- Last Synced: 2023-03-11T18:18:48.783Z (over 3 years ago)
- Language: OCaml
- Homepage:
- Size: 140 KB
- Stars: 36
- Watchers: 8
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
WARNING : numcaml is in early prototype stage. Any contribution/feedback is welcome!
The goal of numcaml is to be able to deal with numerical computations more easily in Objective Caml.
More precisly, it consists of 3 parts :
* a camlp4 syntax extension;
* a complete and efficient library; and
* a collection of visualisation tools.
Numcaml is mainly inspired from the great [numpy](numpy.scipy.org/) library for python.
The static types of Objective Caml (and the lack of automatic upcasting) makes it difficult to port
numpy directly as a library. For example :
1 + 2.3
is valid in python because the integer `1` can be upcasted to the float `1.`, and `+` looks dynamically
at the type of its arguments to know which code to execute. In Objective Caml, the expression is
rejected because `+` is a function which *must* takes two integers as arguments.
The syntax extension of numcaml let you write :
$(1 + 2.3)
inside your Objective Caml programm. This expression is translated, at pre-processing stage, into :
Math.add (Math.Int 1) (Math.Float 2.3)
and `Math.add` will do the same dynamic dispatch as python is doing for `+`.
You can see more complete examples of using the numcaml library in the `tests/` directory.