Re: [Numpy-discussion] numpy.fix and subclasses

2009-03-08 Thread Darren Dale
On Sun, Feb 22, 2009 at 11:49 PM, Darren Dale wrote: > On Sun, Feb 22, 2009 at 10:35 PM, Darren Dale wrote: > >> I've been finding some numpy functions that could maybe be improved to >> work better with ndarray subclasses. For example: >> >> def fix(x, y=None): >> x = nx.asanyarray(x) >>

Re: [Numpy-discussion] numpy.fix and subclasses

2009-02-22 Thread Darren Dale
On Sun, Feb 22, 2009 at 10:35 PM, Darren Dale wrote: > I've been finding some numpy functions that could maybe be improved to work > better with ndarray subclasses. For example: > > def fix(x, y=None): > x = nx.asanyarray(x) > if y is None: > y = nx.zeros_like(x) > y1 = nx.flo

[Numpy-discussion] numpy.fix and subclasses

2009-02-22 Thread Darren Dale
I've been finding some numpy functions that could maybe be improved to work better with ndarray subclasses. For example: def fix(x, y=None): x = nx.asanyarray(x) if y is None: y = nx.zeros_like(x) y1 = nx.floor(x) y2 = nx.ceil(x) y[...] = nx.where(x >= 0, y1, y2) re