[Numpy-discussion] speed of atleast_1d and friends
Tue Aug 4 09:37:03 CDT 2009
On Tue, Aug 4, 2009 at 4:23 AM, Mark Bakker<firstname.lastname@example.org> wrote:
> Hello all,
> I am making a lot of use of atleast_1d and atleast_2d in my routines.
> Does anybody know whether this will slow down my code significantly?
res = 
for ary in arys:
if len(res) == 1:
If you only pass in on array at a time, that reduces to:
return array(ary, copy=False, subok=True, ndmin=1)
That might save some time.
I'm always amazed at the solutions people come up with on this list.
So if you send an example, someone might be able to get rid of the
need for atleast_1d.
More information about the NumPy-Discussion