From: Sebastian H. <ha...@ms...> - 2006-09-22 21:50:06
|
On Friday 22 September 2006 12:57, Travis Oliphant wrote: > Bill Baxter wrote: > >26 weeks, 4 days, 2 hours and 9 minutes ago, Zden=ECk Hur=E1k asked why > >atleast_3d acts the way it does: > >http://article.gmane.org/gmane.comp.python.numeric.general/4382/match=3D= atle > >ast+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=3DFalse, ndmin=3D3) will always produce arrays w= ith > 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. > I'm working with "stacks of 2d arrays" -- but I was always under the=20 impression that -- since the last axis is the "fastest" -- "stacks of=20 <something>" should stack in the first dimension -- not the last --so that= =20 the members of the stack still remain contiguous is memory. Is there a general consensus on how one should look at this ? Or are there= =20 multiple incompatible view -- maybe coming from different fields -- ? =2DSebastian |