[Numpy-tickets] [NumPy] #518: a.var(), a.std(), and a.mean() return incorrect type when no axis specified
NumPy
numpy-tickets@scipy....
Sat May 12 12:54:20 CDT 2007
#518: a.var(), a.std(), and a.mean() return incorrect type when no axis specified
---------------------+------------------------------------------------------
Reporter: charris | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: 1.0.3 Release
Component: Other | Version: none
Severity: normal | Keywords: return type var std mean
---------------------+------------------------------------------------------
The dtype keyword has no effect when the {variance,std,mean} is computed
using the default axis:
{{{
In [28]: eye(2).var(dtype=float32).dtype
Out[28]: dtype('float64')
}}}
It does work when the axis is specified.
{{{
In [29]: eye(2).var(axis=0,dtype=float32).dtype
Out[29]: dtype('float32')
}}}
Integer types are always ignored:
{{{
In [35]: eye(2).var(axis=0,dtype=int).dtype
Out[35]: dtype('float64')
}}}
The question here is whether int specifies the accumulator type, which
should probably raise an error, or the return type for values computed
using float64.
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/518>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list