In article <[EMAIL PROTECTED]>,
 Michel Dupront <[EMAIL PROTECTED]> wrote:

>  
> Hello,
>  
> I am trying to use Numeric and swig but it seems that
> there are few points that I don't understand. 
> The only excuse I have is that I am new to these tools.
> I have a simple example that I cannot make work the 
> way I would like. 
> I have a c++ function that take as argument a std::vector.
> >From python I want to call the c++ function with an array
> object. For that purpose I want to write a typemap.

Would this suffice:
%include "std_vector.i"
%template(vectorF) std::vector<float>;
%template(vectorD) std::vector<double>;

This will certainly make a SWIGged function accept a list where a vector 
of floats or doubles is expected (and you can expand the types of 
course). I'm not sure it'll take a numpy or Numeric array of float or 
double, but if not then perhaps you can read the code in std_vector.i 
and see how it works.

-- Russell

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to