Numeric Python and C
Ognen Duzlevski
maketo at norge.freeshell.org
Thu Jan 15 00:45:27 EST 2004
John Hunter <jdhunter at ace.bsd.uchicago.edu> wrote:
>>>>>> "Ognen" == Ognen Duzlevski <maketo at norge.freeshell.org> writes:
> Ognen> Hi, can someone explain how to change a value within an
> Ognen> array from a C function?
> Warning: I am not a Numeric C API guru.
> For 1D arrays I use the following macro
[snipped]
> You'll have to do a bit more work for 2D arrays, but this may speed
> you on your way....
Hi, for 2D arrays it is much similar:
get(ndx1,ndx2): array->data + ndx1*array->strides[0] + ndx2*array->strides[1]
set(ndx1,ndx2): I use memcpy(same as get, &val, sizeof(val);
Thanks,
Ognen
More information about the Python-list
mailing list