[Numpy-discussion] [help needed] associativity and precedence of '@'
Alexander Belopolsky
ndarray at mac.com
Sat Mar 15 16:12:18 EDT 2014
On Sat, Mar 15, 2014 at 4:00 PM, Charles R Harris <charlesr.harris at gmail.com
> wrote:
> These days they are usually written as v*w.T, i.e., the outer product of
> two vectors and are a fairly common occurrence in matrix expressions. For
> instance, covariance matrices are defined as E(v * v.T)
With the current numpy, we can do
>>> x = arange(1, 5)
>>> x[:,None].dot(x[None,:])
array([[ 1, 2, 3, 4],
[ 2, 4, 6, 8],
[ 3, 6, 9, 12],
[ 4, 8, 12, 16]])
I assume once @ becomes available, we will have
>>> x[:,None] @ x[None,:]
array([[ 1, 2, 3, 4],
[ 2, 4, 6, 8],
[ 3, 6, 9, 12],
[ 4, 8, 12, 16]])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140315/cae0e585/attachment.html>
More information about the NumPy-Discussion
mailing list