[Numpy-discussion] newbie for writing numpy/scipy extensions

Gennan Chen gnchen at cortechs.net
Thu Apr 27 12:24:41 CDT 2006


Got it. Looks like ndimage still used the old one.

Gen-Nan Chen, PhD
Chief Scientist
Research and Development Group
CorTechs Labs Inc (www.cortechs.net)
1020 Prospect St., #304, La Jolla, CA, 92037
Tel: 1-858-459-9700 ext 16
Fax: 1-858-459-9705
Email: gnchen at cortechs.net


On Apr 27, 2006, at 11:31 AM, David M. Cooke wrote:

> Gennan Chen <gnchen at cortechs.net> writes:
>
>> Hi! All,
>>
>> I just start writing my own python extension based on numpy. Couple
>> of questions here:
>>
>> 1. I have some utility functions, such as wrappers for
>> PyArray_GETPTR* needed be access by different extension modules. So,
>> I put them in utlis.h and utlis.c. In utils.h, I need to include
>> "numpy/arrayobject.h". But the compilation failed when I include it
>> again in my extension module function, wrap.c:
>>
>> #include "numpy/arrayobject.h"
>> #include "utils.h"
>>
>> When I remove it and use
>>
>> #include "utils.h"
>>
>> the compilation works. So, is it true that I can only include
>> arrayobject.h once?
>
> What is the compiler error message?
>
>> 2.  which import I should use in my initial function:
>>
>> import_array()
>
> This one. It's the one to use for Numeric, numarray, and numpy.
>
>> or
>> import_libnumarray()
>
> This is for numarray, the other Numeric derivative. It pulls in the
> numarray-specific stuff IIRC.
>
> --  
> |>|\/|<
> /--------------------------------------------------------------------- 
> -----\
> |David M. Cooke                      http:// 
> arbutus.physics.mcmaster.ca/dmc/
> |cookedm at physics.mcmaster.ca
>





More information about the Numpy-discussion mailing list