Skip to content
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

MAINT: backports/prep for 1.13.1 #20632

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
42de094
align dok.pop() to dict.pop() case with no default (#20322)
dschult Apr 15, 2024
ba975c4
BUG: sync pocketfft again
tylerjereddy Mar 25, 2024
e5666b6
DOC: optimize: fix wrong optional argument name in `root(method="lm")…
AtsushiSakai Apr 7, 2024
eb8e3a9
DOC: add missing deprecations from 1.13.0 release notes
j-bowhay Apr 10, 2024
1541f68
MAINT/DOC: fix syntax in 1.13.0 release notes (#20437)
lucascolley Apr 10, 2024
85c9e29
DOC: remove spurious backtic from release notes
j-bowhay Apr 11, 2024
3687a97
BUG: linalg: fix ordering of complex conj gen eigenvalues
ev-br Apr 14, 2024
3c3ac73
TST: interpolate: bump test tolerance in TestRGI::test_derivatives
ev-br Apr 14, 2024
5006ef1
TST: interpolate: bump test tolerance in TestInterpN
ev-br Apr 14, 2024
15cf993
TST: interpolate: bump test tolerance in test_rbfinterp::test_pickleable
ev-br Apr 14, 2024
3ec0606
TST: sparse/linalg: bump tolerance for an svds test
ev-br Apr 17, 2024
768f46b
TST: compare absolute values of U and VT in pydata-sparse SVD test
thalassemia Apr 15, 2024
178a125
BUG: linalg: fix eigh(1x1 array, driver='evd') f2py check (#20516)
ev-br Apr 18, 2024
a2373cb
BUG: fix spherical_in for n=1 and z=0 (#20527)
PicoCentauri Apr 19, 2024
c7b7322
BLD: Fix error message for f2py generation fail (#20530)
bnavigator Apr 19, 2024
57e3699
update openblas to 0.3.27
mattip Apr 24, 2024
4b6d2e1
BUG: Fix error with 180 degree rotation in Rotation.align_vectors() w…
scottshambaugh Apr 28, 2024
a9afa6f
BUG: special: handle uint arrays in factorial{,2,k} (#20607)
h-vetinari Apr 30, 2024
adaa430
BUG: spherical_in old patch
tylerjereddy May 2, 2024
de2a454
DOC: update 1.13.1 relnotes
tylerjereddy May 2, 2024
f2d4873
BUG: prevent QHull message stream being closed twice (#20611)
andfoy May 3, 2024
b481e5d
BUG: fix Vor/Delaunay segfaults
tylerjereddy May 2, 2024
74e9a4a
fix origin handling for minimum_filter and maximum_filter with axes s…
grlee77 May 5, 2024
a536ab1
MAINT: stats.yulesimon: fix kurtosis
mdhaber May 6, 2024
ee6203d
MAINT: stats: update boost to improve `skewnorm.ppf` (#20643)
dschmitz89 May 6, 2024
d08c8d8
BUG: sparse: Clean up 1D input handling to sparse array/matrix and ad…
dschult May 9, 2024
198a73b
BUG: sparse: Fix summing duplicates for CSR/CSC creation from (data,c…
dschult May 15, 2024
4fa2e23
MAINT: added doc/source/.jupyterlite.doit.db to .gitignore See #20264
Mar 18, 2024
67d4252
MAINT: lint: temporarily disable UP031
lucascolley Apr 28, 2024
5582720
DEV: lint: disable UP031
rgommers May 2, 2024
5c770e8
BUG: value_indices unfixed types
tylerjereddy May 5, 2024
7db39e8
MAINT: release branch failures
tylerjereddy May 15, 2024
cec68d7
MAINT: import fixes
tylerjereddy May 15, 2024
f1575a8
Revert "MAINT: stats: update boost to improve `skewnorm.ppf` (#20643)"
tylerjereddy May 15, 2024
870e5b4
MAINT: import fixes
tylerjereddy May 15, 2024
ce91a92
TST: Adapt to `__array__(copy=True)`
thalassemia Apr 19, 2024
8b9a6d6
CI, MAINT: pin Python for MacOS conda
tylerjereddy May 16, 2024
023b0fb
CI: MR 20632 revisions
tylerjereddy May 18, 2024
aa32933
CI: PR 20632 revisions [wheel build]
tylerjereddy May 19, 2024
e7abaf1
MAINT: PR 20632 revisions [wheel build]
tylerjereddy May 21, 2024
95c50a4
MAINT: PR 20632 revisions [wheel build]
tylerjereddy May 21, 2024
c9d8613
CI, MAINT: PR 20632 revisions
tylerjereddy May 22, 2024
506cbeb
MAINT: stats.wilcoxon: fix bug with Ndim>1, shape[axis]>50, NaN, 'aut…
mdhaber May 16, 2024
11e99ba
BUG: stats: Fix `zipf.pmf` and `zipfian.pmf` for int32 `k` (#20702) […
dschmitz89 May 20, 2024
1a00d48
DOC: PR 20632 updates
tylerjereddy May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux_meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ jobs:

- name: Setup Python build deps
run: |
pip install build meson-python ninja pythran pybind11 cython "numpy>=2.0.0b1"
pip install build meson-python ninja "pythran<0.16.0" pybind11 cython "numpy>=2.0.0b1"

- name: Build wheel and install
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/macos_meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
shell: bash -l {0}
run: |
conda activate scipy-dev
mamba install python=${{ matrix.python-version}}

# optional test dependencies
mamba install scikit-umfpack scikit-sparse
Expand Down Expand Up @@ -166,13 +167,14 @@ jobs:

git submodule update --init
# for some reason gfortran is not on the path
GFORTRAN_LOC=$(brew --prefix gfortran)/bin/gfortran
GFORTRAN_LOC=$(which gfortran-13)
ln -s $GFORTRAN_LOC gfortran
export PATH=$PWD:$PATH

# make sure we have openblas
bash tools/wheels/cibw_before_build_macos.sh $PWD
export DYLD_LIBRARY_PATH=/usr/local/gfortran/lib:/opt/arm64-builds/lib
GFORTRAN_LIB=$(dirname `gfortran --print-file-name libgfortran.dylib`)
export DYLD_LIBRARY_PATH=$GFORTRAN_LIB
export PKG_CONFIG_PATH=/opt/arm64-builds/lib/pkgconfig

pip install click doit pydevtool rich_click meson cython pythran pybind11 ninja numpy
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,16 @@ jobs:
run: |
if [[ ${{ matrix.buildplat[2] }} == 'arm64' ]]; then
# macosx_arm64

# use homebrew gfortran
LIB_PATH=$LIB_PATH:/opt/arm64-builds/lib
sudo xcode-select -s /Applications/Xcode_15.2.app
# for some reason gfortran is not on the path
GFORTRAN_LOC=$(brew --prefix gfortran)/bin/gfortran
ln -s $GFORTRAN_LOC gfortran
export PATH=$PWD:$PATH
echo "PATH=$PATH" >> "$GITHUB_ENV"

# location of the gfortran's libraries
GFORTRAN_LIB=$(dirname `gfortran --print-file-name libgfortran.dylib`)
GFORTRAN_LIB="\$(dirname \$(gfortran --print-file-name libgfortran.dylib))"

CIBW="MACOSX_DEPLOYMENT_TARGET=12.0\
MACOS_DEPLOYMENT_TARGET=12.0\
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH\
LD_LIBRARY_PATH=$LIB_PATH:$LD_LIBRARY_PATH\
SDKROOT=$(xcrun --sdk macosx --show-sdk-path)\
_PYTHON_HOST_PLATFORM=macosx-12.0-arm64\
PKG_CONFIG_PATH=/opt/arm64-builds/lib/pkgconfig"
echo "CIBW_ENVIRONMENT_MACOS=$CIBW" >> "$GITHUB_ENV"
Expand All @@ -152,8 +147,8 @@ jobs:

echo "REPAIR_PATH=/opt/arm64-builds/lib" >> "$GITHUB_ENV"

CIBW="DYLD_LIBRARY_PATH=$GFORTRAN_LIB:/opt/arm64-builds/lib delocate-listdeps {wheel} &&\
DYLD_LIBRARY_PATH=$GFORTRAN_LIB:/opt/arm64-builds/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"
CIBW="DYLD_LIBRARY_PATH=$GFORTRAN_LIB:$LIB_PATH delocate-listdeps {wheel} &&\
DYLD_LIBRARY_PATH=$GFORTRAN_LIB:$LIB_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgommers @h-vetinari This PR is taking shape I think--the full CI matrix (including wheels) is finally passing. The changes inline above are probably the most annoying/controversial ones I had to make manually (they are probably a superset of what is really needed to get Mac ARM wheels passing).

Any remaining objections/concerns for 1.13.1 release? We're at parity with the current list of merged backport-labeled PRs (30 in total now). I have two checklist items left above, but they are basically just updating the relnotes and reading the diff carefully before proceeding.

@mdhaber @dschult @perimosocordiae any more backports that are important for stats or sparse for 1.13.1?

I think if folks are happy I'd try to get 1.13.1 out before branching 1.14.0, with a modest delay likely for the latter, but hopefully not too substantial (I'm blocking off time for release notes work tomorrow).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any remaining objections/concerns for 1.13.1 release? We're at parity with the current list of merged backport-labeled PRs (30 in total now).

None that I can think of. This is already quite large, so +1 for shipping it soon.

The changes for macOS gfortran should be okay - whatever works there I think is fine in a maintenance branch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get to see this earlier, but I think this has all the backports I had in mind.

echo "CIBW_REPAIR_WHEEL_COMMAND_MACOS=$CIBW" >> "$GITHUB_ENV"

else
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ build-install/
.doit.db.dir
.doit.db.db
.doit.db
doc/source/.jupyterlite.doit.db

# Logs and databases #
######################
Expand Down
1 change: 1 addition & 0 deletions ci/cirrus_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cirrus_wheels_linux_aarch64_task:
platform: linux
cpu: 2
memory: 4G
timeout_in: 72m
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried restarting twice; this is probably cheaper than needing to hit restart several times during the rel process.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 that makes sense to me, it was always close to the limit.

matrix:
# build in a matrix because building and testing all four wheels in a
# single task takes longer than 60 mins (the default time limit for a
Expand Down
28 changes: 27 additions & 1 deletion doc/source/release/1.13.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,39 @@ Deprecated features
- Complex dtypes in ``PchipInterpolator`` and ``Akima1DInterpolator`` have
been deprecated and will raise an error in SciPy 1.15.0. If you are trying
to use the real components of the passed array, use ``np.real`` on ``y``.

- Non-integer values of ``n`` together with ``exact=True`` are deprecated for
`scipy.special.factorial`.


*********************
Expired Deprecations
*********************
There is an ongoing effort to follow through on long-standing deprecations.
The following previously deprecated features are affected:

- ``scipy.signal.{lsim2,impulse2,step2}`` have been removed in favour of
``scipy.signal.{lsim,impulse,step}``.
- Window functions can no longer be imported from the `scipy.signal` namespace and
instead should be accessed through either `scipy.signal.windows` or
`scipy.signal.get_window`.
- `scipy.sparse` no longer supports multi-Ellipsis indexing
- ``scipy.signal.{bspline,quadratic,cubic}`` have been removed in favour of alternatives
in `scipy.interpolate`.
- ``scipy.linalg.tri{,u,l}`` have been removed in favour of ``numpy.tri{,u,l}``.
- Non-integer arrays in `scipy.special.factorial` with ``exact=True`` now raise an
error.
- Functions from NumPy's main namespace which were exposed in SciPy's main
namespace, such as ``numpy.histogram`` exposed by ``scipy.histogram``, have
been removed from SciPy's main namespace. Please use the functions directly
from ``numpy``. This was originally performed for SciPy 1.12.0 however was missed from
the release notes so is included here for completeness.


******************************
Backwards incompatible changes
******************************


*************
Other changes
*************
Expand Down
81 changes: 80 additions & 1 deletion doc/source/release/1.13.1-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,98 @@ SciPy 1.13.1 Release Notes
.. contents::

SciPy 1.13.1 is a bug-fix release with no new features
compared to 1.13.0.
compared to 1.13.0. The version of OpenBLAS shipped with
the PyPI binaries has been increased to 0.3.27.



Authors
=======
* Name (commits)
* h-vetinari (1)
* Jake Bowhay (2)
* Evgeni Burovski (6)
* Sean Cheah (2)
* Lucas Colley (2)
* DWesl (2)
* Ralf Gommers (7)
* Ben Greiner (1) +
* Matt Haberland (2)
* Gregory R. Lee (1)
* Philip Loche (1) +
* Sijo Valayakkad Manikandan (1) +
* Matti Picus (1)
* Tyler Reddy (62)
* Atsushi Sakai (1)
* Daniel Schmitz (2)
* Dan Schult (3)
* Scott Shambaugh (2)
* Edgar Andrés Margffoy Tuay (1)

A total of 19 people contributed to this release.
People with a "+" by their names contributed a patch for the first time.
This list of names is automatically generated, and may not be fully complete.


Issues closed for 1.13.1
------------------------

* `#19423 <https://github.com/scipy/scipy/issues/19423>`__: BUG: \`scipy.ndimage.value_indices\` returns empty dict for \`intc\`/\`uintc\` dtype on Windows
* `#20264 <https://github.com/scipy/scipy/issues/20264>`__: DOC, MAINT: .jupyterlite.doit.db shows up untracked
* `#20392 <https://github.com/scipy/scipy/issues/20392>`__: DOC: optimize.root(method='lm') option
* `#20415 <https://github.com/scipy/scipy/issues/20415>`__: BUG: csr_array can no longer be initialized with 1D array
* `#20471 <https://github.com/scipy/scipy/issues/20471>`__: BUG: \`TestEig.test_falker\` fails on windows + MKL as well as...
* `#20491 <https://github.com/scipy/scipy/issues/20491>`__: BUG: Cannot find \`OpenBLAS\` on Cygwin
* `#20506 <https://github.com/scipy/scipy/issues/20506>`__: BUG: special.spherical_in: derivative at \`z=0, n=1\` incorrect
* `#20512 <https://github.com/scipy/scipy/issues/20512>`__: BUG: \`eigh\` fails for size 1 array with driver=evd
* `#20531 <https://github.com/scipy/scipy/issues/20531>`__: BUG: warning from \`optimize.least_squares\` for astropy with...
* `#20555 <https://github.com/scipy/scipy/issues/20555>`__: BUG: spatial: error in \`Rotation.align_vectors()\` with an infinite...
* `#20576 <https://github.com/scipy/scipy/issues/20576>`__: MAINT, TST: two types of failures observed on maintenance/1.13.x...
* `#20580 <https://github.com/scipy/scipy/issues/20580>`__: BUG: scipy.special.factorial2 doesn't handle \`uint32\` dtypes
* `#20591 <https://github.com/scipy/scipy/issues/20591>`__: BUG: scipy.stats.wilcoxon in 1.13 fails on 2D array with nan...
* `#20623 <https://github.com/scipy/scipy/issues/20623>`__: BUG: scipy.spatial.Delaunay, scipy.interpolate.LinearNDInterpolator...
* `#20648 <https://github.com/scipy/scipy/issues/20648>`__: BUG: stats.yulesimon: incorrect kurtosis values
* `#20652 <https://github.com/scipy/scipy/issues/20652>`__: BUG: incorrect origin tuple handling in ndimage \`minimum_filter\`...
* `#20660 <https://github.com/scipy/scipy/issues/20660>`__: BUG: spatial: \`Rotation.align_vectors()\` incorrect for anti-parallel...
* `#20670 <https://github.com/scipy/scipy/issues/20670>`__: BUG: sparse matrix creation in 1.13 with indices not summing...
* `#20692 <https://github.com/scipy/scipy/issues/20692>`__: BUG: stats.zipf: incorrect pmf values
* `#20714 <https://github.com/scipy/scipy/issues/20714>`__: CI: scipy installation failing in umfpack tests


Pull requests for 1.13.1
------------------------

* `#20280 <https://github.com/scipy/scipy/pull/20280>`__: MAINT: added doc/source/.jupyterlite.doit.db to .gitignore See...
* `#20322 <https://github.com/scipy/scipy/pull/20322>`__: BUG: sparse: align dok_array.pop() to dict.pop() for case with...
* `#20333 <https://github.com/scipy/scipy/pull/20333>`__: BUG: sync pocketfft again
* `#20381 <https://github.com/scipy/scipy/pull/20381>`__: REL, MAINT: prep for 1.13.1
* `#20401 <https://github.com/scipy/scipy/pull/20401>`__: DOC: optimize: fix wrong optional argument name in \`root(method="lm")\`.
* `#20435 <https://github.com/scipy/scipy/pull/20435>`__: DOC: add missing deprecations from 1.13.0 release notes
* `#20437 <https://github.com/scipy/scipy/pull/20437>`__: MAINT/DOC: fix syntax in 1.13.0 release notes
* `#20444 <https://github.com/scipy/scipy/pull/20444>`__: BUG: sparse: Clean up 1D input handling to sparse array/matrix...
* `#20449 <https://github.com/scipy/scipy/pull/20449>`__: DOC: remove spurious backtick from release notes
* `#20473 <https://github.com/scipy/scipy/pull/20473>`__: BUG: linalg: fix ordering of complex conj gen eigenvalues
* `#20474 <https://github.com/scipy/scipy/pull/20474>`__: TST: tolerance bumps for the conda-forge builds
* `#20484 <https://github.com/scipy/scipy/pull/20484>`__: TST: compare absolute values of U and VT in pydata-sparse SVD...
* `#20505 <https://github.com/scipy/scipy/pull/20505>`__: BUG: Include Python.h before system headers.
* `#20516 <https://github.com/scipy/scipy/pull/20516>`__: BUG: linalg: fix eigh(1x1 array, driver='evd') f2py check
* `#20527 <https://github.com/scipy/scipy/pull/20527>`__: BUG: \`spherical_in\` for \`n=0\` and \`z=0\`
* `#20530 <https://github.com/scipy/scipy/pull/20530>`__: BLD: Fix error message for f2py generation fail
* `#20533 <https://github.com/scipy/scipy/pull/20533>`__: TST: Adapt to \`__array__(copy=True)\`
* `#20537 <https://github.com/scipy/scipy/pull/20537>`__: BLD: Move Python-including files to start of source.
* `#20567 <https://github.com/scipy/scipy/pull/20567>`__: REV: 1.13.x: revert changes to f2py and tempita handling in meson.build...
* `#20569 <https://github.com/scipy/scipy/pull/20569>`__: update openblas to 0.3.27
* `#20573 <https://github.com/scipy/scipy/pull/20573>`__: BUG: Fix error with 180 degree rotation in Rotation.align_vectors()...
* `#20586 <https://github.com/scipy/scipy/pull/20586>`__: MAINT: optimize.linprog: fix bug when integrality is a list of...
* `#20592 <https://github.com/scipy/scipy/pull/20592>`__: MAINT: stats.wilcoxon: fix failure with multidimensional \`x\`...
* `#20601 <https://github.com/scipy/scipy/pull/20601>`__: MAINT: lint: temporarily disable UP031
* `#20607 <https://github.com/scipy/scipy/pull/20607>`__: BUG: handle uint arrays in factorial{,2,k}
* `#20611 <https://github.com/scipy/scipy/pull/20611>`__: BUG: prevent QHull message stream being closed twice
* `#20629 <https://github.com/scipy/scipy/pull/20629>`__: MAINT/DEV: lint: disable UP032
* `#20633 <https://github.com/scipy/scipy/pull/20633>`__: BUG: fix Vor/Delaunay segfaults
* `#20644 <https://github.com/scipy/scipy/pull/20644>`__: BUG: ndimage.value_indices: deal with unfixed types
* `#20653 <https://github.com/scipy/scipy/pull/20653>`__: BUG: ndimage: fix origin handling for \`{minimum, maximum}_filter\`
* `#20654 <https://github.com/scipy/scipy/pull/20654>`__: MAINT: stats.yulesimon: fix kurtosis
* `#20687 <https://github.com/scipy/scipy/pull/20687>`__: BUG: sparse: Fix summing duplicates for CSR/CSC creation from...
* `#20702 <https://github.com/scipy/scipy/pull/20702>`__: BUG: stats: Fix \`zipf.pmf\` and \`zipfian.pmf\` for int32 \`k\`
* `#20727 <https://github.com/scipy/scipy/pull/20727>`__: CI: pin Python for MacOS conda
2 changes: 1 addition & 1 deletion scipy/_lib/pocketfft
Submodule pocketfft updated 1 files
+5 −5 pocketfft_hdronly.h
4 changes: 2 additions & 2 deletions scipy/interpolate/tests/test_rbfinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
import numpy as np
from numpy.linalg import LinAlgError
from numpy.testing import assert_allclose, assert_array_equal
from numpy.testing import assert_allclose
from scipy.stats.qmc import Halton
from scipy.spatial import cKDTree
from scipy.interpolate._rbfinterp import (
Expand Down Expand Up @@ -415,7 +415,7 @@ def test_pickleable(self):
yitp1 = interp(xitp)
yitp2 = pickle.loads(pickle.dumps(interp))(xitp)

assert_array_equal(yitp1, yitp2)
assert_allclose(yitp1, yitp2, atol=1e-16)


class TestRBFInterpolatorNeighborsNone(_TestRBFInterpolator):
Expand Down
8 changes: 6 additions & 2 deletions scipy/interpolate/tests/test_rgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_derivatives(self):

# 2nd derivatives of a linear function are zero
assert_allclose(interp(sample, nu=(0, 1, 1, 0)),
[0, 0, 0], atol=1e-12)
[0, 0, 0], atol=2e-12)

@parametrize_rgi_interp_methods
def test_complex(self, method):
Expand Down Expand Up @@ -983,7 +983,11 @@ def test_matrix_input(self, method):

v1 = interpn((x, y), values, sample, method=method)
v2 = interpn((x, y), np.asarray(values), sample, method=method)
assert_allclose(v1, v2)
if method == "quintic":
# https://github.com/scipy/scipy/issues/20472
assert_allclose(v1, v2, atol=5e-5, rtol=2e-6)
else:
assert_allclose(v1, v2)

def test_length_one_axis(self):
# gh-5890, gh-9524 : length-1 axis is legal for method='linear'.
Expand Down
2 changes: 2 additions & 0 deletions scipy/linalg/_testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def __init__(self, data):
self._data = data

def __array__(self, dtype=None, copy=None):
if copy:
return self._data.copy()
return self._data


Expand Down
4 changes: 2 additions & 2 deletions scipy/linalg/flapack_sym_herm.pyf.src
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ subroutine <prefix2>syevd(compute_v,lower,n,w,a,lda,work,lwork,iwork,liwork,info
<ftype2> dimension(n),intent(out),depend(n) :: w

integer optional,intent(in),depend(n,compute_v) :: lwork=max((compute_v?1+6*n+2*n*n:2*n+1),1)
check(lwork>=(compute_v?1+6*n+2*n*n:2*n+1)) :: lwork
check( (lwork>=((compute_v?1+6*n+2*n*n:2*n+1))) || ((n==1)&&(lwork>=1)) ) :: lwork
<ftype2> dimension(lwork),intent(hide,cache),depend(lwork) :: work

integer optional,intent(in),depend(n,compute_v) :: liwork = (compute_v?3+5*n:1)
Expand Down Expand Up @@ -180,7 +180,7 @@ subroutine <prefix2c>heevd(compute_v,lower,n,w,a,lda,work,lwork,iwork,liwork,rwo
<ftype2> dimension(n),intent(out),depend(n) :: w

integer optional,intent(in),depend(n,compute_v) :: lwork=max((compute_v?2*n+n*n:n+1),1)
check(lwork>=(compute_v?2*n+n*n:n+1)) :: lwork
check( (lwork>=(compute_v?2*n+n*n:n+1)) || ((n==1)&&(lwork>=1)) ) :: lwork
<ftype2c> dimension(lwork),intent(hide,cache),depend(lwork) :: work

integer optional,intent(in),depend(n,compute_v) :: liwork = (compute_v?3+5*n:1)
Expand Down
15 changes: 13 additions & 2 deletions scipy/linalg/tests/test_decomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def _check_gen_eig(self, A, B, atol_homog=1e-13, rtol_homog=1e-13):
w_fin = -1j * np.real_if_close(1j*w_fin, tol=1e-10)
wt_fin = -1j * np.real_if_close(1j*wt_fin, tol=1e-10)

perm = argsort(w_fin)
permt = argsort(wt_fin)
perm = argsort(abs(w_fin) + w_fin.imag)
permt = argsort(abs(wt_fin) + wt_fin.imag)

assert_allclose(w_fin[perm], wt_fin[permt],
atol=1e-7, rtol=1e-7, err_msg=msg)
Expand Down Expand Up @@ -877,6 +877,17 @@ def test_various_drivers_standard(self, driver, dtype_):
atol=1000*np.finfo(dtype_).eps,
rtol=0.)

@pytest.mark.parametrize('driver', ("ev", "evd", "evr", "evx"))
def test_1x1_lwork(self, driver):
w, v = eigh([[1]], driver=driver)
assert_allclose(w, array([1.]), atol=1e-15)
assert_allclose(v, array([[1.]]), atol=1e-15)

# complex case now
w, v = eigh([[1j]], driver=driver)
assert_allclose(w, array([0]), atol=1e-15)
assert_allclose(v, array([[1.]]), atol=1e-15)

@pytest.mark.parametrize('type', (1, 2, 3))
@pytest.mark.parametrize('driver', ("gv", "gvd", "gvx"))
def test_various_drivers_generalized(self, driver, type):
Expand Down
12 changes: 9 additions & 3 deletions scipy/ndimage/_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1266,25 +1266,31 @@ def _min_or_max_filter(input, size, footprint, structure, output, mode,
else:
output[...] = input[...]
else:
origins = _ni_support._normalize_sequence(origin, input.ndim)
origins = _ni_support._normalize_sequence(origin, num_axes)
if num_axes < input.ndim:
if footprint.ndim != num_axes:
raise RuntimeError("footprint array has incorrect shape")
footprint = numpy.expand_dims(
footprint,
tuple(ax for ax in range(input.ndim) if ax not in axes)
)
# set origin = 0 for any axes not being filtered
origins_temp = [0,] * input.ndim
for o, ax in zip(origins, axes):
origins_temp[ax] = o
origins = origins_temp

fshape = [ii for ii in footprint.shape if ii > 0]
if len(fshape) != input.ndim:
raise RuntimeError('footprint array has incorrect shape.')
for origin, lenf in zip(origins, fshape):
if (lenf // 2 + origin < 0) or (lenf // 2 + origin >= lenf):
raise ValueError('invalid origin')
raise ValueError("invalid origin")
if not footprint.flags.contiguous:
footprint = footprint.copy()
if structure is not None:
if len(structure.shape) != input.ndim:
raise RuntimeError('structure array has incorrect shape')
raise RuntimeError("structure array has incorrect shape")
if num_axes != structure.ndim:
structure = numpy.expand_dims(
structure,
Expand Down