On 14.11.18 17:57, Stephan Hoyer wrote: > It recently came up on GitHub (at part of the discussion > in https://github.com/numpy/numpy/issues/12379) that numpy.linspace > could, at least in principle, be modified to support array inputs: > > It looks like this has been requested on StackOverflow, too: > https://stackoverflow.com/questions/46694167/vectorized-numpy-linspace-across-multi-dimensional-arrays > > My tentative proposal: > - "start" and "stop" are broadcast against each other to form start/stop > arrays. (Or we could require that start/stop have matching shape.) > - A new dimension of size "num" is inserted into the result, either > along the first or last axis. > - A new keyword argument "axis" could control where the axis is inserted > in the result. > - Vectorization support should be added in the same way to geomspace and > logspace.
This reminds me of a function [1] I wrote which I think has a lot of similarities to what Stephan describes here. It is currently part of a PR to rewrite numpy.pad [2]. Maybe that's helpful to know depending on how this discussion resolves. :) Best regards, Lars [1] https://github.com/lagru/numpy/blob/605fc1d7f871b1c8cf2783f594dee88cdf96d7ec/numpy/lib/arraypad.py#L14-L67 [2] https://github.com/numpy/numpy/pull/11358 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion