>
> >> 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?
No. In your case I'd just do (a*b.conj()).sum(0). (Assuming that a and b
are arrays, not matrices).
It is most helpful to think
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) (100
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 b
In the following code
c = np.multiply (a, b.conj())
d = np.abs (np.sum (c, axis=0)/rows)
d2 = np.abs (np.tensordot (a, b.conj(), ((0,),(0,)))/rows)
print a.shape, b.shape, d.shape, d2.shape
The 1st compute steps, where I do multiply and then sum g