On Sat, Mar 15, 2014 at 2:12 PM, Alexander Belopolsky <ndar...@mac.com>wrote:

>
> 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]])
>

Yes, that works. I was thinking more of easy translation of the forms found
in textbooks. Householder reflection, for instance, is usually written as

I - 2 * v * v.T

Where the `v` are unit vectors.

Chuck
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to