|
Packit |
7a8e5e |
=========================
|
|
Packit |
7a8e5e |
NumPy 1.5.0 Release Notes
|
|
Packit |
7a8e5e |
=========================
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Highlights
|
|
Packit |
7a8e5e |
==========
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Python 3 compatibility
|
|
Packit |
7a8e5e |
----------------------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
This is the first NumPy release which is compatible with Python 3. Support for
|
|
Packit |
7a8e5e |
Python 3 and Python 2 is done from a single code base. Extensive notes on
|
|
Packit |
7a8e5e |
changes can be found at
|
|
Packit |
7a8e5e |
`<http://projects.scipy.org/numpy/browser/trunk/doc/Py3K.txt>`_.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Note that the Numpy testing framework relies on nose, which does not have a
|
|
Packit |
7a8e5e |
Python 3 compatible release yet. A working Python 3 branch of nose can be found
|
|
Packit |
7a8e5e |
at `<http://bitbucket.org/jpellerin/nose3/>`_ however.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Porting of SciPy to Python 3 is expected to be completed soon.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
:pep:`3118` compatibility
|
|
Packit |
7a8e5e |
-------------------------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
The new buffer protocol described by PEP 3118 is fully supported in this
|
|
Packit |
7a8e5e |
version of Numpy. On Python versions >= 2.6 Numpy arrays expose the buffer
|
|
Packit |
7a8e5e |
interface, and array(), asarray() and other functions accept new-style buffers
|
|
Packit |
7a8e5e |
as input.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
New features
|
|
Packit |
7a8e5e |
============
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Warning on casting complex to real
|
|
Packit |
7a8e5e |
----------------------------------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Numpy now emits a `numpy.ComplexWarning` when a complex number is cast
|
|
Packit |
7a8e5e |
into a real number. For example:
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
>>> x = np.array([1,2,3])
|
|
Packit |
7a8e5e |
>>> x[:2] = np.array([1+2j, 1-2j])
|
|
Packit |
7a8e5e |
ComplexWarning: Casting complex values to real discards the imaginary part
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
The cast indeed discards the imaginary part, and this may not be the
|
|
Packit |
7a8e5e |
intended behavior in all cases, hence the warning. This warning can be
|
|
Packit |
7a8e5e |
turned off in the standard way:
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
>>> import warnings
|
|
Packit |
7a8e5e |
>>> warnings.simplefilter("ignore", np.ComplexWarning)
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Dot method for ndarrays
|
|
Packit |
7a8e5e |
-----------------------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Ndarrays now have the dot product also as a method, which allows writing
|
|
Packit |
7a8e5e |
chains of matrix products as
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
>>> a.dot(b).dot(c)
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
instead of the longer alternative
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
>>> np.dot(a, np.dot(b, c))
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
linalg.slogdet function
|
|
Packit |
7a8e5e |
-----------------------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
The slogdet function returns the sign and logarithm of the determinant
|
|
Packit |
7a8e5e |
of a matrix. Because the determinant may involve the product of many
|
|
Packit |
7a8e5e |
small/large values, the result is often more accurate than that obtained
|
|
Packit |
7a8e5e |
by simple multiplication.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
new header
|
|
Packit |
7a8e5e |
----------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
The new header file ndarraytypes.h contains the symbols from
|
|
Packit |
7a8e5e |
ndarrayobject.h that do not depend on the PY_ARRAY_UNIQUE_SYMBOL and
|
|
Packit |
7a8e5e |
NO_IMPORT/_ARRAY macros. Broadly, these symbols are types, typedefs,
|
|
Packit |
7a8e5e |
and enumerations; the array function calls are left in
|
|
Packit |
7a8e5e |
ndarrayobject.h. This allows users to include array-related types and
|
|
Packit |
7a8e5e |
enumerations without needing to concern themselves with the macro
|
|
Packit |
7a8e5e |
expansions and their side- effects.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
Changes
|
|
Packit |
7a8e5e |
=======
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
polynomial.polynomial
|
|
Packit |
7a8e5e |
---------------------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
* The polyint and polyder functions now check that the specified number
|
|
Packit |
7a8e5e |
integrations or derivations is a non-negative integer. The number 0 is
|
|
Packit |
7a8e5e |
a valid value for both functions.
|
|
Packit |
7a8e5e |
* A degree method has been added to the Polynomial class.
|
|
Packit |
7a8e5e |
* A trimdeg method has been added to the Polynomial class. It operates like
|
|
Packit |
7a8e5e |
truncate except that the argument is the desired degree of the result,
|
|
Packit |
7a8e5e |
not the number of coefficients.
|
|
Packit |
7a8e5e |
* Polynomial.fit now uses None as the default domain for the fit. The default
|
|
Packit |
7a8e5e |
Polynomial domain can be specified by using [] as the domain value.
|
|
Packit |
7a8e5e |
* Weights can be used in both polyfit and Polynomial.fit
|
|
Packit |
7a8e5e |
* A linspace method has been added to the Polynomial class to ease plotting.
|
|
Packit |
7a8e5e |
* The polymulx function was added.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
polynomial.chebyshev
|
|
Packit |
7a8e5e |
--------------------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
* The chebint and chebder functions now check that the specified number
|
|
Packit |
7a8e5e |
integrations or derivations is a non-negative integer. The number 0 is
|
|
Packit |
7a8e5e |
a valid value for both functions.
|
|
Packit |
7a8e5e |
* A degree method has been added to the Chebyshev class.
|
|
Packit |
7a8e5e |
* A trimdeg method has been added to the Chebyshev class. It operates like
|
|
Packit |
7a8e5e |
truncate except that the argument is the desired degree of the result,
|
|
Packit |
7a8e5e |
not the number of coefficients.
|
|
Packit |
7a8e5e |
* Chebyshev.fit now uses None as the default domain for the fit. The default
|
|
Packit |
7a8e5e |
Chebyshev domain can be specified by using [] as the domain value.
|
|
Packit |
7a8e5e |
* Weights can be used in both chebfit and Chebyshev.fit
|
|
Packit |
7a8e5e |
* A linspace method has been added to the Chebyshev class to ease plotting.
|
|
Packit |
7a8e5e |
* The chebmulx function was added.
|
|
Packit |
7a8e5e |
* Added functions for the Chebyshev points of the first and second kind.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
histogram
|
|
Packit |
7a8e5e |
---------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
After a two years transition period, the old behavior of the histogram function
|
|
Packit |
7a8e5e |
has been phased out, and the "new" keyword has been removed.
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
correlate
|
|
Packit |
7a8e5e |
---------
|
|
Packit |
7a8e5e |
|
|
Packit |
7a8e5e |
The old behavior of correlate was deprecated in 1.4.0, the new behavior (the
|
|
Packit |
7a8e5e |
usual definition for cross-correlation) is now the default.
|