# [Numpy-discussion] Rationale for atleast_3d

Travis Oliphant oliphant at ee.byu.edu
Fri Sep 22 14:57:10 CDT 2006

```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:
>http://article.gmane.org/gmane.comp.python.numeric.general/4382/match=atleast+3d
>
>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.   The behavior of atleast_3d does make
sense in the context of atleast_2d and thinking of 3-d arrays as
"stacks" of 2-d arrays where the stacks are in the last dimension.

atleast_2d converts 1-d arrays to 1xN  arrays

atleast_3d converts 1-d arrays to 1xNx1 arrays so that they can be
"stacked" in the last dimension.  I agree that this isn't consistent
with the general notion of "pre-pending" 1's to increase the
dimensionality of the array.

However,  array(a, copy=False, ndmin=3)  will always produce arrays with
a 1 at the begining.  So at_least3d is convenient if you like to think
of 3-d arrays of stacks of 2-d arrays where the last axis is the
"stacking" dimension.

-Travis

```