<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><div id="bloop_customfont" style="margin:0px">We use np.at_least2d extensively in scikit-image, and I also use it in a *lot* of my own code now that scikit-learn stopped accepting 1D arrays as feature vectors.</div><div id="bloop_customfont" style="margin:0px"><br></div><div id="bloop_customfont" style="margin:0px">> what is the advantage of np.at_leastnd` over `np.array(a, copy=False, ndim=n)`</div><div id="bloop_customfont" style="margin:0px"><br></div><div id="bloop_customfont" style="margin:0px">Readability, clearly.</div><div id="bloop_customfont" style="margin:0px"><br></div><div id="bloop_customfont" style="margin:0px">My only concern is the described behavior of np.at_least3d, which came as a surprise. I certainly would expect the “at_least” family to all work in the same way as broadcasting, ie prepending singleton dimensions. Prepend/append behavior can be controlled either by keyword or simply by using .T, I don’t mind either way.</div></div> <div id="bloop_sign_1467816787289675008" class="bloop_sign"><br></div><div id="bloop_sign_1467816787289675008" class="bloop_sign">Juan.</div> <br><p class="airmail_on">On 6 July 2016 at 10:22:15 AM, Marten van Kerkwijk (<a href="mailto:m.h.vankerkwijk@gmail.com">m.h.vankerkwijk@gmail.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>
<title></title>
<div dir="ltr">Hi All,<br>
<div><br>
I'm with Nathaniel here, in that I don't really see the point of
these routines in the first place: broadcasting takes care of many
of the initial use cases one might think of, and others are
generally not all that well served by them: the examples from scipy
to me do not really support `at_least?d`, but rather suggest that
little thought has been put into higher-dimensional objects which
should be treated as stacks of row or column vectors. My sense is
that we're better off developing the direction started with
`matmul`, perhaps adding `matvecmul` etc.<br>
<div class="gmail_extra"><br></div>
<div class="gmail_extra">More to the point of the initial inquiry:
what is the advantage of having a general `np.at_leastnd` routine
over doing<br></div>
<div class="gmail_extra">```<br></div>
<div class="gmail_extra">np.array(a, copy=False, ndim=n)<br>
```<br></div>
<div class="gmail_extra">or, for a list of inputs,<br>
```<br></div>
<div class="gmail_extra">[np.array(a, copy=False, ndim=n) for a in
input_list]<br>
```<br>
<br></div>
<div class="gmail_extra">All the best,<br>
<br></div>
<div class="gmail_extra">Marten<br></div>
</div>
</div>
_______________________________________________
<br>NumPy-Discussion mailing list
<br><a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a>
<br><a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion">https://mail.scipy.org/mailman/listinfo/numpy-discussion</a>
<br></div></div></span></blockquote></body></html>