[SciPy-dev] numpy.broadcast

David Goldsmith d_l_goldsmith at yahoo.com
Wed Aug 5 15:38:19 EDT 2009


--- On Wed, 8/5/09, Robert Kern <robert.kern at gmail.com> wrote:

> wrote:
> > I guess I don't really understand this too well - is
> the below correct behavior, and if so, why?
> >
> >>>> b = np.broadcast(x, y, x, y)
> >>>> b.nd # doesn't return what I'd expect
> > 2

Why isn't that 4?

> Why don't you expect this? It's the correct answer.
> (x*y*x*y).shape == (3,3).
> 
> >>>> del b # maybe problem is that I have to
> "clear" b first?
> >>>> # or maybe it's that all args have to be
> different?
> > ...
> >>>> b = np.broadcast(x, y, x * y)
> >>>> b.nd
> > 2

Why isn't that 3?

If x0, ..., xN are the arguments to `broadcast` and D = max(x0.nd, ..., xN.nd), is broadcast.nd necessarily <= D?  If so, then I think I'm on the road to understanding.

DG


      



More information about the SciPy-Dev mailing list