Re: [Numpy-discussion] Apply a vector function to each row of a matrix

2008-10-14 Thread Neal Becker
David Huard wrote: ... > I've edited the docstring at > http://sd-2116.dedibox.fr/pydocweb/doc/numpy.lib.shape_base.apply_along_axis/ > > Feel free to improve on it. Thanks! That is better. ___ Numpy-discussion mailing list Numpy-discussion@scipy.or

Re: [Numpy-discussion] Apply a vector function to each row of a matrix

2008-10-10 Thread David Huard
On Thu, Oct 9, 2008 at 2:48 PM, Neal Becker <[EMAIL PROTECTED]> wrote: > David Huard wrote: > > > On Thu, Oct 9, 2008 at 9:40 AM, Neal Becker <[EMAIL PROTECTED]> wrote: > > > >> David Huard wrote: > >> > >> > Neal, > >> > > >> > Look at: apply_along_axis > >> > > >> > > >> I guess it'd be: > >> >

Re: [Numpy-discussion] Apply a vector function to each row of a matrix

2008-10-09 Thread Neal Becker
David Huard wrote: > On Thu, Oct 9, 2008 at 9:40 AM, Neal Becker <[EMAIL PROTECTED]> wrote: > >> David Huard wrote: >> >> > Neal, >> > >> > Look at: apply_along_axis >> > >> > >> I guess it'd be: >> >> b = empty_like(a) >> for row in a.shape[0]: >> b[row,:] = apply_along_axis (func, row, a) >> >

Re: [Numpy-discussion] Apply a vector function to each row of a matrix

2008-10-09 Thread David Huard
On Thu, Oct 9, 2008 at 9:40 AM, Neal Becker <[EMAIL PROTECTED]> wrote: > David Huard wrote: > > > Neal, > > > > Look at: apply_along_axis > > > > > I guess it'd be: > > b = empty_like(a) > for row in a.shape[0]: > b[row,:] = apply_along_axis (func, row, a) > > I don't suppose there is a way to d

Re: [Numpy-discussion] Apply a vector function to each row of a matrix

2008-10-09 Thread David Huard
Neal, Look at: apply_along_axis David On Thu, Oct 9, 2008 at 8:04 AM, Neal Becker <[EMAIL PROTECTED]> wrote: > Suppose I have a function (I wrote in c++) that accepts a numpy 1-d vector. > What is the recommended way to apply it to each row of a matrix, returning > a new matrix result? (Assu

Re: [Numpy-discussion] Apply a vector function to each row of a matrix

2008-10-09 Thread Neal Becker
David Huard wrote: > Neal, > > Look at: apply_along_axis > > I guess it'd be: b = empty_like(a) for row in a.shape[0]: b[row,:] = apply_along_axis (func, row, a) I don't suppose there is a way to do this without explicitly writing a loop. ___ Num

[Numpy-discussion] Apply a vector function to each row of a matrix

2008-10-09 Thread Neal Becker
Suppose I have a function (I wrote in c++) that accepts a numpy 1-d vector. What is the recommended way to apply it to each row of a matrix, returning a new matrix result? (Assume the function has signature newvec = f (oldvec)) ___ Numpy-discussion m