[Numpy-discussion] Simple multi-arg wrapper for dot()
Sat Mar 24 04:29:33 CDT 2007
On 24/03/07, Bill Baxter <firstname.lastname@example.org> wrote:
> Nice, but how does that fare on things like mdot(a,(b,c),d) ? I'm
> pretty sure it doesn't handle it.
> I think an mdot that can only multiply things left to right comes up
> short compared to an infix operator that can easily use parentheses to
> control order.
Well, since exact dotting is associative, the parenthesization doesn't
matter there; if you're worried about roundoff or efficiency, you're
going to have to be more explicit. Unfortunately your approach
requires tuples to be treated differently from arrays. Most functions
in numpy will happily treat a tuple of length n, a list of length n,
and an array of length n the same way. You could do this, and for your
own code maybe it's worth it, but I think it would be confusing in the
More information about the Numpy-discussion