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:
>> 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.

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 [46]: a = arange(5)

In [47]: atleast_3d(a)
Out[47]:
array([[[0],
         [1],
         [2],
         [3],
         [4]]])

In [48]: dstack([a, a])
Out[48]:
array([[[0, 0],
         [1, 1],
         [2, 2],
         [3, 3],
         [4, 4]]])

In [49]: dstack(map(atleast_2d, [a, a]))
Out[49]:
array([[[0, 0],
         [1, 1],
         [2, 2],
         [3, 3],
         [4, 4]]])

In [50]: dstack(map(atleast_3d, [a, a]))
Out[50]:
array([[[0, 0],
         [1, 1],
         [2, 2],
         [3, 3],
         [4, 4]]])


That's the problem with consistency arguments; there are so many things one 
could be consistent with!

-- 
Robert Kern

"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


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to