[Numpy-discussion] confused about tensordot
Neal Becker
ndbecker2@gmail....
Fri Feb 15 10:58:30 CST 2013
Bradley M. Froehle wrote:
> Hi Neal:
>
> The tensordot part:
> np.tensordot (a, b.conj(), ((0,),(0,))
>
> is returning a (13, 13) array whose [i, j]-th entry is sum( a[k, i] *
> b.conj()[k, j] for k in xrange(1004) ).
>
> -Brad
>
>
> The print statement outputs this:
>>
>> (1004, 13) (1004, 13) (13,) (13, 13)
>>
>> The correct output should be (13,), but the tensordot output is (13,13).
>>
>> It's supposed to take 2 matrixes, each (1004, 13) and do element-wise
>> multiply,
>> then sum over axis 0.
>>
Can I use tensordot to do what I want?
More information about the NumPy-Discussion
mailing list