[Numpy-discussion] numpy.where

Sebastian Haase haase at msg.ucsf.edu
Sun Jul 15 06:06:57 EDT 2007


On 7/15/07, Robert Kern <robert.kern at gmail.com> wrote:
> Sebastian Haase wrote:
> > On 7/14/07, Robert Kern <robert.kern at gmail.com> wrote:
> >> Sebastian Haase wrote:
>
> >>> 2) Could we have another optional argument "dtype" in numpy.where()?
> >>> Otherwise I would have to always write code like this:
> >>> a = N.where( arr>x, 1.0, 0.0)
> >>> a = a.astype(N.float32)
> >> a = N.where(arr > x, N.float32(1), N.float32(0))
> >
> > If the x,y arguments are not scalars but (large) arrays this would
> > need lots of unneccessary temporary memory (peak of 3 times the needed
> > output memory size).
> > I would wish that this function,   and others which generate output
> > arrays, all get an addition optional dtype argument. (Just like the
> > functions in nd-image)
> >
> > Comments?
>
> I look forward to your patch.

Which file(s) should I be looking for?



More information about the NumPy-Discussion mailing list