Commit cd59daea by Gael varoquaux

Rename to have README stand out on the gist

parent ff802218
============================================================================
Cython example of exposing C-computed arrays in Python without data copies
============================================================================
The goal of this example is to show how an existing C codebase for
numerical computing (here `c_code.c`) can be wrapped in Cython to be
exposed in Python.
The meat of the example is that the data is allocated in C, but exposed
in Python without a copy using the `PyArray_SimpleNewFromData` numpy
function in the Cython file `cython_wrapper.pyx`.
Note that the ownership of the memory is then handed off to the Python
VM, and there is no control of when Python will deallocate the memory. If
the memory is still being used by the C code, please refer to the
following blog post by Travis Oliphant:
http://blog.enthought.com/python/numpy-arrays-with-pre-allocated-memory
To build it you will need Cython, numpy, and a C compiler.
Run::
$ python setup.py build_ext --i
to build the C extension in-place.
To test the C-Python bindings, run the `test.py` file.
____
:Author: Gael Varoquaux
:License: BSD
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment