[Numpy-discussion] ndarray.T2 for 2D transpose

Charles R Harris charlesr.harris at gmail.com
Fri Apr 8 15:55:47 EDT 2016


On Fri, Apr 8, 2016 at 12:17 PM, Chris Barker <chris.barker at noaa.gov> wrote:

> On Fri, Apr 8, 2016 at 9:59 AM, Charles R Harris <
> charlesr.harris at gmail.com> wrote:
>
>> Apropos column/row vectors, I've toyed a bit with the idea of adding a
>> flag to numpy arrays to indicate that the last index is one or the other,
>> and maybe neither.
>>
>
> I don't follow this. wouldn't it ony be an issue for 1D arrays, rather
> than the "last index". Or maybe I'm totally missing the point.
>
> But anyway, are (N,1) and (1, N) arrays insufficient for representing
> column and row vectors for some reason? If not -- then we have a way to
> express a column or row vector, we just need an easier and more obvious way
> to create them.
>
> *maybe* we could have actual column and row vector classes -- they would
> BE regular arrays, with (1,N) or (N,1) dimensions, and act the same in
> every way except their __repr__. and we're provide handy factor functions
> for them.
>
> These were needed to complete the old Matrix class -- which is no longer
> needed now that we have @ (i.e. a 2D array IS a matrix)
>

One problem with that approach is that `vrow @ vcol` has dimension 1 x 1,
which is not a scalar.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160408/860e8aa7/attachment.html>


More information about the NumPy-Discussion mailing list