[Numpy-discussion] RE: default axis for numarray
eric at enthought.com
Mon Jun 10 16:16:03 CDT 2002
So one contentious issue a day isn't enough, huh? :-)
> An issue that has been raised by scipy (most notably Eric Jones
> and Travis Oliphant) has been whether the default axis used by
> various functions should be changed from the current Numeric
> default. This message is not directed at determining whether we
> should change the current Numeric behavior for Numeric, but whether
> numarray should adopt the same behavior as the current Numeric.
> To be more specific, certain functions and methods, such as
> add.reduce(), operate by default on the first axis. For example,
> if x is a 2 x 10 array, then add.reduce(x) results in a
> 10 element array, where elements in the first dimension has
> been summed over rather than the most rapidly varying dimension.
> >>> x = arange(20)
> >>> x.shape = (2,10)
> >>> x
> array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
> [[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]])
> >>> add.reduce(x)
> array([10, 12, 14, 16, 18, 20, 22, 24, 26, 28])
The issue here is both consistency across a library and speed.
More information about the Numpy-discussion