Re: [Numpy-discussion] SWIG Numpy and C++ extensions

2012-07-31 Thread David Froger
> >> 1- How do use "apply" for class functions %apply (bla) myobject::foo ? > >%apply is specified on function/method arguments names and types > > only, > >never on function names. So if for example you use: > >%apply (int* ARGOUT_ARRAY1, int DIM1) {(int* rangevec, int n)} > >it will app

Re: [Numpy-discussion] SWIG Numpy and C++ extensions

2012-07-31 Thread Doutriaux, Charles
Thanks David, The clarification on apply is actually a important one! C. On 7/31/12 1:04 PM, "David Froger" wrote: >Hi, > >> I'm looking at SWIG/numpy tutorials >They are these tutorials: >http://docs.scipy.org/doc/numpy/reference/swig.interface-file.html >http://www.scipy.org/Cookbook/SWIG_Nu

Re: [Numpy-discussion] [EXTERNAL] Re: SWIG Numpy and C++ extensions

2012-07-31 Thread Bill Spotz
Use %inline %{ ... %} around your function. SWIG will add your function directly to the wrapper file as well as add a wrapper function for calling it from python. On Jul 31, 2012, at 2:04 PM, David Froger wrote: >> 2-that's ok if your C++ deals with arrays but what if I actually want to >> re

Re: [Numpy-discussion] SWIG Numpy and C++ extensions

2012-07-31 Thread David Froger
> > I'm looking at SWIG/numpy tutorials > They are these tutorials: > http://docs.scipy.org/doc/numpy/reference/swig.interface-file.html > http://www.scipy.org/Cookbook/SWIG_NumPy_examples Sorry, I've read "look for"... ___ NumPy-Discussion mailing list N

Re: [Numpy-discussion] SWIG Numpy and C++ extensions

2012-07-31 Thread David Froger
Hi, > I'm looking at SWIG/numpy tutorials They are these tutorials: http://docs.scipy.org/doc/numpy/reference/swig.interface-file.html http://www.scipy.org/Cookbook/SWIG_NumPy_examples Reading numpy.i is also very instructive. > 1- How do use "apply" for class functions %apply (bla) myobject::fo

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread Vlastimil Brom
2012/7/31 eat : > Hi, > > On Tue, Jul 31, 2012 at 7:20 PM, Vlastimil Brom > wrote: >> >> 2012/7/31 eat : >> > Hi, >> > >> > On Tue, Jul 31, 2012 at 5:01 PM, Vlastimil Brom >> > >> > wrote: >> >> >> >> 2012/7/31 eat : >> >> > Hi, >> >> > >> >> > On Tue, Jul 31, 2012 at 10:23 AM, Vlastimil Brom >>

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 7:20 PM, Vlastimil Brom wrote: > 2012/7/31 eat : > > Hi, > > > > On Tue, Jul 31, 2012 at 5:01 PM, Vlastimil Brom < > vlastimil.b...@gmail.com> > > wrote: > >> > >> 2012/7/31 eat : > >> > Hi, > >> > > >> > On Tue, Jul 31, 2012 at 10:23 AM, Vlastimil Brom > >> > > >> >

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 7:30 PM, Nathaniel Smith wrote: > On Tue, Jul 31, 2012 at 4:57 PM, eat wrote: > > Hi, > > > > On Tue, Jul 31, 2012 at 6:43 PM, Nathaniel Smith wrote: > >> > >> On Tue, Jul 31, 2012 at 2:23 PM, eat wrote: > >> > Apparently ast(.) does not return a view of the origin

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread Nathaniel Smith
On Tue, Jul 31, 2012 at 4:57 PM, eat wrote: > Hi, > > On Tue, Jul 31, 2012 at 6:43 PM, Nathaniel Smith wrote: >> >> On Tue, Jul 31, 2012 at 2:23 PM, eat wrote: >> > Apparently ast(.) does not return a view of the original matches rather >> > a >> > copy of size (n* (2* distance+ 1)), thus you ma

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread Vlastimil Brom
2012/7/31 eat : > Hi, > > On Tue, Jul 31, 2012 at 5:01 PM, Vlastimil Brom > wrote: >> >> 2012/7/31 eat : >> > Hi, >> > >> > On Tue, Jul 31, 2012 at 10:23 AM, Vlastimil Brom >> > >> > wrote: >> >> >> >> 2012/7/30 eat : >> >> > Hi, >> >> > >> >> > A partial answer to your questions: >> >> > >> >> >

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 6:43 PM, Nathaniel Smith wrote: > On Tue, Jul 31, 2012 at 2:23 PM, eat wrote: > > Apparently ast(.) does not return a view of the original matches rather a > > copy of size (n* (2* distance+ 1)), thus you may run out of memory. > > The problem isn't memory, it's that

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread Nathaniel Smith
On Tue, Jul 31, 2012 at 2:23 PM, eat wrote: > Apparently ast(.) does not return a view of the original matches rather a > copy of size (n* (2* distance+ 1)), thus you may run out of memory. The problem isn't memory, it's that on 32-bit Python, np.prod(arr.shape) must be <2**32 (or maybe 2**31 --

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 5:01 PM, Vlastimil Brom wrote: > 2012/7/31 eat : > > Hi, > > > > On Tue, Jul 31, 2012 at 10:23 AM, Vlastimil Brom < > vlastimil.b...@gmail.com> > > wrote: > >> > >> 2012/7/30 eat : > >> > Hi, > >> > > >> > A partial answer to your questions: > >> > > >> > On Mon, Jul 3

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread Vlastimil Brom
2012/7/31 eat : > Hi, > > On Tue, Jul 31, 2012 at 10:23 AM, Vlastimil Brom > wrote: >> >> 2012/7/30 eat : >> > Hi, >> > >> > A partial answer to your questions: >> > >> > On Mon, Jul 30, 2012 at 10:33 PM, Vlastimil Brom >> > >> > wrote: >> >> >> >> Hi all, >> >> I'd like to ask for some hints or

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 10:23 AM, Vlastimil Brom wrote: > 2012/7/30 eat : > > Hi, > > > > A partial answer to your questions: > > > > On Mon, Jul 30, 2012 at 10:33 PM, Vlastimil Brom < > vlastimil.b...@gmail.com> > > wrote: > >> > >> Hi all, > >> I'd like to ask for some hints or advice regar

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread Vlastimil Brom
2012/7/30 eat : > Hi, > > A partial answer to your questions: > > On Mon, Jul 30, 2012 at 10:33 PM, Vlastimil Brom > wrote: >> >> Hi all, >> I'd like to ask for some hints or advice regarding the usage of >> numpy.array and especially slicing. >> >> I only recently tried numpy and was impressed b