[Numpy-discussion] rewriting NumPy code in C or C++ or similar
Mon Mar 7 20:13:40 CST 2011
Den 08.03.2011 00:36, skrev Dan Halbert:
> Do you all have some recommendations about tools, libraries, or languages that you have used to rewrite NumPy code easily into something that's more self-contained and callable from C?
It has the power of C, without the unsafe pointer arithmetics, almost
the readability of Python, and all the array magic of NumPy.
Almost every serious numerical library have bindings for Fortran.
Calling Fortran from C:
- Name mangling: usually lower-case with appended underscore.
- Assumed-size or explicit shape arrays: just pass a pointer (cf. f2py).
Avoid assumed-shape or deferred-size arrays in the interface to C.
- Fortran 2003 ISO C bindings (cf. fwrap).
> For instance, are there some nice C++ linear algebra libraries that map closely to NumPy? Or is there some higher-level compiled array language that looks something like NumPy code?
The 'standard' linear algebra packages are BLAS and LAPACK, e.g. as
implemented in ACML or Intel MKL. (Callable from C although implemented
Two comprehensive scientific C and Fortran libraries are IMSL and NAG.
More information about the NumPy-Discussion