On 29 May 2018 at 05:40, Stephan Hoyer <sho...@gmail.com> wrote:

> But given that idiomatic NumPy code uses 1D arrays in favor of explicit
> row/column vectors with shapes (1,n) and (n,1), I do think it does make
> sense for matrix transpose on 1D arrays to be the identity, because matrix
> transpose should convert back and forth between row and column vectors
> representations.
>

When doing algebra on paper, I like the braket notation. It makes
abundantly clear the shape of the outputs, without having to remember on
which side the transpose goes: <u|v> is a scalar, |u><v| is a matrix. I
don't have a good way of translating this to numpy, but maybe someone else
has an idea.


Certainly, matrix transpose should error on 0d arrays, because it doesn't
> make sense to transpose a scalar.
>

Unless the scalar is 8, in which case the transpose is np.inf...

Right now, np.int(8).T throws an error, but np.transpose(np.int(8)) gives a
0-d array. On one hand, it is nice to be able to use the same code for
scalars as for vectors, but on the other, you may be making a mistake.


/David.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to