Re: [Numpy-discussion] how to include numpy headers when building an extension?

2007-09-10 Thread Travis E. Oliphant
Christopher Barker wrote: > > I know this has been discussed, but why doesn't numpy put its includes > somewhere that distutils would know where to find it? > I think one answer is because distutils doesn't have defaults that play well with eggs. NumPy provides very nice extensions to distut

Re: [Numpy-discussion] how to include numpy headers when building an extension?

2007-09-10 Thread Christopher Barker
Robert Kern wrote: > Christopher Barker wrote: >> how do I tell distutils >> where to look for it? > numpy.get_include() Ah, got it. thanks. I know this has been discussed, but why doesn't numpy put its includes somewhere that distutils would know where to find it? -Chris -- Christopher B

Re: [Numpy-discussion] how to include numpy headers when building an extension?

2007-09-10 Thread Robert Kern
Christopher Barker wrote: > Hi all, > > I'm porting an extension from Numeric. At the top, I've changed: > > #include > > to > > #include > > But distutils can't find numpy/arrayobject.h -- how do I tell distutils > where to look for it? I've gotten it to work by hard-coding the entire > p

[Numpy-discussion] how to include numpy headers when building an extension?

2007-09-10 Thread Christopher Barker
Hi all, I'm porting an extension from Numeric. At the top, I've changed: #include to #include But distutils can't find numpy/arrayobject.h -- how do I tell distutils where to look for it? I've gotten it to work by hard-coding the entire path, but that's not very portable. It looks like Nu

Re: [Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

2007-09-10 Thread Xavier Gnata
yeah! Looks good! Thanks a lot. Xavier > Thanks! > > DG > > Lisandro Dalcin wrote: > >> David, I'll try to show you what I do for a custom C++ class, of >> course this does not solve the issue resizing (my class does not >> actually support resizing, so this is fine for me): >> >> My custom cla

Re: [Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

2007-09-10 Thread Xavier Gnata
Christopher Barker wrote: > Xavier Gnata wrote: > >> Here it is :) >> > > Thanks, that's helpful. Am I reading it right? Are you running the > python process embedded in your C++ app? (rather than extending?) > > Yes! The point is this way I'm able to debug my C++ code plotting the ar

Re: [Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

2007-09-10 Thread Matthieu Brucher
> > OK, so you've now got a view of the data from the valarray. Nice to know > this works, but, of course, fragile if the valarray is re-sized or > anything, so it probably won't work for us. > Unless you use a special allocator/desallocator (I don't know if the latter is possible), I don't know h

Re: [Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

2007-09-10 Thread Christopher Barker
Xavier Gnata wrote: > Here it is :) Thanks, that's helpful. Am I reading it right? Are you running the python process embedded in your C++ app? (rather than extending?) > valarray < double >Data (NbData); > array = PyArray_SimpleNewFromData (NbDims, Dims, PyArray_DOUBLE, > &Data[0]); OK,

Re: [Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

2007-09-10 Thread Christopher Barker
Thanks for you input Xavier. Xavier Gnata wrote: > std:valarray are quite strange containers because they are not well > integrated in the STL. > I always use vector when I have to deal with arrays. > ps : There are no real performance differences between vector and > valarray (in my use cases