[NumPy-Tickets] [NumPy] #1434: out argument ignored by var and std
NumPy Trac
numpy-tickets@scipy....
Thu Mar 18 09:37:25 CDT 2010
#1434: out argument ignored by var and std
---------------------+------------------------------------------------------
Reporter: a.naldi | Owner: somebody
Type: defect | Status: new
Priority: high | Milestone:
Component: Other | Version:
Keywords: |
---------------------+------------------------------------------------------
when providing an axis, the mean, var and std functions return an array of
results. The out argument enables to provide an already allocated array to
store the result, which works fine for mean but not for var and std
exemple ipython session:
{{{
In [1]: import numpy as np
In [2]: data = np.array(((1,2,3),(4,5,6),(7,8,9)))
In [3]: result = np.zeros((3,))
In [4]: data.mean(axis=1, out=result) == result
Out[4]: array([ True, True, True], dtype=bool)
In [5]: data.var(axis=1, out=result) == result
Out[5]: array([False, False, False], dtype=bool)
In [6]: data.var(axis=1, out=result)
Out[6]: array([ 0.66666667, 0.66666667, 0.66666667])
In [7]: result
Out[7]: array([ 2., 5., 8.])
}}}
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1434>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list