<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 06/04/2016 04:11, Todd wrote:<br>
    </div>
    <blockquote
cite="mid:CAFpSVpK0k2AmiN4uKb02uzsc_41ewCQzQ=7T8g7JGBWwSC8Udg@mail.gmail.com"
      type="cite">
      <p dir="ltr">When you try to transpose a 1D array, it does
        nothing.  This is the correct behavior, since it transposing a
        1D array is meaningless.  However, this can often lead to
        unexpected errors since this is rarely what you want.  You can
        convert the array to 2D, using `np.atleast_2d` or `arr[None]`,
        but this makes simple linear algebra computations more
        difficult.</p>
      <p dir="ltr">I propose adding an argument to transpose, perhaps
        called `expand` or `expanddim`, which if `True` (it is `False`
        by default) will force the array to be at least 2D.  A shortcut
        property, `ndarray.T2`, would be the same as
        `ndarray.transpose(True)`</p>
    </blockquote>
    Hello,<br>
    My two cents here, I've seen hundreds of people (literally hundreds)
    stumbling on this .T trick with 1D vectors when they were trying to
    do some linear algebra with numpy so at first I had the same feeling
    as you. But the real issue was that *all* these people were coming
    from matlab and expected numpy to behave the same way. Once the
    logic behind 1D vectors was explained it made sense to most of them
    and there were no more problems.<br>
    <br>
    And by the way I don't see any way to tell apart a 1D "row vector"
    from a 1D "column vector", think of a code mixing a Rn=>R
    jacobian matrix and some data supposed to be used as measurements in
    a linear system, so we have J=np.array([1,2,3,4]) and
    B=np.array([5,6,7,8]), what would the output of J.T2 and B.T2 be ?<br>
    <br>
    I think it's much better to get used to writing
    J=np.array([1,2,3,4]).reshape(1,4) and
    B=np.array([5,6,7,8]).reshape(4,1), then you can use .T and @
    without any verbosity and at least if forces users (read "my
    students" here) to think twice before writing some linear algebra
    nonsense.<br>
    <br>
    Regards.<br>
    <meta http-equiv="content-type" content="text/html;
      charset=windows-1252">
  </body>
</html>