[Numpy-discussion] Rationale for atleast_3d
robert.kern at gmail.com
Fri Sep 22 16:14:47 CDT 2006
Travis Oliphant wrote:
> Bill Baxter wrote:
>> 26 weeks, 4 days, 2 hours and 9 minutes ago, Zdeněk Hurák asked why
>> atleast_3d acts the way it does:
>> He doesn't seem to have gotten any answers. And now I'm wondering the
>> same thing. Anyone have any idea?
> This function came from scipy and was written by somebody at Enthought.
> I was hoping they would respond.
That would have either been from Eric or Travis V way back in the day. Both are
out of the office today. The "3D arrays as stacks of 2D arrays" is probably as
good an explanation as any. Much of Numeric (e.g. the axis dot() reduces over)
was predicated on that kind of logic. There is probably some kind of consistency
argument with dstack() and atleast_2d(), i.e.
In : a = arange(5)
In : atleast_3d(a)
In : dstack([a, a])
In : dstack(map(atleast_2d, [a, a]))
In : dstack(map(atleast_3d, [a, a]))
That's the problem with consistency arguments; there are so many things one
could be consistent with!
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion