<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 7, 2016 at 4:03 PM, Stéfan van der Walt <span dir="ltr"><<a href="mailto:stefanv@berkeley.edu" target="_blank">stefanv@berkeley.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 7 April 2016 at 11:17, Chris Barker <<a href="mailto:chris.barker@noaa.gov">chris.barker@noaa.gov</a>> wrote:<br>
> np.col_vector(arr)<br>
><br>
> which would be a synonym for np.reshape(arr, (-1,1))<br>
><br>
> would that make anyone happy?<br>
<br>
</span>I'm curious to see use cases where this doesn't solve the problem.<br>
<br>
The most common operations that I run into:<br>
<br>
colvec = lambda x: np.c_[x]<br>
<br>
x = np.array([1, 2, 3])<br>
A = np.arange(9).reshape((3, 3))<br>
<br>
<br>
1) x @ x   (equivalent to x @ colvec(x))<br>
2) A @ x  (equivalent to A @ colvec(x), apart from the shape)<br>
3) x @ A<br>
4) x @ colvec(x)  -- gives an error, but perhaps this should work and<br>
be equivalent to np.dot(colvec(x), rowvec(x)) ?<br>
<br>
If (4) were changed, 1D arrays would mostly* be interpreted as row<br>
vectors, and there would be no need for a rowvec function.  And we<br>
already do that kind of magic for (2).<br></blockquote><div><br></div><div>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.<br><br></div><div>Chuck<br></div></div></div></div>