<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 14, 2018 at 8:57 AM Stephan Hoyer <<a href="mailto:shoyer@gmail.com">shoyer@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>It recently came up on GitHub (at part of the discussion in <a href="https://github.com/numpy/numpy/issues/12379" target="_blank">https://github.com/numpy/numpy/issues/12379</a>) that numpy.linspace could, at least in principle, be modified to support array inputs:</div><div><br>It looks like this has been requested on StackOverflow, too:<br></div><div><a href="https://stackoverflow.com/questions/46694167/vectorized-numpy-linspace-across-multi-dimensional-arrays" target="_blank">https://stackoverflow.com/questions/46694167/vectorized-numpy-linspace-across-multi-dimensional-arrays</a><br></div><div><br></div><div>My tentative proposal:</div><div>- "start" and "stop" are broadcast against each other to form start/stop arrays. (Or we could require that start/stop have matching shape.)</div><div>- A new dimension of size "num" is inserted into the result, either along the first or last axis.</div><div>- A new keyword argument "axis" could control where the axis is inserted in the result.</div><div>- Vectorization support should be added in the same way to geomspace and logspace.</div><div><br></div><div>Does this seem like a good idea? It's a relatively simple generalization, and one that I, at least, would find useful (I can think of a use-case in my own code that came up just last week).</div></div></blockquote><div><br></div><div>This feels a bit forced. There's not much relevance to the minor performance gain, and for code clarity it probably also wouldn't help (actually it hurts usability for 99.x% of use cases by making the doc more complicated). Not sure that it really would require a new axis argument, as Marten said on the issue. Also, the num keyword cannot be vectorized, unless one returns a list of arrays, which would actually be more natural here than a 2-D array.</div><div><br></div><div>So, at best a don't care for me - I'm -0.5.</div><div><br></div><div>Cheers,<br></div><div>Ralf</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br class="m_3921309089372384518inbox-inbox-Apple-interchange-newline">I doubt I'll have time to implement this myself in the near future, but I thought I would get the discussion going -- this might be a good project for a new contributor to work on.<div><br></div><div>Cheers,</div><div>Stephan</div><div><br></div></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div></div>