[Numpy-discussion] Simple multi-arg wrapper for dot()

dmitrey openopt@ukr....
Sat Mar 24 04:37:07 CDT 2007

but how about the things like
a = dot(array([8]), ones([1000,1000], array([15])))?
it will be much faster if we will dot 8 x 15 at first, and than the 
result to the big array.

Anne Archibald wrote:
> On 24/03/07, Bill Baxter <wbaxter@gmail.com> 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
> library.
> Anne
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

More information about the Numpy-discussion mailing list