Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-20 Thread Anne Archibald
2009/10/20 Sebastian Walter : > On Tue, Oct 20, 2009 at 5:45 AM, Anne Archibald > wrote: >> 2009/10/19 Sebastian Walter : >>> >>> I'm all for generic (u)funcs since they might come handy for me since >>> I'm doing lots of operation on arrays of polynomials. >> >> Just as a side note, if you don't

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-20 Thread Darren Dale
Hi Travis, On Mon, Oct 19, 2009 at 6:29 PM, Travis Oliphant wrote: > > On Oct 17, 2009, at 7:49 AM, Darren Dale wrote: [...] >> When calling numpy functions: >> >> 1) __input_prepare__ provides an opportunity to operate on the inputs >> to yield versions that are compatible with the operation (th

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-20 Thread Darren Dale
On Tue, Oct 20, 2009 at 5:24 AM, Sebastian Walter wrote: > I'm not very familiar with the underlying C-API of numpy, so this has > to be taken with a grain of salt. > > The reason why I'm curious about the genericity is that it would be > awesome to have: > 1) ufuncs like sin, cos, exp... to work

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-20 Thread Sebastian Walter
I'm not very familiar with the underlying C-API of numpy, so this has to be taken with a grain of salt. The reason why I'm curious about the genericity is that it would be awesome to have: 1) ufuncs like sin, cos, exp... to work on arrays of any object (this works already) 2) funcs like dot, eig,

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-20 Thread Sebastian Walter
On Tue, Oct 20, 2009 at 5:45 AM, Anne Archibald wrote: > 2009/10/19 Sebastian Walter : >> >> I'm all for generic (u)funcs since they might come handy for me since >> I'm doing lots of operation on arrays of polynomials. > > Just as a side note, if you don't mind my asking, what sorts of > operatio

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-19 Thread Anne Archibald
2009/10/19 Sebastian Walter : > > I'm all for generic (u)funcs since they might come handy for me since > I'm doing lots of operation on arrays of polynomials. Just as a side note, if you don't mind my asking, what sorts of operations do you do on arrays of polynomials? In a thread on scipy-dev we

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-19 Thread Travis Oliphant
On Oct 17, 2009, at 7:49 AM, Darren Dale wrote: > numpy's functions, especially ufuncs, have had some ability to support > subclasses through the ndarray.__array_wrap__ method, which provides > masked arrays or quantities (for example) with an opportunity to set > the class and metadata of the ou

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-19 Thread Darren Dale
On Mon, Oct 19, 2009 at 3:10 AM, Sebastian Walter wrote: > On Sat, Oct 17, 2009 at 2:49 PM, Darren Dale wrote: >> numpy's functions, especially ufuncs, have had some ability to support >> subclasses through the ndarray.__array_wrap__ method, which provides >> masked arrays or quantities (for exam

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-19 Thread Sebastian Walter
On Sat, Oct 17, 2009 at 2:49 PM, Darren Dale wrote: > numpy's functions, especially ufuncs, have had some ability to support > subclasses through the ndarray.__array_wrap__ method, which provides > masked arrays or quantities (for example) with an opportunity to set > the class and metadata of the

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-18 Thread Darren Dale
On Sat, Oct 17, 2009 at 6:45 PM, Charles R Harris wrote: > > > On Sat, Oct 17, 2009 at 6:49 AM, Darren Dale wrote: [...] >> I think it will be not too difficult to document this overall scheme: >> >> When calling numpy functions: >> >> 1) __input_prepare__ provides an opportunity to operate on th

Re: [Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-17 Thread Charles R Harris
On Sat, Oct 17, 2009 at 6:49 AM, Darren Dale wrote: > numpy's functions, especially ufuncs, have had some ability to support > subclasses through the ndarray.__array_wrap__ method, which provides > masked arrays or quantities (for example) with an opportunity to set > the class and metadata of th

[Numpy-discussion] Another suggestion for making numpy's functions generic

2009-10-17 Thread Darren Dale
numpy's functions, especially ufuncs, have had some ability to support subclasses through the ndarray.__array_wrap__ method, which provides masked arrays or quantities (for example) with an opportunity to set the class and metadata of the output array at the end of an operation. An example is q1 =