[Numpy-discussion] ufuncs on user-defined types in numarray
gazzar at email.com
Sat Dec 18 22:38:02 CST 2004
I didn't realise this was possible. I should use it on my ErrorVal module <http://users.bigpond.net.au/gazzar/python.html>. 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.
----- Original Message -----
From: "Todd Miller" <jmiller at stsci.edu>
To: konrad.hinsen at laposte.net
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 at laposte.net 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.
> 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.
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
Sign-up for Ads Free at Mail.com
More information about the Numpy-discussion