[Numpy-discussion] rewriting NumPy code in C or C++ or similar

Dan Halbert halbert@halwitz....
Mon Mar 7 17:36:02 CST 2011

We currently have some straightforward NumPy code that indirectly implements a C API defined by a third party. We built a Cython layer that directly provides the API in a .a library, and then calls Python. The layering looks like this:

  C main program -> API in Cython -> Python -> NumPy

This is difficult to package for distribution, because of the Python and NumPy dependencies. We may need to reimplement our library so it factors out the Python dependency, and I would like to explore the alternatives. (Performance may also be a reason to do this, but that is not the main issue right now.)

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? 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? I apologize if the answers are obvious: I am not very familiar with the tools in this space.


(I saw the NumPy Refactoring project discussion from earlier. When that is finished, the resulting Python-independent library might be a nice way to handle this, but I am thinking shorter-term.) 

More information about the NumPy-Discussion mailing list