diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/defmatrix.py | 20 | ||||
-rw-r--r-- | numpy/core/fromnumeric.py | 8 | ||||
-rw-r--r-- | numpy/core/memmap.py | 3 | ||||
-rw-r--r-- | numpy/core/numerictypes.py | 8 | ||||
-rw-r--r-- | numpy/core/tests/test_numerictypes.py | 6 | ||||
-rw-r--r-- | numpy/core/tests/test_regression.py | 8 | ||||
-rw-r--r-- | numpy/core/tests/test_scalarmath.py | 2 |
7 files changed, 27 insertions, 28 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py index 85eab179f..de37a2686 100644 --- a/numpy/core/defmatrix.py +++ b/numpy/core/defmatrix.py @@ -390,11 +390,11 @@ class matrix(N.ndarray): ----- The standard deviation is the square root of the average of the squared deviations from the mean, i.e. var = - sqrt(mean(abs(x - x.mean())**2)). The computed standard - deviation is computed by dividing by the number of elements, - N-ddof. The option ddof defaults to zero, that is, a biased - estimate. Note that for complex numbers std takes the absolute - value before squaring, so that the result is always real + sqrt(mean(abs(x - x.mean())**2)). The computed standard + deviation is computed by dividing by the number of elements, + N-ddof. The option ddof defaults to zero, that is, a biased + estimate. Note that for complex numbers std takes the absolute + value before squaring, so that the result is always real and nonnegative. """ @@ -439,11 +439,11 @@ class matrix(N.ndarray): ----- The variance is the average of the squared deviations from the - mean, i.e. var = mean(abs(x - x.mean())**2). The mean is - computed by dividing by N-ddof, where N is the number of elements. - The argument ddof defaults to zero; for an unbiased estimate - supply ddof=1. Note that for complex numbers the absolute value - is taken before squaring, so that the result is always real + mean, i.e. var = mean(abs(x - x.mean())**2). The mean is + computed by dividing by N-ddof, where N is the number of elements. + The argument ddof defaults to zero; for an unbiased estimate + supply ddof=1. Note that for complex numbers the absolute value + is taken before squaring, so that the result is always real and nonnegative. """ return N.ndarray.var(self, axis, dtype, out)._align(axis) diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 471a50a8c..35c2e9a65 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1671,10 +1671,10 @@ def std(a, axis=None, dtype=None, out=None, ddof=0): Notes ----- The standard deviation is the square root of the average of the squared - deviations from the mean, i.e. var = sqrt(mean(abs(x - x.mean())**2)). - The computed standard deviation is computed by dividing by the number of - elements, N-ddof. The option ddof defaults to zero, that is, a - biased estimate. Note that for complex numbers std takes the absolute + deviations from the mean, i.e. var = sqrt(mean(abs(x - x.mean())**2)). + The computed standard deviation is computed by dividing by the number of + elements, N-ddof. The option ddof defaults to zero, that is, a + biased estimate. Note that for complex numbers std takes the absolute value before squaring, so that the result is always real and nonnegative. Examples diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py index 93950c5c0..c7705d263 100644 --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -20,7 +20,7 @@ class memmap(ndarray): Memory-mapped files are used for accessing small segments of large files on disk, without reading the entire file into memory. Numpy's memmaps are - array-like objects. This differs from python's mmap module which are + array-like objects. This differs from python's mmap module which are file-like objects. Parameters @@ -250,4 +250,3 @@ class memmap(ndarray): # flush any changes to disk, even if it's a view self.flush() self._close() - diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index ae0b57eec..3c4e8ad8c 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -606,7 +606,7 @@ def _find_common_coerce(a, b): return newdtype thisind += 1 return None - + def find_common_type(array_types, scalar_types): """Determine common type following standard coercion rules @@ -617,13 +617,13 @@ def find_common_type(array_types, scalar_types): A list of dtype convertible objects representing arrays scalar_types : sequence A list of dtype convertible objects representing scalars - + Returns ------- datatype : dtype The common data-type which is the maximum of the array_types ignoring the scalar_types unless the maximum of the scalar_types - is of a different kind. + is of a different kind. If the kinds is not understood, then None is returned. """ @@ -646,7 +646,7 @@ def find_common_type(array_types, scalar_types): index_sc = _kind_list.index(maxsc.kind) except ValueError: return None - + if index_sc > index_a: return _find_common_coerce(maxsc,maxa) else: diff --git a/numpy/core/tests/test_numerictypes.py b/numpy/core/tests/test_numerictypes.py index f0533e062..bfbd91fec 100644 --- a/numpy/core/tests/test_numerictypes.py +++ b/numpy/core/tests/test_numerictypes.py @@ -355,10 +355,10 @@ class TestCommonType(NumpyTestCase): res = numpy.find_common_type(['u8','i8','i8'],['f8']) assert(res == 'f8') - - - + + + if __name__ == "__main__": NumpyTest().run() diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index 4f9996227..68231e2ed 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -818,10 +818,10 @@ class TestRegression(NumpyTestCase): np.indices((0,3,4)).T.reshape(-1,3) def check_flat_byteorder(self, level=rlevel): - """Ticket #657""" - x = np.arange(10) - assert_array_equal(x.astype('>i4'),x.astype('<i4').flat[:]) - assert_array_equal(x.astype('>i4').flat[:],x.astype('<i4')) + """Ticket #657""" + x = np.arange(10) + assert_array_equal(x.astype('>i4'),x.astype('<i4').flat[:]) + assert_array_equal(x.astype('>i4').flat[:],x.astype('<i4')) def check_uint64_from_negative(self, level=rlevel) : assert_equal(np.uint64(-2), np.uint64(18446744073709551614)) diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index a3175664b..d07460516 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -76,7 +76,7 @@ class TestRepr(NumpyTestCase): def check_float_repr(self): from numpy import nan, inf for t in [np.float32, np.float64, np.longdouble]: - if t is np.longdouble: # skip it for now. + if t is np.longdouble: # skip it for now. continue finfo=np.finfo(t) last_fraction_bit_idx = finfo.nexp + finfo.nmant |