Accessing an array and its metadata through C/C++ in scipy.weave.inline()

The inline code:

~~~ { .cpp }

long dim1, dim2, dim3;

dim1 = Nfoo[0]; // dimension access. dim2 = Nfoo[1]; dim3 = Nfoo[2];

FOO3(0,0,0) = 1; // array assignment return_val = FOO3(0,0,0); // array access.


## The Python code:

~~~ { .python }
import scipy
import scipy.weave
inline_code = r"""
put C/C++ code in here
"""
foo = scipy.arange(3**3).reshape((3,3,3))
scipy.weave.inline(inline_code, foo)

Using Python functions in weave.inline

Call foo.call(py:tuple arg).

Links

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.