### Email Archive: numpy-discussion (read-only)

 Re: [Numpy-discussion] ufuncs on user-defined types in numarray From: Gary Ruben - 2004-12-21 01:12 ```First, thanks Todd for elevating this to 'requested feature' status. Konrad, I had no idea what interval arithmetic is, so I looked it up. I'm n= ot sure if what I've done is considered interval arithmetic - I suspect it = is, but that I've only implemented it partially. The code isn't that clever= . It doesn't care about propagating rounding errors correctly at the error = limits. It just implements a brute-force approach to calculating operations on the = error limits of a data-point value along with the central value. This is al= ready more accurate than what most people do, which is to linearise the err= or limits and treat them as infinitessimals. The central and outer values are grouped in an object and any operations ar= e applied, without any consideration of rounding errors, to all three value= s for every operation. Gary ----- Original Message ----- > > I didn't realise this was possible. I should use it on my=20 > > ErrorVal module .=20 > > Last time I tried (quite a >=20 > Indeed! You could then even have arrays of ErrorVal objects with no=20 > extra effort, at least as long as ErrorVal doesn't implement the=20 > sequence protocol (because then all the Numeric functions will=20 > silently convert them to arrays). >=20 > Your module looks interesting. What does it do internally, interval=20 > arithmetic? >=20 > Konrad. --=20 ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm ```

### Thread View

Thread Author Date
Re: [Numpy-discussion] ufuncs on user-defined types in numarray Gary Ruben <gazzar@em...>
 Re: [Numpy-discussion] ufuncs on user-defined types in numarray From: - 2004-12-19 08:51 ```On 19.12.2004, at 07:37, Gary Ruben wrote: > I didn't realise this was possible. I should use it on my ErrorVal > module . Last time I > tried (quite a Indeed! You could then even have arrays of ErrorVal objects with no extra effort, at least as long as ErrorVal doesn't implement the sequence protocol (because then all the Numeric functions will silently convert them to arrays). Your module looks interesting. What does it do internally, interval arithmetic? Konrad. ```

 Re: [Numpy-discussion] ufuncs on user-defined types in numarray From: Todd Miller - 2004-12-20 19:33 ```Hi Gary and Konrad, I filed a Numarray Enhancement Request on Source Forge for this feature. It's not clear if, when, or how it will be implemented but it won't be completely forgotten either. Regards, Todd On Sun, 2004-12-19 at 16:37 +1000, Gary Ruben wrote: > Thanks Konrad, > I didn't realise this was possible. I should use it on my ErrorVal module . Last time I tried (quite a while ago), numarray's object array support wasn't up to allowing me to port ErrorVal from Numeric. I don't think it matters since I don't know of anyone, besides me, who has tried using my module :-( but I thought I'd mention it for Todd's benefit since I'm one who could benefit from implementing it in numarray. > Gary R. > > ----- Original Message ----- > From: "Todd Miller" > To: konrad.hinsen@... > Subject: Re: [Numpy-discussion] ufuncs on user-defined types in numarray > Date: 17 Dec 2004 10:09:51 -0500 > > > > > On Fri, 2004-12-17 at 08:31, konrad.hinsen@... wrote: > > > I am working on making ScientificPython > > > (http://dirac.cnrs-orleans.fr/ScientificPython/) compatible with > > > numarray. One problem I stumbled across is that one feature of > > > Numeric seems to be absent from numarray: the possibility to call > > > ufuncs with arguments of non-numeric types, leading to a > > > corresponding method call. > > > > > > As an illustration, the following example works fine with > > > Numeric, but crashes with numarray: > > > > > > from Numeric import sqrt > > > #from numarray import sqrt > > > > > > class DummyValue: > > > > > > def __init__(self, string): > > > self.string = string > > > > > > def __str__(self): > > > return self.string > > > > > > def sqrt(self): > > > return DummyValue('sqrt(%s)' % self.string) > > > > > > x = DummyValue('x') > > > print sqrt(x) > > > > > > > > > Is this a bug or a feature? > > > > It's a missing feature. > > > > > Is there another way to make ufuncs work with user-defined classes and types? > > > > Not that I know of. How critical a feature is it? Do you have a work around? > > > > numarray ufunc handling is in flux as I'm adding numarray support to > > scipy. At some point, there's going to be a major ufunc consolidation, > > and perhaps I can add this additional feature then. > > > > Regards, > > Todd > > > > > > > > ------------------------------------------------------- > > SF email is sponsored by - The IT Product Guide > > Read honest & candid reviews on hundreds of IT Products from real users. > > Discover which products truly live up to the hype. Start reading now. > > http://productguide.itmanagersjournal.com/ > > _______________________________________________ > > Numpy-discussion mailing list > > Numpy-discussion@... > > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > ```

 Re: [Numpy-discussion] ufuncs on user-defined types in numarray From: Gary Ruben - 2004-12-21 01:12 ```First, thanks Todd for elevating this to 'requested feature' status. Konrad, I had no idea what interval arithmetic is, so I looked it up. I'm n= ot sure if what I've done is considered interval arithmetic - I suspect it = is, but that I've only implemented it partially. The code isn't that clever= . It doesn't care about propagating rounding errors correctly at the error = limits. It just implements a brute-force approach to calculating operations on the = error limits of a data-point value along with the central value. This is al= ready more accurate than what most people do, which is to linearise the err= or limits and treat them as infinitessimals. The central and outer values are grouped in an object and any operations ar= e applied, without any consideration of rounding errors, to all three value= s for every operation. Gary ----- Original Message ----- > > I didn't realise this was possible. I should use it on my=20 > > ErrorVal module .=20 > > Last time I tried (quite a >=20 > Indeed! You could then even have arrays of ErrorVal objects with no=20 > extra effort, at least as long as ErrorVal doesn't implement the=20 > sequence protocol (because then all the Numeric functions will=20 > silently convert them to arrays). >=20 > Your module looks interesting. What does it do internally, interval=20 > arithmetic? >=20 > Konrad. --=20 ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm ```