On Sat, Mar 15, 2014 at 4:00 PM, Charles R Harris <charlesr.har...@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]])
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to