[Numpy-discussion] Row-wise dot product?

T J tjhnson@gmail....
Mon Sep 7 17:43:31 CDT 2009


On Mon, Sep 7, 2009 at 3:27 PM, T J<tjhnson@gmail.com> wrote:
> On Mon, Sep 7, 2009 at 7:09 AM, Hans-Andreas Engel<engelh@deshaw.com> wrote:
>> If you wish to avoid the extra memory allocation implied by `x*y'
>> and get a ~4x speed-up, you can use a generalized ufunc
>> (numpy >= 1.3, stolen from the testcases):
>>
>>   z = numpy.core.umath_tests.inner1d(x, y)
>>
>
> This is exactly what I was hoping for.  Now, I can also keep an array
> of vectors and apply a rotation matrix to each vector.
>

I spoke too soon.  inner1d will not allow me to rotate each row in the
array.  Is there another function that will help with this?  If I'm
understanding the signature for generalized ufuncs, it looks like I
need:  (i),(i,j)->(i)

Or perhaps I am just being dense.


More information about the NumPy-Discussion mailing list