-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The docstring of np.random.pareto (Version 1.8.0) contains multiple critical errors #4181
Comments
I stumbled on this same issue just now. It is a bit sad that it has not been fixed, since it is so simple to do, and can cause quite a large time loss.
The mathematics in teh example are correct, the only thing left to do is to change "s = np.random.pareto(a, 1000) + m" into "s = (np.random.pareto(a, 1000)+1)*m". Also, one may remove the argument ",align='centered' ", which seems to have become incorrect. |
What needs to happen for it to be fixed, is for someone who understands the On Tue, Jan 6, 2015 at 4:18 PM, F.P. Landes notifications@github.com
Nathaniel J. Smith |
are the webpages of the doc available ? Can I just edit the webpage and submit the new version ? If so, that's all that need to be done |
by available, I mean as part of the github project, so that I can make a pull (I am a noob to github but I know html) |
Pareto distribution is here. |
Docstring of "pareto" lightly changed, according to the discussion : numpy#4181 (comment)
thanks ! I just did it ! :) |
I am not sure if it is relevant here, but if it is just documentation change, you can skip the Travis CI build. All you need to do is to add Also the commit messages can be documented according to this. In case you want to close an issue, once the pull request is merged, you can add notes like |
There are a few more issues pointed out than fixed in gh-5427 by @ckuehne.
|
Here's an attempt to address all those issues: rgommers@adeb220 |
Submitted that commit as gh-5459 |
DOC: fix a few bugs in the random.pareto docstring. Closes gh-4181.
Reviewed by: wiz@ Upstream changes: NumPy 1.9.2 Release Notes ************************* This is a bugfix only release in the 1.9.x series. Issues fixed ============ * `#5316 <https://github.com/numpy/numpy/issues/5316>`__: fix too large dtype alignment of strings and complex types * `#5424 <https://github.com/numpy/numpy/issues/5424>`__: fix ma.median when used on ndarrays * `#5481 <https://github.com/numpy/numpy/issues/5481>`__: Fix astype for structured array fields of different byte order * `#5354 <https://github.com/numpy/numpy/issues/5354>`__: fix segfault when clipping complex arrays * `#5524 <https://github.com/numpy/numpy/issues/5524>`__: allow np.argpartition on non ndarrays * `#5612 <https://github.com/numpy/numpy/issues/5612>`__: Fixes ndarray.fill to accept full range of uint64 * `#5155 <https://github.com/numpy/numpy/issues/5155>`__: Fix loadtxt with comments=None and a string None data * `#4476 <https://github.com/numpy/numpy/issues/4476>`__: Masked array view fails if structured dtype has datetime component * `#5388 <https://github.com/numpy/numpy/issues/5388>`__: Make RandomState.set_state and RandomState.get_state threadsafe * `#5390 <https://github.com/numpy/numpy/issues/5390>`__: make seed, randint and shuffle threadsafe * `#5374 <https://github.com/numpy/numpy/issues/5374>`__: Fixed incorrect assert_array_almost_equal_nulp documentation * `#5393 <https://github.com/numpy/numpy/issues/5393>`__: Add support for ATLAS > 3.9.33. * `#5313 <https://github.com/numpy/numpy/issues/5313>`__: PyArray_AsCArray caused segfault for 3d arrays * `#5492 <https://github.com/numpy/numpy/issues/5492>`__: handle out of memory in rfftf * `#4181 <https://github.com/numpy/numpy/issues/4181>`__: fix a few bugs in the random.pareto docstring * `#5359 <https://github.com/numpy/numpy/issues/5359>`__: minor changes to linspace docstring * `#4723 <https://github.com/numpy/numpy/issues/4723>`__: fix a compile issues on AIX NumPy 1.9.1 Release Notes ************************* This is a bugfix only release in the 1.9.x series. Issues fixed ============ * gh-5184: restore linear edge behaviour of gradient to as it was in < 1.9. The second order behaviour is available via the `edge_order` keyword * gh-4007: workaround Accelerate sgemv crash on OSX 10.9 * gh-5100: restore object dtype inference from iterable objects without `len()` * gh-5163: avoid gcc-4.1.2 (red hat 5) miscompilation causing a crash * gh-5138: fix nanmedian on arrays containing inf * gh-5240: fix not returning out array from ufuncs with subok=False set * gh-5203: copy inherited masks in MaskedArray.__array_finalize__ * gh-2317: genfromtxt did not handle filling_values=0 correctly * gh-5067: restore api of npy_PyFile_DupClose in python2 * gh-5063: cannot convert invalid sequence index to tuple * gh-5082: Segmentation fault with argmin() on unicode arrays * gh-5095: don't propagate subtypes from np.where * gh-5104: np.inner segfaults with SciPy's sparse matrices * gh-5251: Issue with fromarrays not using correct format for unicode arrays * gh-5136: Import dummy_threading if importing threading fails * gh-5148: Make numpy import when run with Python flag '-OO' * gh-5147: Einsum double contraction in particular order causes ValueError * gh-479: Make f2py work with intent(in out) * gh-5170: Make python2 .npy files readable in python3 * gh-5027: Use 'll' as the default length specifier for long long * gh-4896: fix build error with MSVC 2013 caused by C99 complex support * gh-4465: Make PyArray_PutTo respect writeable flag * gh-5225: fix crash when using arange on datetime without dtype set * gh-5231: fix build in c99 mode NumPy 1.9.0 Release Notes ************************* This release supports Python 2.6 - 2.7 and 3.2 - 3.4. Highlights ========== * Numerous performance improvements in various areas, most notably indexing and operations on small arrays are significantly faster. Indexing operations now also release the GIL. * Addition of `nanmedian` and `nanpercentile` rounds out the nanfunction set. Dropped Support =============== * The oldnumeric and numarray modules have been removed. * The doc/pyrex and doc/cython directories have been removed. * The doc/numpybook directory has been removed. * The numpy/testing/numpytest.py file has been removed together with the importall function it contained. Future Changes ============== * The numpy/polynomial/polytemplate.py file will be removed in NumPy 1.10.0. * Default casting for inplace operations will change to 'same_kind' in Numpy 1.10.0. This will certainly break some code that is currently ignoring the warning. * Relaxed stride checking will be the default in 1.10.0 * String version checks will break because, e.g., '1.9' > '1.10' is True. A NumpyVersion class has been added that can be used for such comparisons. * The diagonal and diag functions will return writeable views in 1.10.0 * The `S` and/or `a` dtypes may be changed to represent Python strings instead of bytes, in Python 3 these two types are very different. Compatibility notes =================== The diagonal and diag functions return readonly views. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In NumPy 1.8, the diagonal and diag functions returned readonly copies, in NumPy 1.9 they return readonly views, and in 1.10 they will return writeable views. Special scalar float values don't cause upcast to double anymore ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In previous numpy versions operations involving floating point scalars containing special values ``NaN``, ``Inf`` and ``-Inf`` caused the result type to be at least ``float64``. As the special values can be represented in the smallest available floating point type, the upcast is not performed anymore. For example the dtype of: ``np.array([1.], dtype=np.float32) * float('nan')`` now remains ``float32`` instead of being cast to ``float64``. Operations involving non-special values have not been changed. Percentile output changes ~~~~~~~~~~~~~~~~~~~~~~~~~ If given more than one percentile to compute numpy.percentile returns an array instead of a list. A single percentile still returns a scalar. The array is equivalent to converting the list returned in older versions to an array via ``np.array``. If the ``overwrite_input`` option is used the input is only partially instead of fully sorted. ndarray.tofile exception type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All ``tofile`` exceptions are now ``IOError``, some were previously ``ValueError``. Invalid fill value exceptions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Two changes to numpy.ma.core._check_fill_value: * When the fill value is a string and the array type is not one of 'OSUV', TypeError is raised instead of the default fill value being used. * When the fill value overflows the array type, TypeError is raised instead of OverflowError. Polynomial Classes no longer derived from PolyBase ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This may cause problems with folks who depended on the polynomial classes being derived from PolyBase. They are now all derived from the abstract base class ABCPolyBase. Strictly speaking, there should be a deprecation involved, but no external code making use of the old baseclass could be found. Using numpy.random.binomial may change the RNG state vs. numpy < 1.9 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A bug in one of the algorithms to generate a binomial random variate has been fixed. This change will likely alter the number of random draws performed, and hence the sequence location will be different after a call to distribution.c::rk_binomial_btpe. Any tests which rely on the RNG being in a known state should be checked and/or updated as a result. Random seed enforced to be a 32 bit unsigned integer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.random.seed`` and ``np.random.RandomState`` now throw a ``ValueError`` if the seed cannot safely be converted to 32 bit unsigned integers. Applications that now fail can be fixed by masking the higher 32 bit values to zero: ``seed = seed & 0xFFFFFFFF``. This is what is done silently in older versions so the random stream remains the same. Argmin and argmax out argument ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``out`` argument to ``np.argmin`` and ``np.argmax`` and their equivalent C-API functions is now checked to match the desired output shape exactly. If the check fails a ``ValueError`` instead of ``TypeError`` is raised. Einsum ~~~~~~ Remove unnecessary broadcasting notation restrictions. ``np.einsum('ijk,j->ijk', A, B)`` can also be written as ``np.einsum('ij...,j->ij...', A, B)`` (ellipsis is no longer required on 'j') Indexing ~~~~~~~~ The NumPy indexing has seen a complete rewrite in this version. This makes most advanced integer indexing operations much faster and should have no other implications. However some subtle changes and deprecations were introduced in advanced indexing operations: * Boolean indexing into scalar arrays will always return a new 1-d array. This means that ``array(1)[array(True)]`` gives ``array([1])`` and not the original array. * Advanced indexing into one dimensional arrays used to have (undocumented) special handling regarding repeating the value array in assignments when the shape of the value array was too small or did not match. Code using this will raise an error. For compatibility you can use ``arr.flat[index] = values``, which uses the old code branch. (for example ``a = np.ones(10); a[np.arange(10)] = [1, 2, 3]``) * The iteration order over advanced indexes used to be always C-order. In NumPy 1.9. the iteration order adapts to the inputs and is not guaranteed (with the exception of a *single* advanced index which is never reversed for compatibility reasons). This means that the result is undefined if multiple values are assigned to the same element. An example for this is ``arr[[0, 0], [1, 1]] = [1, 2]``, which may set ``arr[0, 1]`` to either 1 or 2. * Equivalent to the iteration order, the memory layout of the advanced indexing result is adapted for faster indexing and cannot be predicted. * All indexing operations return a view or a copy. No indexing operation will return the original array object. (For example ``arr[...]``) * In the future Boolean array-likes (such as lists of python bools) will always be treated as Boolean indexes and Boolean scalars (including python ``True``) will be a legal *boolean* index. At this time, this is already the case for scalar arrays to allow the general ``positive = a[a > 0]`` to work when ``a`` is zero dimensional. * In NumPy 1.8 it was possible to use ``array(True)`` and ``array(False)`` equivalent to 1 and 0 if the result of the operation was a scalar. This will raise an error in NumPy 1.9 and, as noted above, treated as a boolean index in the future. * All non-integer array-likes are deprecated, object arrays of custom integer like objects may have to be cast explicitly. * The error reporting for advanced indexing is more informative, however the error type has changed in some cases. (Broadcasting errors of indexing arrays are reported as ``IndexError``) * Indexing with more then one ellipsis (``...``) is deprecated. Non-integer reduction axis indexes are deprecated ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Non-integer axis indexes to reduction ufuncs like `add.reduce` or `sum` are deprecated. ``promote_types`` and string dtype ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``promote_types`` function now returns a valid string length when given an integer or float dtype as one argument and a string dtype as another argument. Previously it always returned the input string dtype, even if it wasn't long enough to store the max integer/float value converted to a string. ``can_cast`` and string dtype ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``can_cast`` function now returns False in "safe" casting mode for integer/float dtype and string dtype if the string dtype length is not long enough to store the max integer/float value converted to a string. Previously ``can_cast`` in "safe" mode returned True for integer/float dtype and a string dtype of any length. astype and string dtype ~~~~~~~~~~~~~~~~~~~~~~~ The ``astype`` method now returns an error if the string dtype to cast to is not long enough in "safe" casting mode to hold the max value of integer/float array that is being casted. Previously the casting was allowed even if the result was truncated. `npyio.recfromcsv` keyword arguments change ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `npyio.recfromcsv` no longer accepts the undocumented `update` keyword, which used to override the `dtype` keyword. The ``doc/swig`` directory moved ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``doc/swig`` directory has been moved to ``tools/swig``. The ``npy_3kcompat.h`` header changed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The unused ``simple_capsule_dtor`` function has been removed from ``npy_3kcompat.h``. Note that this header is not meant to be used outside of numpy; other projects should be using their own copy of this file when needed. Negative indices in C-Api ``sq_item`` and ``sq_ass_item`` sequence methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When directly accessing the ``sq_item`` or ``sq_ass_item`` PyObject slots for item getting, negative indices will not be supported anymore. ``PySequence_GetItem`` and ``PySequence_SetItem`` however fix negative indices so that they can be used there. NDIter ~~~~~~ When ``NpyIter_RemoveAxis`` is now called, the iterator range will be reset. When a multi index is being tracked and an iterator is not buffered, it is possible to use ``NpyIter_RemoveAxis``. In this case an iterator can shrink in size. Because the total size of an iterator is limited, the iterator may be too large before these calls. In this case its size will be set to ``-1`` and an error issued not at construction time but when removing the multi index, setting the iterator range, or getting the next function. This has no effect on currently working code, but highlights the necessity of checking for an error return if these conditions can occur. In most cases the arrays being iterated are as large as the iterator so that such a problem cannot occur. This change was already applied to the 1.8.1 release. ``zeros_like`` for string dtypes now returns empty strings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To match the `zeros` function `zeros_like` now returns an array initialized with empty strings instead of an array filled with `'0'`. New Features ============ Percentile supports more interpolation options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.percentile`` now has the interpolation keyword argument to specify in which way points should be interpolated if the percentiles fall between two values. See the documentation for the available options. Generalized axis support for median and percentile ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.median`` and ``np.percentile`` now support generalized axis arguments like ufunc reductions do since 1.7. One can now say axis=(index, index) to pick a list of axes for the reduction. The ``keepdims`` keyword argument was also added to allow convenient broadcasting to arrays of the original shape. Dtype parameter added to ``np.linspace`` and ``np.logspace`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The returned data type from the ``linspace`` and ``logspace`` functions can now be specified using the dtype parameter. More general ``np.triu`` and ``np.tril`` broadcasting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For arrays with ``ndim`` exceeding 2, these functions will now apply to the final two axes instead of raising an exception. ``tobytes`` alias for ``tostring`` method ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``ndarray.tobytes`` and ``MaskedArray.tobytes`` have been added as aliases for ``tostring`` which exports arrays as ``bytes``. This is more consistent in Python 3 where ``str`` and ``bytes`` are not the same. Build system ~~~~~~~~~~~~ Added experimental support for the ppc64le and OpenRISC architecture. Compatibility to python ``numbers`` module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All numerical numpy types are now registered with the type hierarchy in the python ``numbers`` module. ``increasing`` parameter added to ``np.vander`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ordering of the columns of the Vandermonde matrix can be specified with this new boolean argument. ``unique_counts`` parameter added to ``np.unique`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The number of times each unique item comes up in the input can now be obtained as an optional return value. Support for median and percentile in nanfunctions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``np.nanmedian`` and ``np.nanpercentile`` functions behave like the median and percentile functions except that NaNs are ignored. NumpyVersion class added ~~~~~~~~~~~~~~~~~~~~~~~~ The class may be imported from numpy.lib and can be used for version comparison when the numpy version goes to 1.10.devel. For example:: >>> from numpy.lib import NumpyVersion >>> if NumpyVersion(np.__version__) < '1.10.0'): ... print('Wow, that is an old NumPy version!') Allow saving arrays with large number of named columns ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The numpy storage format 1.0 only allowed the array header to have a total size of 65535 bytes. This can be exceeded by structured arrays with a large number of columns. A new format 2.0 has been added which extends the header size to 4 GiB. `np.save` will automatically save in 2.0 format if the data requires it, else it will always use the more compatible 1.0 format. Full broadcasting support for ``np.cross`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.cross`` now properly broadcasts its two input arrays, even if they have different number of dimensions. In earlier versions this would result in either an error being raised, or wrong results computed. Improvements ============ Better numerical stability for sum in some cases ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pairwise summation is now used in the sum method, but only along the fast axis and for groups of the values <= 8192 in length. This should also improve the accuracy of var and std in some common cases. Percentile implemented in terms of ``np.partition`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.percentile`` has been implemented in terms of ``np.partition`` which only partially sorts the data via a selection algorithm. This improves the time complexity from ``O(nlog(n))`` to ``O(n)``. Performance improvement for ``np.array`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The performance of converting lists containing arrays to arrays using ``np.array`` has been improved. It is now equivalent in speed to ``np.vstack(list)``. Performance improvement for ``np.searchsorted`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For the built-in numeric types, ``np.searchsorted`` no longer relies on the data type's ``compare`` function to perform the search, but is now implemented by type specific functions. Depending on the size of the inputs, this can result in performance improvements over 2x. Optional reduced verbosity for np.distutils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set ``numpy.distutils.system_info.system_info.verbosity = 0`` and then calls to ``numpy.distutils.system_info.get_info('blas_opt')`` will not print anything on the output. This is mostly for other packages using numpy.distutils. Covariance check in ``np.random.multivariate_normal`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A ``RuntimeWarning`` warning is raised when the covariance matrix is not positive-semidefinite. Polynomial Classes no longer template based ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The polynomial classes have been refactored to use an abstract base class rather than a template in order to implement a common interface. This makes importing the polynomial package faster as the classes do not need to be compiled on import. More GIL releases ~~~~~~~~~~~~~~~~~ Several more functions now release the Global Interpreter Lock allowing more efficient parallization using the ``threading`` module. Most notably the GIL is now released for fancy indexing, ``np.where`` and the ``random`` module now uses a per-state lock instead of the GIL. MaskedArray support for more complicated base classes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Built-in assumptions that the baseclass behaved like a plain array are being removed. In particalur, ``repr`` and ``str`` should now work more reliably. C-API ~~~~~ Deprecations ============ Non-integer scalars for sequence repetition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Using non-integer numpy scalars to repeat python sequences is deprecated. For example ``np.float_(2) * [1]`` will be an error in the future. ``select`` input deprecations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The integer and empty input to ``select`` is deprecated. In the future only boolean arrays will be valid conditions and an empty ``condlist`` will be considered an input error instead of returning the default. ``rank`` function ~~~~~~~~~~~~~~~~~ The ``rank`` function has been deprecated to avoid confusion with ``numpy.linalg.matrix_rank``. Object array equality comparisons ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In the future object array comparisons both `==` and `np.equal` will not make use of identity checks anymore. For example: >>> a = np.array([np.array([1, 2, 3]), 1]) >>> b = np.array([np.array([1, 2, 3]), 1]) >>> a == b will consistently return False (and in the future an error) even if the array in `a` and `b` was the same object. The equality operator `==` will in the future raise errors like `np.equal` if broadcasting or element comparisons, etc. fails. Comparison with `arr == None` will in the future do an elementwise comparison instead of just returning False. Code should be using `arr is None`. All of these changes will give Deprecation- or FutureWarnings at this time. C-API ~~~~~ The utility function npy_PyFile_Dup and npy_PyFile_DupClose are broken by the internal buffering python 3 applies to its file objects. To fix this two new functions npy_PyFile_Dup2 and npy_PyFile_DupClose2 are declared in npy_3kcompat.h and the old functions are deprecated. Due to the fragile nature of these functions it is recommended to instead use the python API when possible. This change was already applied to the 1.8.1 release. NumPy 1.8.2 Release Notes ************************* This is a bugfix only release in the 1.8.x series. Issues fixed ============ * gh-4836: partition produces wrong results for multiple selections in equal ranges * gh-4656: Make fftpack._raw_fft threadsafe * gh-4628: incorrect argument order to _copyto in in np.nanmax, np.nanmin * gh-4642: Hold GIL for converting dtypes types with fields * gh-4733: fix np.linalg.svd(b, compute_uv=False) * gh-4853: avoid unaligned simd load on reductions on i386 * gh-4722: Fix seg fault converting empty string to object * gh-4613: Fix lack of NULL check in array_richcompare * gh-4774: avoid unaligned access for strided byteswap * gh-650: Prevent division by zero when creating arrays from some buffers * gh-4602: ifort has issues with optimization flag O2, use O1 NumPy 1.8.1 Release Notes ************************* This is a bugfix only release in the 1.8.x series. Issues fixed ============ * gh-4276: Fix mean, var, std methods for object arrays * gh-4262: remove insecure mktemp usage * gh-2385: absolute(complex(inf)) raises invalid warning in python3 * gh-4024: Sequence assignment doesn't raise exception on shape mismatch * gh-4027: Fix chunked reading of strings longer than BUFFERSIZE * gh-4109: Fix object scalar return type of 0-d array indices * gh-4018: fix missing check for memory allocation failure in ufuncs * gh-4156: high order linalg.norm discards imaginary elements of complex arrays * gh-4144: linalg: norm fails on longdouble, signed int * gh-4094: fix NaT handling in _strided_to_strided_string_to_datetime * gh-4051: fix uninitialized use in _strided_to_strided_string_to_datetime * gh-4093: Loading compressed .npz file fails under Python 2.6.6 * gh-4138: segfault with non-native endian memoryview in python 3.4 * gh-4123: Fix missing NULL check in lexsort * gh-4170: fix native-only long long check in memoryviews * gh-4187: Fix large file support on 32 bit * gh-4152: fromfile: ensure file handle positions are in sync in python3 * gh-4176: clang compatibility: Typos in conversion_utils * gh-4223: Fetching a non-integer item caused array return * gh-4197: fix minor memory leak in memoryview failure case * gh-4206: fix build with single-threaded python * gh-4220: add versionadded:: 1.8.0 to ufunc.at docstring * gh-4267: improve handling of memory allocation failure * gh-4267: fix use of capi without gil in ufunc.at * gh-4261: Detect vendor versions of GNU Compilers * gh-4253: IRR was returning nan instead of valid negative answer * gh-4254: fix unnecessary byte order flag change for byte arrays * gh-3263: numpy.random.shuffle clobbers mask of a MaskedArray * gh-4270: np.random.shuffle not work with flexible dtypes * gh-3173: Segmentation fault when 'size' argument to random.multinomial * gh-2799: allow using unique with lists of complex * gh-3504: fix linspace truncation for integer array scalar * gh-4191: get_info('openblas') does not read libraries key * gh-3348: Access violation in _descriptor_from_pep3118_format * gh-3175: segmentation fault with numpy.array() from bytearray * gh-4266: histogramdd - wrong result for entries very close to last boundary * gh-4408: Fix stride_stricks.as_strided function for object arrays * gh-4225: fix log1p and exmp1 return for np.inf on windows compiler builds * gh-4359: Fix infinite recursion in str.format of flex arrays * gh-4145: Incorrect shape of broadcast result with the exponent operator * gh-4483: Fix commutativity of {dot,multiply,inner}(scalar, matrix_of_objs) * gh-4466: Delay npyiter size check when size may change * gh-4485: Buffered stride was erroneously marked fixed * gh-4354: byte_bounds fails with datetime dtypes * gh-4486: segfault/error converting from/to high-precision datetime64 objects * gh-4428: einsum(None, None, None, None) causes segfault * gh-4134: uninitialized use for for size 1 object reductions Changes ======= NDIter ~~~~~~ When ``NpyIter_RemoveAxis`` is now called, the iterator range will be reset. When a multi index is being tracked and an iterator is not buffered, it is possible to use ``NpyIter_RemoveAxis``. In this case an iterator can shrink in size. Because the total size of an iterator is limited, the iterator may be too large before these calls. In this case its size will be set to ``-1`` and an error issued not at construction time but when removing the multi index, setting the iterator range, or getting the next function. This has no effect on currently working code, but highlights the necessity of checking for an error return if these conditions can occur. In most cases the arrays being iterated are as large as the iterator so that such a problem cannot occur. Optional reduced verbosity for np.distutils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set ``numpy.distutils.system_info.system_info.verbosity = 0`` and then calls to ``numpy.distutils.system_info.get_info('blas_opt')`` will not print anything on the output. This is mostly for other packages using numpy.distutils. Deprecations ============ C-API ~~~~~ The utility function npy_PyFile_Dup and npy_PyFile_DupClose are broken by the internal buffering python 3 applies to its file objects. To fix this two new functions npy_PyFile_Dup2 and npy_PyFile_DupClose2 are declared in npy_3kcompat.h and the old functions are deprecated. Due to the fragile nature of these functions it is recommended to instead use the python API when possible.
Reviewed by: wiz@ Upstream changes: NumPy 1.9.2 Release Notes ************************* This is a bugfix only release in the 1.9.x series. Issues fixed ============ * `#5316 <https://github.com/numpy/numpy/issues/5316>`__: fix too large dtype alignment of strings and complex types * `#5424 <https://github.com/numpy/numpy/issues/5424>`__: fix ma.median when used on ndarrays * `#5481 <https://github.com/numpy/numpy/issues/5481>`__: Fix astype for structured array fields of different byte order * `#5354 <https://github.com/numpy/numpy/issues/5354>`__: fix segfault when clipping complex arrays * `#5524 <https://github.com/numpy/numpy/issues/5524>`__: allow np.argpartition on non ndarrays * `#5612 <https://github.com/numpy/numpy/issues/5612>`__: Fixes ndarray.fill to accept full range of uint64 * `#5155 <https://github.com/numpy/numpy/issues/5155>`__: Fix loadtxt with comments=None and a string None data * `#4476 <https://github.com/numpy/numpy/issues/4476>`__: Masked array view fails if structured dtype has datetime component * `#5388 <https://github.com/numpy/numpy/issues/5388>`__: Make RandomState.set_state and RandomState.get_state threadsafe * `#5390 <https://github.com/numpy/numpy/issues/5390>`__: make seed, randint and shuffle threadsafe * `#5374 <https://github.com/numpy/numpy/issues/5374>`__: Fixed incorrect assert_array_almost_equal_nulp documentation * `#5393 <https://github.com/numpy/numpy/issues/5393>`__: Add support for ATLAS > 3.9.33. * `#5313 <https://github.com/numpy/numpy/issues/5313>`__: PyArray_AsCArray caused segfault for 3d arrays * `#5492 <https://github.com/numpy/numpy/issues/5492>`__: handle out of memory in rfftf * `#4181 <https://github.com/numpy/numpy/issues/4181>`__: fix a few bugs in the random.pareto docstring * `#5359 <https://github.com/numpy/numpy/issues/5359>`__: minor changes to linspace docstring * `#4723 <https://github.com/numpy/numpy/issues/4723>`__: fix a compile issues on AIX NumPy 1.9.1 Release Notes ************************* This is a bugfix only release in the 1.9.x series. Issues fixed ============ * gh-5184: restore linear edge behaviour of gradient to as it was in < 1.9. The second order behaviour is available via the `edge_order` keyword * gh-4007: workaround Accelerate sgemv crash on OSX 10.9 * gh-5100: restore object dtype inference from iterable objects without `len()` * gh-5163: avoid gcc-4.1.2 (red hat 5) miscompilation causing a crash * gh-5138: fix nanmedian on arrays containing inf * gh-5240: fix not returning out array from ufuncs with subok=False set * gh-5203: copy inherited masks in MaskedArray.__array_finalize__ * gh-2317: genfromtxt did not handle filling_values=0 correctly * gh-5067: restore api of npy_PyFile_DupClose in python2 * gh-5063: cannot convert invalid sequence index to tuple * gh-5082: Segmentation fault with argmin() on unicode arrays * gh-5095: don't propagate subtypes from np.where * gh-5104: np.inner segfaults with SciPy's sparse matrices * gh-5251: Issue with fromarrays not using correct format for unicode arrays * gh-5136: Import dummy_threading if importing threading fails * gh-5148: Make numpy import when run with Python flag '-OO' * gh-5147: Einsum double contraction in particular order causes ValueError * gh-479: Make f2py work with intent(in out) * gh-5170: Make python2 .npy files readable in python3 * gh-5027: Use 'll' as the default length specifier for long long * gh-4896: fix build error with MSVC 2013 caused by C99 complex support * gh-4465: Make PyArray_PutTo respect writeable flag * gh-5225: fix crash when using arange on datetime without dtype set * gh-5231: fix build in c99 mode NumPy 1.9.0 Release Notes ************************* This release supports Python 2.6 - 2.7 and 3.2 - 3.4. Highlights ========== * Numerous performance improvements in various areas, most notably indexing and operations on small arrays are significantly faster. Indexing operations now also release the GIL. * Addition of `nanmedian` and `nanpercentile` rounds out the nanfunction set. Dropped Support =============== * The oldnumeric and numarray modules have been removed. * The doc/pyrex and doc/cython directories have been removed. * The doc/numpybook directory has been removed. * The numpy/testing/numpytest.py file has been removed together with the importall function it contained. Future Changes ============== * The numpy/polynomial/polytemplate.py file will be removed in NumPy 1.10.0. * Default casting for inplace operations will change to 'same_kind' in Numpy 1.10.0. This will certainly break some code that is currently ignoring the warning. * Relaxed stride checking will be the default in 1.10.0 * String version checks will break because, e.g., '1.9' > '1.10' is True. A NumpyVersion class has been added that can be used for such comparisons. * The diagonal and diag functions will return writeable views in 1.10.0 * The `S` and/or `a` dtypes may be changed to represent Python strings instead of bytes, in Python 3 these two types are very different. Compatibility notes =================== The diagonal and diag functions return readonly views. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In NumPy 1.8, the diagonal and diag functions returned readonly copies, in NumPy 1.9 they return readonly views, and in 1.10 they will return writeable views. Special scalar float values don't cause upcast to double anymore ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In previous numpy versions operations involving floating point scalars containing special values ``NaN``, ``Inf`` and ``-Inf`` caused the result type to be at least ``float64``. As the special values can be represented in the smallest available floating point type, the upcast is not performed anymore. For example the dtype of: ``np.array([1.], dtype=np.float32) * float('nan')`` now remains ``float32`` instead of being cast to ``float64``. Operations involving non-special values have not been changed. Percentile output changes ~~~~~~~~~~~~~~~~~~~~~~~~~ If given more than one percentile to compute numpy.percentile returns an array instead of a list. A single percentile still returns a scalar. The array is equivalent to converting the list returned in older versions to an array via ``np.array``. If the ``overwrite_input`` option is used the input is only partially instead of fully sorted. ndarray.tofile exception type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All ``tofile`` exceptions are now ``IOError``, some were previously ``ValueError``. Invalid fill value exceptions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Two changes to numpy.ma.core._check_fill_value: * When the fill value is a string and the array type is not one of 'OSUV', TypeError is raised instead of the default fill value being used. * When the fill value overflows the array type, TypeError is raised instead of OverflowError. Polynomial Classes no longer derived from PolyBase ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This may cause problems with folks who depended on the polynomial classes being derived from PolyBase. They are now all derived from the abstract base class ABCPolyBase. Strictly speaking, there should be a deprecation involved, but no external code making use of the old baseclass could be found. Using numpy.random.binomial may change the RNG state vs. numpy < 1.9 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A bug in one of the algorithms to generate a binomial random variate has been fixed. This change will likely alter the number of random draws performed, and hence the sequence location will be different after a call to distribution.c::rk_binomial_btpe. Any tests which rely on the RNG being in a known state should be checked and/or updated as a result. Random seed enforced to be a 32 bit unsigned integer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.random.seed`` and ``np.random.RandomState`` now throw a ``ValueError`` if the seed cannot safely be converted to 32 bit unsigned integers. Applications that now fail can be fixed by masking the higher 32 bit values to zero: ``seed = seed & 0xFFFFFFFF``. This is what is done silently in older versions so the random stream remains the same. Argmin and argmax out argument ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``out`` argument to ``np.argmin`` and ``np.argmax`` and their equivalent C-API functions is now checked to match the desired output shape exactly. If the check fails a ``ValueError`` instead of ``TypeError`` is raised. Einsum ~~~~~~ Remove unnecessary broadcasting notation restrictions. ``np.einsum('ijk,j->ijk', A, B)`` can also be written as ``np.einsum('ij...,j->ij...', A, B)`` (ellipsis is no longer required on 'j') Indexing ~~~~~~~~ The NumPy indexing has seen a complete rewrite in this version. This makes most advanced integer indexing operations much faster and should have no other implications. However some subtle changes and deprecations were introduced in advanced indexing operations: * Boolean indexing into scalar arrays will always return a new 1-d array. This means that ``array(1)[array(True)]`` gives ``array([1])`` and not the original array. * Advanced indexing into one dimensional arrays used to have (undocumented) special handling regarding repeating the value array in assignments when the shape of the value array was too small or did not match. Code using this will raise an error. For compatibility you can use ``arr.flat[index] = values``, which uses the old code branch. (for example ``a = np.ones(10); a[np.arange(10)] = [1, 2, 3]``) * The iteration order over advanced indexes used to be always C-order. In NumPy 1.9. the iteration order adapts to the inputs and is not guaranteed (with the exception of a *single* advanced index which is never reversed for compatibility reasons). This means that the result is undefined if multiple values are assigned to the same element. An example for this is ``arr[[0, 0], [1, 1]] = [1, 2]``, which may set ``arr[0, 1]`` to either 1 or 2. * Equivalent to the iteration order, the memory layout of the advanced indexing result is adapted for faster indexing and cannot be predicted. * All indexing operations return a view or a copy. No indexing operation will return the original array object. (For example ``arr[...]``) * In the future Boolean array-likes (such as lists of python bools) will always be treated as Boolean indexes and Boolean scalars (including python ``True``) will be a legal *boolean* index. At this time, this is already the case for scalar arrays to allow the general ``positive = a[a > 0]`` to work when ``a`` is zero dimensional. * In NumPy 1.8 it was possible to use ``array(True)`` and ``array(False)`` equivalent to 1 and 0 if the result of the operation was a scalar. This will raise an error in NumPy 1.9 and, as noted above, treated as a boolean index in the future. * All non-integer array-likes are deprecated, object arrays of custom integer like objects may have to be cast explicitly. * The error reporting for advanced indexing is more informative, however the error type has changed in some cases. (Broadcasting errors of indexing arrays are reported as ``IndexError``) * Indexing with more then one ellipsis (``...``) is deprecated. Non-integer reduction axis indexes are deprecated ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Non-integer axis indexes to reduction ufuncs like `add.reduce` or `sum` are deprecated. ``promote_types`` and string dtype ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``promote_types`` function now returns a valid string length when given an integer or float dtype as one argument and a string dtype as another argument. Previously it always returned the input string dtype, even if it wasn't long enough to store the max integer/float value converted to a string. ``can_cast`` and string dtype ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``can_cast`` function now returns False in "safe" casting mode for integer/float dtype and string dtype if the string dtype length is not long enough to store the max integer/float value converted to a string. Previously ``can_cast`` in "safe" mode returned True for integer/float dtype and a string dtype of any length. astype and string dtype ~~~~~~~~~~~~~~~~~~~~~~~ The ``astype`` method now returns an error if the string dtype to cast to is not long enough in "safe" casting mode to hold the max value of integer/float array that is being casted. Previously the casting was allowed even if the result was truncated. `npyio.recfromcsv` keyword arguments change ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `npyio.recfromcsv` no longer accepts the undocumented `update` keyword, which used to override the `dtype` keyword. The ``doc/swig`` directory moved ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``doc/swig`` directory has been moved to ``tools/swig``. The ``npy_3kcompat.h`` header changed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The unused ``simple_capsule_dtor`` function has been removed from ``npy_3kcompat.h``. Note that this header is not meant to be used outside of numpy; other projects should be using their own copy of this file when needed. Negative indices in C-Api ``sq_item`` and ``sq_ass_item`` sequence methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When directly accessing the ``sq_item`` or ``sq_ass_item`` PyObject slots for item getting, negative indices will not be supported anymore. ``PySequence_GetItem`` and ``PySequence_SetItem`` however fix negative indices so that they can be used there. NDIter ~~~~~~ When ``NpyIter_RemoveAxis`` is now called, the iterator range will be reset. When a multi index is being tracked and an iterator is not buffered, it is possible to use ``NpyIter_RemoveAxis``. In this case an iterator can shrink in size. Because the total size of an iterator is limited, the iterator may be too large before these calls. In this case its size will be set to ``-1`` and an error issued not at construction time but when removing the multi index, setting the iterator range, or getting the next function. This has no effect on currently working code, but highlights the necessity of checking for an error return if these conditions can occur. In most cases the arrays being iterated are as large as the iterator so that such a problem cannot occur. This change was already applied to the 1.8.1 release. ``zeros_like`` for string dtypes now returns empty strings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To match the `zeros` function `zeros_like` now returns an array initialized with empty strings instead of an array filled with `'0'`. New Features ============ Percentile supports more interpolation options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.percentile`` now has the interpolation keyword argument to specify in which way points should be interpolated if the percentiles fall between two values. See the documentation for the available options. Generalized axis support for median and percentile ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.median`` and ``np.percentile`` now support generalized axis arguments like ufunc reductions do since 1.7. One can now say axis=(index, index) to pick a list of axes for the reduction. The ``keepdims`` keyword argument was also added to allow convenient broadcasting to arrays of the original shape. Dtype parameter added to ``np.linspace`` and ``np.logspace`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The returned data type from the ``linspace`` and ``logspace`` functions can now be specified using the dtype parameter. More general ``np.triu`` and ``np.tril`` broadcasting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For arrays with ``ndim`` exceeding 2, these functions will now apply to the final two axes instead of raising an exception. ``tobytes`` alias for ``tostring`` method ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``ndarray.tobytes`` and ``MaskedArray.tobytes`` have been added as aliases for ``tostring`` which exports arrays as ``bytes``. This is more consistent in Python 3 where ``str`` and ``bytes`` are not the same. Build system ~~~~~~~~~~~~ Added experimental support for the ppc64le and OpenRISC architecture. Compatibility to python ``numbers`` module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All numerical numpy types are now registered with the type hierarchy in the python ``numbers`` module. ``increasing`` parameter added to ``np.vander`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ordering of the columns of the Vandermonde matrix can be specified with this new boolean argument. ``unique_counts`` parameter added to ``np.unique`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The number of times each unique item comes up in the input can now be obtained as an optional return value. Support for median and percentile in nanfunctions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``np.nanmedian`` and ``np.nanpercentile`` functions behave like the median and percentile functions except that NaNs are ignored. NumpyVersion class added ~~~~~~~~~~~~~~~~~~~~~~~~ The class may be imported from numpy.lib and can be used for version comparison when the numpy version goes to 1.10.devel. For example:: >>> from numpy.lib import NumpyVersion >>> if NumpyVersion(np.__version__) < '1.10.0'): ... print('Wow, that is an old NumPy version!') Allow saving arrays with large number of named columns ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The numpy storage format 1.0 only allowed the array header to have a total size of 65535 bytes. This can be exceeded by structured arrays with a large number of columns. A new format 2.0 has been added which extends the header size to 4 GiB. `np.save` will automatically save in 2.0 format if the data requires it, else it will always use the more compatible 1.0 format. Full broadcasting support for ``np.cross`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.cross`` now properly broadcasts its two input arrays, even if they have different number of dimensions. In earlier versions this would result in either an error being raised, or wrong results computed. Improvements ============ Better numerical stability for sum in some cases ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pairwise summation is now used in the sum method, but only along the fast axis and for groups of the values <= 8192 in length. This should also improve the accuracy of var and std in some common cases. Percentile implemented in terms of ``np.partition`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``np.percentile`` has been implemented in terms of ``np.partition`` which only partially sorts the data via a selection algorithm. This improves the time complexity from ``O(nlog(n))`` to ``O(n)``. Performance improvement for ``np.array`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The performance of converting lists containing arrays to arrays using ``np.array`` has been improved. It is now equivalent in speed to ``np.vstack(list)``. Performance improvement for ``np.searchsorted`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For the built-in numeric types, ``np.searchsorted`` no longer relies on the data type's ``compare`` function to perform the search, but is now implemented by type specific functions. Depending on the size of the inputs, this can result in performance improvements over 2x. Optional reduced verbosity for np.distutils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set ``numpy.distutils.system_info.system_info.verbosity = 0`` and then calls to ``numpy.distutils.system_info.get_info('blas_opt')`` will not print anything on the output. This is mostly for other packages using numpy.distutils. Covariance check in ``np.random.multivariate_normal`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A ``RuntimeWarning`` warning is raised when the covariance matrix is not positive-semidefinite. Polynomial Classes no longer template based ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The polynomial classes have been refactored to use an abstract base class rather than a template in order to implement a common interface. This makes importing the polynomial package faster as the classes do not need to be compiled on import. More GIL releases ~~~~~~~~~~~~~~~~~ Several more functions now release the Global Interpreter Lock allowing more efficient parallization using the ``threading`` module. Most notably the GIL is now released for fancy indexing, ``np.where`` and the ``random`` module now uses a per-state lock instead of the GIL. MaskedArray support for more complicated base classes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Built-in assumptions that the baseclass behaved like a plain array are being removed. In particalur, ``repr`` and ``str`` should now work more reliably. C-API ~~~~~ Deprecations ============ Non-integer scalars for sequence repetition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Using non-integer numpy scalars to repeat python sequences is deprecated. For example ``np.float_(2) * [1]`` will be an error in the future. ``select`` input deprecations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The integer and empty input to ``select`` is deprecated. In the future only boolean arrays will be valid conditions and an empty ``condlist`` will be considered an input error instead of returning the default. ``rank`` function ~~~~~~~~~~~~~~~~~ The ``rank`` function has been deprecated to avoid confusion with ``numpy.linalg.matrix_rank``. Object array equality comparisons ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In the future object array comparisons both `==` and `np.equal` will not make use of identity checks anymore. For example: >>> a = np.array([np.array([1, 2, 3]), 1]) >>> b = np.array([np.array([1, 2, 3]), 1]) >>> a == b will consistently return False (and in the future an error) even if the array in `a` and `b` was the same object. The equality operator `==` will in the future raise errors like `np.equal` if broadcasting or element comparisons, etc. fails. Comparison with `arr == None` will in the future do an elementwise comparison instead of just returning False. Code should be using `arr is None`. All of these changes will give Deprecation- or FutureWarnings at this time. C-API ~~~~~ The utility function npy_PyFile_Dup and npy_PyFile_DupClose are broken by the internal buffering python 3 applies to its file objects. To fix this two new functions npy_PyFile_Dup2 and npy_PyFile_DupClose2 are declared in npy_3kcompat.h and the old functions are deprecated. Due to the fragile nature of these functions it is recommended to instead use the python API when possible. This change was already applied to the 1.8.1 release. NumPy 1.8.2 Release Notes ************************* This is a bugfix only release in the 1.8.x series. Issues fixed ============ * gh-4836: partition produces wrong results for multiple selections in equal ranges * gh-4656: Make fftpack._raw_fft threadsafe * gh-4628: incorrect argument order to _copyto in in np.nanmax, np.nanmin * gh-4642: Hold GIL for converting dtypes types with fields * gh-4733: fix np.linalg.svd(b, compute_uv=False) * gh-4853: avoid unaligned simd load on reductions on i386 * gh-4722: Fix seg fault converting empty string to object * gh-4613: Fix lack of NULL check in array_richcompare * gh-4774: avoid unaligned access for strided byteswap * gh-650: Prevent division by zero when creating arrays from some buffers * gh-4602: ifort has issues with optimization flag O2, use O1 NumPy 1.8.1 Release Notes ************************* This is a bugfix only release in the 1.8.x series. Issues fixed ============ * gh-4276: Fix mean, var, std methods for object arrays * gh-4262: remove insecure mktemp usage * gh-2385: absolute(complex(inf)) raises invalid warning in python3 * gh-4024: Sequence assignment doesn't raise exception on shape mismatch * gh-4027: Fix chunked reading of strings longer than BUFFERSIZE * gh-4109: Fix object scalar return type of 0-d array indices * gh-4018: fix missing check for memory allocation failure in ufuncs * gh-4156: high order linalg.norm discards imaginary elements of complex arrays * gh-4144: linalg: norm fails on longdouble, signed int * gh-4094: fix NaT handling in _strided_to_strided_string_to_datetime * gh-4051: fix uninitialized use in _strided_to_strided_string_to_datetime * gh-4093: Loading compressed .npz file fails under Python 2.6.6 * gh-4138: segfault with non-native endian memoryview in python 3.4 * gh-4123: Fix missing NULL check in lexsort * gh-4170: fix native-only long long check in memoryviews * gh-4187: Fix large file support on 32 bit * gh-4152: fromfile: ensure file handle positions are in sync in python3 * gh-4176: clang compatibility: Typos in conversion_utils * gh-4223: Fetching a non-integer item caused array return * gh-4197: fix minor memory leak in memoryview failure case * gh-4206: fix build with single-threaded python * gh-4220: add versionadded:: 1.8.0 to ufunc.at docstring * gh-4267: improve handling of memory allocation failure * gh-4267: fix use of capi without gil in ufunc.at * gh-4261: Detect vendor versions of GNU Compilers * gh-4253: IRR was returning nan instead of valid negative answer * gh-4254: fix unnecessary byte order flag change for byte arrays * gh-3263: numpy.random.shuffle clobbers mask of a MaskedArray * gh-4270: np.random.shuffle not work with flexible dtypes * gh-3173: Segmentation fault when 'size' argument to random.multinomial * gh-2799: allow using unique with lists of complex * gh-3504: fix linspace truncation for integer array scalar * gh-4191: get_info('openblas') does not read libraries key * gh-3348: Access violation in _descriptor_from_pep3118_format * gh-3175: segmentation fault with numpy.array() from bytearray * gh-4266: histogramdd - wrong result for entries very close to last boundary * gh-4408: Fix stride_stricks.as_strided function for object arrays * gh-4225: fix log1p and exmp1 return for np.inf on windows compiler builds * gh-4359: Fix infinite recursion in str.format of flex arrays * gh-4145: Incorrect shape of broadcast result with the exponent operator * gh-4483: Fix commutativity of {dot,multiply,inner}(scalar, matrix_of_objs) * gh-4466: Delay npyiter size check when size may change * gh-4485: Buffered stride was erroneously marked fixed * gh-4354: byte_bounds fails with datetime dtypes * gh-4486: segfault/error converting from/to high-precision datetime64 objects * gh-4428: einsum(None, None, None, None) causes segfault * gh-4134: uninitialized use for for size 1 object reductions Changes ======= NDIter ~~~~~~ When ``NpyIter_RemoveAxis`` is now called, the iterator range will be reset. When a multi index is being tracked and an iterator is not buffered, it is possible to use ``NpyIter_RemoveAxis``. In this case an iterator can shrink in size. Because the total size of an iterator is limited, the iterator may be too large before these calls. In this case its size will be set to ``-1`` and an error issued not at construction time but when removing the multi index, setting the iterator range, or getting the next function. This has no effect on currently working code, but highlights the necessity of checking for an error return if these conditions can occur. In most cases the arrays being iterated are as large as the iterator so that such a problem cannot occur. Optional reduced verbosity for np.distutils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set ``numpy.distutils.system_info.system_info.verbosity = 0`` and then calls to ``numpy.distutils.system_info.get_info('blas_opt')`` will not print anything on the output. This is mostly for other packages using numpy.distutils. Deprecations ============ C-API ~~~~~ The utility function npy_PyFile_Dup and npy_PyFile_DupClose are broken by the internal buffering python 3 applies to its file objects. To fix this two new functions npy_PyFile_Dup2 and npy_PyFile_DupClose2 are declared in npy_3kcompat.h and the old functions are deprecated. Due to the fragile nature of these functions it is recommended to instead use the python API when possible.
The docstring of np.random.pareto (Version 1.8.0) contains multiple errors. In a nutshell np.random.pareto does not draw samples from the Pareto distribution shown under 'Notes' in the docstring. Instead it draws samples from a Lomax distribution (also stated in the docstring). However, the description in the docstring of how to convert those Lomax random variates to a Pareto distribution is wrong. Further, the examples are faulty.
More detailed:
The function np.random.pareto draws random variates from a Lomax distribution with shape a and location m'=1. To convert
those samples to a classical Pareto distribution with shape a and
location m you have to add 1 and multiply by m, instead of adding m as
stated in the docstring.
More specifically, the docstring says:
"The Lomax or Pareto II distribution is a shifted Pareto distribution. The
classical Pareto distribution can be obtained from the Lomax distribution
by adding the location parameter m, see below."
Instead, it should read "[..] by adding 1 and multiplying my m, see below."
The example at the bottom therefore should read:
Maybe an example with m=10 makes it clearer
Additionally, calling m the location parameter could be misleading.
For simple Pareto (Type I) distributions it is usually referred to as
the x_min or the scale parameter of the distribution. When discussing
generalized Pareto distributions m is also called the scale
parameter (a constant factor) while mu is the location (an additive
term) [1]. I assume the misleading naming could have caused some
confusion and lead to the errors described above.
Last but not least I think it might also cause confusion to call
a function 'random.pareto' while its meaning is 'shifted by -1 pareto'. :)
[1] http://en.wikipedia.org/wiki/Generalized_Pareto_distribution
The text was updated successfully, but these errors were encountered: