[Numpy-discussion] dot() function question
Warren Weckesser
warren.weckesser at enthought.com
Wed Jun 27 18:01:38 EDT 2012
On Wed, Jun 27, 2012 at 4:38 PM, <x.piter at gmail.com> wrote:
> Hi list.
> I have got completely cunfused with the numpy.dot() function.
> dot(A,B) does:
> - matrix multiplication if A and B are of MxN and NxK sizey
> - dot product if A and B are of size M
> How how can I perform matrix multiplication of two vectors?
> (in matlab I do it like a*a')
>
If 'a' is a 1D numpy array, you can use numpy.outer:
In [6]: a = array([1, -2, 3])
In [7]: outer(a, a)
Out[7]:
array([[ 1, -2, 3],
[-2, 4, -6],
[ 3, -6, 9]])
Warren
> Thanks.
> Petro.
>
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120627/cb17ce3e/attachment.html>
More information about the NumPy-Discussion
mailing list