Wed Aug 5 14:41:51 CDT 2009
On Wed, Aug 5, 2009 at 14:38, David Goldsmith<firstname.lastname@example.org> wrote:
> --- On Wed, 8/5/09, Robert Kern <email@example.com> 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 would it be 4?
>> Why don't you expect this? It's the correct answer.
>> (x*y*x*y).shape == (3,3).
This is the example you need to pay attention to.
>> >>>> del b # maybe problem is that I have to
>> "clear" b first?
>> >>>> # or maybe it's that all args have to be
>> > ...
>> >>>> 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.
It is necessarily == D. Broadcasting is associative. The (x*y*z).shape
== (x*(y*z)).shape == ((x*y)*z).shape.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Scipy-dev