SciPy 0.13.0 Release Notes#
SciPy 0.13.0 is the culmination of 7 months of hard work. It contains many new features, numerous bug-fixes, improved test coverage and better documentation. There have been a number of deprecations and API changes in this release, which are documented below. All users are encouraged to upgrade to this release, as there are a large number of bug-fixes and optimizations. Moreover, our development attention will now shift to bug-fix releases on the 0.13.x branch, and on adding new features on the master branch.
This release requires Python 2.6, 2.7 or 3.1-3.3 and NumPy 1.5.1 or greater. Highlights of this release are:
support for fancy indexing and boolean comparisons with sparse matrices
interpolative decompositions and matrix functions in the linalg module
two new trust-region solvers for unconstrained minimization
N-dimensional numerical integration#
A new function
scipy.integrate.nquad, which provides N-dimensional
integration functionality with a more flexible interface than
tplquad, has been added.
The intermediate results from the
dopri family of ODE solvers can now be
accessed by a solout callback function.
Scipy now includes a new module
containing routines for computing interpolative matrix decompositions
(ID). This feature is based on the ID software package by
P.G. Martinsson, V. Rokhlin, Y. Shkolnisky, and M. Tygert, previously
adapted for Python in the PymatrixId package by K.L. Ho.
A new function
scipy.linalg.polar, to compute the polar decomposition
of a matrix, was added.
BLAS level 3 functions#
The BLAS functions
her2k are now wrapped in
Several matrix function algorithms have been implemented or updated following
detailed descriptions in recent papers of Nick Higham and his co-authors.
These include the matrix square root (
sqrtm), the matrix logarithm
logm), the matrix exponential (
expm) and its Frechet derivative
expm_frechet), and fractional matrix powers (
Trust-region unconstrained minimization algorithms#
minimize function gained two trust-region solvers for unconstrained
Boolean comparisons and sparse matrices#
All sparse matrix types now support boolean data, and boolean operations. Two sparse matrices A and B can be compared in all the expected ways A < B, A >= B, A != B, producing similar results as dense Numpy arrays. Comparisons with dense matrices and scalars are also supported.
CSR and CSC fancy indexing#
Compressed sparse row and column sparse matrix types now support fancy indexing with boolean matrices, slices, and lists. So where A is a (CSC or CSR) sparse matrix, you can do things like:
>>> A[A > 0.5] = 1 # since Boolean sparse matrices work >>> A[:2, :3] = 2 >>> A[[1,2], 2] = 3
The new function
onenormest provides a lower bound of the 1-norm of a
linear operator and has been implemented according to Higham and Tisseur
(2000). This function is not only useful for sparse matrices, but can also be
used to estimate the norm of products or powers of dense matrices without
explicitly building the intermediate matrix.
The multiplicative action of the matrix exponential of a linear operator
expm_multiply) has been implemented following the description in Al-Mohy
and Higham (2011).
Abstract linear operators (
scipy.sparse.linalg.LinearOperator) can now be
multiplied, added to each other, and exponentiated, producing new linear
operators. This enables easier construction of composite linear operations.
The vertices of a ConvexHull can now be accessed via the vertices attribute, which gives proper orientation in 2-D.
The cosine window function
scipy.signal.cosine was added.
scipy.special.xlog1py were added.
These functions can simplify and speed up code that has to calculate
x * log(y) and give 0 when
x == 0.
Unformatted Fortran file reader#
The new class
scipy.io.FortranFile facilitates reading unformatted
sequential files written by Fortran code.
scipy.io.wavfile.write now accepts a file buffer. Previously it only
accepted a filename.
scipy.io.wavfile.write can now handle floating
point WAV files.
B-spline derivatives and antiderivatives#
for computing B-splines that represent derivatives and antiderivatives
of B-splines were added. These functions are also available in the
class-based FITPACK interface as
Distributions now allow using keyword parameters in addition to positional parameters in all methods.
scipy.stats.power_divergence has been added for the
Cressie-Read power divergence statistic and goodness of fit test.
Included in this family of statistics is the “G-test”
scipy.stats.mood now accepts multidimensional input.
An option was added to
scipy.stats.wilcoxon for continuity correction.
scipy.stats.chisquare now has an axis argument.
scipy.stats.mstats.chisquare now has axis and ddof arguments.
The matrix exponential functions scipy.linalg.expm2 and scipy.linalg.expm3
are deprecated. All users should use the numerically more robust
scipy.linalg.expm function instead.
scipy.stats.oneway is deprecated;
scipy.stats.f_oneway should be used
scipy.stats.glm is deprecated.
scipy.stats.ttest_ind is an equivalent
function; more full-featured general (and generalized) linear model
implementations can be found in statsmodels.
scipy.stats.cmedian is deprecated;
numpy.median should be used instead.
Backwards incompatible changes#
LIL matrix assignment#
Assigning values to LIL matrices with two index arrays now works similarly as assigning into ndarrays:
>>> x = lil_matrix((3, 3)) >>> x[[0,1,2],[0,1,2]]=[0,1,2] >>> x.todense() matrix([[ 0., 0., 0.], [ 0., 1., 0.], [ 0., 0., 2.]])
rather than giving the result:
>>> x.todense() matrix([[ 0., 1., 2.], [ 0., 1., 2.], [ 0., 1., 2.]])
Users relying on the previous behavior will need to revisit their code.
The previous behavior is obtained by
x[numpy.ix_([0,1,2],[0,1,2])] = ....
radon function removed#
misc.radon function, which was deprecated in scipy 0.11.0, has been
removed. Users can find a more full-featured
radon function in
Removed deprecated keywords
xb, which were deprecated since 0.11.0, have
been removed from the distributions in
Changes to MATLAB file readers / writers#
The major change is that 1D arrays in numpy now become row vectors (shape 1, N)
when saved to a MATLAB 5 format file. Previously 1D arrays saved as column
vectors (N, 1). This is to harmonize the behavior of writing MATLAB 4 and 5
formats, and adapt to the defaults of numpy and MATLAB - for example
np.atleast_2d returns 1D arrays as row vectors.
Trying to save arrays of greater than 2 dimensions in MATLAB 4 format now raises an error instead of silently reshaping the array as 2D.
scipy.io.loadmat('afile') used to look for afile on the Python system path
loadmat only looks in the current directory for a
relative path filename.
scipy.weave previously used temporary directories in an
insecure manner under certain circumstances.
Cython is now required to build unreleased versions of scipy. The C files generated from Cython sources are not included in the git repo anymore. They are however still shipped in source releases.
The code base received a fairly large PEP8 cleanup. A
command has been added; new code should pass this test command.
Scipy cannot be compiled with gfortran 4.1 anymore (at least on RH5), likely due to that compiler version not supporting entry constructs well.