Compare commits

...

210 Commits

Author SHA1 Message Date
Tyler Reddy 1c836efe5f
REL: Prep for SciPy 1.9.4 (#17263)
* no real intention to do `1.9.4` but prep
just in case
2022-10-20 11:36:41 +02:00
Tyler Reddy de80faf9d3 REL: set 1.9.3 released [wheel build] 2022-10-19 14:48:01 -06:00
Tyler Reddy 25e6b90107
Merge pull request #17239 from tylerjereddy/treddy_backport_193
MAINT: 1.9.3 backports
2022-10-19 10:07:48 -06:00
Tyler Reddy ba33e438f9 DOC: update 1.9.3 relnotes 2022-10-17 17:28:06 -06:00
warren 92d892efaf MAINT: Handle numpy's deprecation of accepting out-of-bound integers.
After the change in https://github.com/numpy/numpy/pull/22385, numpy
raises a deprecation warning with calls such as np.int8(5000) and
np.uint32(-1).  This change avoids such calls in the tests.
2022-10-17 17:25:20 -06:00
Tyler Reddy ba5f6daa1d MAINT: PR 17239 revisions
* fix missing import from cherry-picked patch
2022-10-16 17:18:18 -06:00
Tyler Reddy 381089e753 DOC: update 1.9.3 relnotes 2022-10-16 15:21:19 -06:00
Eli Schwartz 2db3440cfd BLD: fix invalid shebang for build helper script
Shebangs do not work this way, but Meson could usually paper over the
differences by noticing that the last element is "python3" and rewiring
it to use its own sys.executable. However, this failed on WSL, likely
because platform quirks meant the script was directly executable, while
simultaneously having a shebang that was a fatal error.

Use a standard shebang indicating this script would like to run with
some form of python3 (which is exactly what it needs).

Fixes #17020
2022-10-16 15:09:13 -06:00
Lakshaya Inani a9a6582a38 DOC: stats.mode: add versionadded tag and correct order of keepdims description (#17204)
DOC: stats.mode: add versionadded tag and correct order of keepdims description
2022-10-16 15:08:50 -06:00
Ralf Gommers f4738889bd BLD: fix issue with incomplete threads dependency handling (#17200)
All could using `#include <thread>` needs to have this `thread_dep`
dependency. HiGHS code was missing it, and for `stats/_qmc_cy.pyx`
it was incorrectly specified.

It's wrong in the distutils build as well, but let's ignore that
since it's much harder to change and we'll get rid of that build
soon.

See gh-17193 for the type of compile error this causes.

[ci skip]
2022-10-16 15:07:57 -06:00
Gavin Zhang 5370f15752 MAINT: update meson.build to make it work on IBM i system (#17193)
[ci skip]

Co-authored-by: GavinZhang <zhanggan@cn.ibm.com>
Co-authored-by: Ralf Gommers <ralf.gommers@gmail.com>
2022-10-16 15:03:10 -06:00
Warren Weckesser 95cdfedb24 BUG: special: Fix two XSLOW test failures. (#17190)
When SCIPY_XSLOW is defined, the tests `test_riemann_zeta` and `test_zetac`
(that compare the results of `zeta` and `zetac` to the results computed
with `mpmath`) are run with 5000 points, and it turns out that the input
value 1 is included in that case.  The SciPy functions returns `inf`, but
`mpmath.zeta(1)` raises an exception, and that caused the tests to fail.

The fix is to wrap the `mpmath` function to return `mpmath.inf` when the
input is 1.  After fixing that, both tests then failed because some inputs
result in a relative error of roughly 2e-13, so I bumped the tolerance up
to 5e-13.
2022-10-16 15:02:38 -06:00
Matt Haberland 6c3514f966 Update scipy/stats/tests/test_discrete_basic.py
[skip ci]
2022-10-16 15:01:19 -06:00
Matt Haberland 9f0588b872 MAINT: stats.rv_discrete.pmf: should be zero at non-integer argument 2022-10-16 15:01:13 -06:00
Sebastian Ehlert 176143a0a3 FIX: special: use intended branching for `lamv` implementation
Change `lamv` implementation to use intended branching for assignment
to variable `cs` and avoid useless assignment to implicitly typed
variable `elsecs`.

See https://github.com/scipy/scipy/issues/17104
See https://github.com/lfortran/lfortran/issues/779

Signed-off-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
2022-10-16 15:00:28 -06:00
Matt Haberland 29330dae38 MAINT: stats.rayleigh: enforce constraint on location (#17090) 2022-10-16 14:59:25 -06:00
mreineck 99bb5ab7df MAINT: fix small LSMR problem (#17043)
[skip ci]
2022-10-16 14:58:16 -06:00
Warren Weckesser 9e170fe99a BUG: linalg: Simplify test_sgesdd_lwork_bug_workaround() (#16965)
The test of the _compute_lwork() work-around for a bug in
LAPACK versions older than 3.10.1 is simplified.  Instead
of calling svd() in a subprocess with a large input array
and checking that it doesn't crash Python, we check that
the function sgesdd_lwork() returns the correct value.  It
is the incorrect value that resulted in the Python crash,
so this is a simpler test of the same issue.
2022-10-16 14:57:19 -06:00
Evgeni Burovski a131701e5c BUG: interpolate: work array sizes for RectSphereBivariateSpline (#16872)
Make sure that `nuest` parameter is large enough when `s=0` and
`pole_continuity=(True, True)`. This value translates to
`iopt(2) = iopt(3) = 1` in the FITPACK routine `spgrid.f`.
This routine contains the following comment:

c  nuest : integer. unchanged on exit.
c  nvest : integer. unchanged on exit.
c          on entry, nuest and nvest must specify an upper bound for the
c          number of knots required in the u- and v-directions respect.
c          these numbers will also determine the storage space needed by
c          the routine. nuest >= 8, nvest >= 8.
c          in most practical situation nuest = mu/2, nvest=mv/2, will
c          be sufficient. always large enough are nuest=mu+6+iopt(2)+
c          iopt(3), nvest = mv+7, the number of knots needed for
c          interpolation (s=0).

Therefore, we set in the f2py wrappers `nuest = mu+6+2`, which is
the maximum possible value, since each `iopt` array element is at most
one.
2022-10-16 14:56:35 -06:00
GavinZhang b35393a177 DEV: support IBM i system 2022-10-16 14:55:54 -06:00
Evgeni Burovski 1745d9b9c8 BUG: interpolate: sanity check x and y in make_interp_spline(x, y, k=0) and k=1 (#16780)
Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
2022-10-16 14:55:22 -06:00
Matt Haberland 76d02b207f MAINT: stats.boltzmann: correct _shape_info typo (#16752)
* MAINT: stats.boltzmann: correct _shape_info typo
2022-10-16 14:54:46 -06:00
Jake Bowhay 1bf753c81a BUG: fix mutable data types as default arguments in ord.{Data,RealData} (#16701) 2022-10-16 14:54:13 -06:00
Pamphile Roy 2d0edd50b0 FIX: spurious divide error with gmean. (#16669) 2022-10-16 14:53:32 -06:00
warren 5a5df44aa4 BUG: sparse: Fix indexing sparse matrix with empty index arguments.
When a sparse matrix was indexed with an argument that was effectively
empty (e.g. `0:0:2`, `[]`, `[False, False]`), the dtype of the matrix
was lost and the result became float64.

Closes gh-16656.
2022-10-16 14:52:49 -06:00
warren 63b0a350d0 MAINT: sparse: Remove unused module-level string. 2022-10-16 14:52:42 -06:00
Matthew Brett ea79559ab2 BUG: interpolate: improve the logic for catching the overflow
Make sure that the product mx*my is <= min(max NPY_INTP, fortan int)
to avoid an overflow on both C and Fortran sides on 32- and 64-bit
systems with and without HAVE_ILP64 (which make Fortran ints 32- or 64-bit, too)
2022-10-16 14:51:23 -06:00
Evgeni Burovski d24f4f2547 MAINT: interpolate: remove an obsolete comment in fitpackmodule.c
The file maybe used to be autogenerated, but has since been updated manually
many times over by several people on several occasions. The autogeneration
script is also long gone, too.

For completeness, the original version (or a close approximation to it)
is now available at https://github.com/matthew-brett/multipack ---
this repository content is from a Waybackmachine archive of Travis Oliphant's
website, found by Matthew Brett. The archive was trawled on September 29 2000.
(https://web.archive.org/web/20000929143650/http://oliphant.netpedia.net/packages/multipack-0.7.tar.gz)

Co-authored-by: Matthew Brett <matthew.brett@gmail.com>
2022-10-16 14:51:16 -06:00
Evgeni Burovski f238b2bd82 BUG: interpolate/fitpackmodule: use INT_MAX for the overflow threshold
Also cast integers to npy_intp, because cannot use size_t in
PyArray_SimpleNew et al (it expects signed integers)

Co-authored-by: Matthew Brett <matthew.brett@gmail.com>
2022-10-16 14:51:10 -06:00
Evgeni Burovski b3a8cfa835 BUG: interpolate: use INTPTR_MAX
to guard against /detect the integer overflow

Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2022-10-16 14:51:04 -06:00
Lechnio 589731f532 fix_integer_overflow_check 2022-10-16 14:50:55 -06:00
serge-sans-paille 42bd049090 MAINT: Ensure Pythran input for lombscargle are contiguous (#16645) 2022-10-16 14:49:28 -06:00
Nathan Jacobi 05c49080a6 BUG: eps param no effect fixed (#16630)
Co-authored-by: Pamphile Roy <roy.pamphile@gmail.com>
2022-10-16 14:48:31 -06:00
Matt Haberland 22207e4b2b MAINT: stats.vonmises: inherit docstring from rv_continuous 2022-10-16 14:47:52 -06:00
Matt Haberland 862088c130 TST: stats.vonmises: fix rvs test 2022-10-16 14:47:46 -06:00
Matt Haberland b45f0fdec5 MAINT: stats.vonmises: wrap rvs to -pi, pi interval 2022-10-16 14:47:37 -06:00
Nicholas McKibben 8d1654585d FIX: stats: ignore divide-by-zero warnings from Boost binom impl (#16588) 2022-10-16 14:46:59 -06:00
ehsan shirvanian dcd6f459a9 FIX: `odr.Model` error with default `meta` value (#16573) 2022-10-16 14:46:13 -06:00
Warren Weckesser 417686c2ac BUG: optimize: Fix differential_evolution error message. (#16562) 2022-10-16 14:45:42 -06:00
Mamoru TASAKA 8499d8a03f BUG: fix syevr series segfault by explicitly specifying operator priority
With numpy 1.22.x f2py, dimension of isuppz in syevr is mistranslated.
Avoid this by explicitly specifying operator priority with parenthesis.

Fixes #16527
2022-10-16 14:44:50 -06:00
Matt Haberland 21c3355ed3 MAINT: stats.ks_2samp: fix warnings; simplify test 2022-10-16 14:43:39 -06:00
Matt Haberland ef309d1eb2 MAINT: stats.ks_2samp: always emit warning when exact method fails 2022-10-16 14:43:33 -06:00
Jake Bowhay 9e4cfe128d BUG: Fix error in error message for incorrect sample dimension in interpn 2022-10-16 14:42:44 -06:00
o-alexandre-felipe c37710c9de MAINT: fix SHGO extra arguments (#16506)
* Fix bug #14589 where arguments to objective function aren't passed properly

Co-authored-by: J. J. Ramsey <jjramsey@pobox.com>
2022-10-16 14:41:53 -06:00
jmkuebler c71ef7ff59 MAINT: stats.ttest_ind: randomized permutation pvalue should not be zero (#16460)
MAINT: stats.ttest_ind: randomized permutation pvalue should not be zero  

Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
2022-10-16 14:41:11 -06:00
Matt Haberland 7dda8a230a MAINT: stats: fix _contains_nan on pandas arrays (#16318) 2022-10-16 14:40:36 -06:00
Nikita Karetnikov 1772419318 BUG: fix a crash in `fpknot`
Caused by an OOB access due to uninitialized local variables.

Fixes #3691.
2022-10-16 14:39:56 -06:00
Samuel Wallan 5d811d925b ENH: stats.mood: correct for when ties are present (#16212) 2022-10-16 14:39:04 -06:00
Jelle Aalbers a578d3541d BUG: stats.rv_histogram: address issue with non-uniform bins (#15381)
The documentation of `rv_histogram` was ambiguous about what it expected as input when bin sizes vary: counts or density? Adding to the confusion, the default behavior of `rv_histogram` was to assume that the input was a density, whereas the default of `np.histogram` is to produce bin counts. To resolve this, this PR adds a parameter `density` so that the user can specify whether the input is to be treated as counts or probability density. Because the default is different from that of `np.histogram`, this also warns the user to pass `density` explicitly.

Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
2022-10-16 14:36:15 -06:00
Andrew Nelson e9bbd4ce00 BUG: fix powell evaluated outside limits (#15363)
* BUG: fix powell evaluated outside limits

Co-authored-by: Joseph T. Iosue <jtiosue@gmail.com>
2022-10-16 14:35:43 -06:00
Warren Weckesser e5cd7d1ff1 BUG: stats: Reformulate loggamma._rvs to handle c << 1. (#13349)
* BUG: stats: Reformulate loggamma._rvs to handle c << 1.

Closes gh-11094.

Several tests in test_morestats.py call loggamma.rvs to generate
test data.  These tests have hardcoded expected results that
depend on the values in the input data.  Because the stream
of variates generated by loggamma.rvs has changed, those tests
will fail if the input data is generated by loggamma.rvs.  Instead,
the data that was generated by a new function that takes the log of random variates from `stats.gamma.rvs`.

Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
2022-10-16 14:35:03 -06:00
Marie Roald dc2e75561b Bug: setting iprint=0 hides all output from fmin_l_bfgs_b, but it should print convergence info from final iteration. (#13322)
* BUG: optimize: fixed 13321
A bug in the way the `iprint` and `disp` arguments were handled
made it impossible to run the code with `iprint=0`, since it was
overwritten from the `disp` handling.

Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
2022-10-16 14:34:25 -06:00
drpeteb 372582996f BUG: multivariate_normal returns a pdf for values outside its support when covariance is singular (#5288)
Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
2022-10-16 14:33:42 -06:00
Tyler Reddy e7fa41736d
REL: Prep for SciPy 1.9.3 (#17176)
[ci skip]
2022-10-09 12:19:03 +02:00
Tyler Reddy 656076ca6b MAINT: wheel push 1.9.2 [wheel build]
* allow wheels to be built with a push
2022-10-08 11:49:57 -06:00
Tyler Reddy ad0d0f9070 REL: set 1.9.2 released [wheel build] 2022-10-08 11:23:48 -06:00
Tyler Reddy d9ad980132
Merge pull request #17150 from tylerjereddy/treddy_scipy_192_more_backports
MAINT: more 1.9.2 backports prep
2022-10-07 21:53:39 -06:00
Matt Haberland 6b098c2522
TST: optimize.milp: remove problematic timeout/iteration test 2022-10-06 11:00:27 -07:00
Phillip Wenig 24dce9760b
DOC: stats.pearsonr: typo in coeffic*i*ent (#17153) 2022-10-05 19:08:32 +02:00
Tyler Reddy a6ba7cad3b MAINT: misc 1.9.2 updates
* update 1.9.2 relnotes

* uncomment wheel upload code
2022-10-04 21:01:43 -06:00
Matt Haberland ed9760e60a MAINT: stats.pearson3: fix ppf for negative skew (#17055) 2022-10-04 20:54:12 -06:00
Nicholas McKibben 6fb67007dd FIX: optimize.milp: return feasible solution if available on timeout/node limit (#16814)
* FIX: optimize.milp: return feasible solution if available on timeout/node limit

Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
Co-authored-by: laenNoCode <36074576+laenNoCode@users.noreply.github.com>
2022-10-04 20:53:25 -06:00
Tyler Reddy bcfce27fc0
Merge pull request #17132 from tylerjereddy/treddy_192_backports
MAINT: 1.9.2 backports
2022-10-04 20:38:18 -06:00
Ralf Gommers 2bc973a2c2 BLD: set version to 1.9.2.dev0 (and trigger wheel build CI)
[wheel build]
2022-10-04 15:03:18 +02:00
Ralf Gommers 014ecf6879 CI: update wheel builder triggers
Brings these more in line with `main`
2022-10-04 15:03:18 +02:00
Ralf Gommers 5a793e98a3 DOC: replace `set_tight_layout` with `set_layout_engine` in example
There's a PendingDeprecationWarning for this introduced in Matplotlib
3.6 (released 16 Sep 2022). It should be fine to depend on latest
Matplotlib in this one example.

[skip azp] [skip actions]
2022-10-04 14:53:40 +02:00
Ralf Gommers 50c85e619a TST: mark one `linalg.solve_discrete_are` as knownfail
See gh-16926

(cherry picked from commit 81f4a4c0dc)
2022-10-04 14:53:40 +02:00
Ralf Gommers 54e27b3261 TST: mark float32 gges and qz tests as knownfail
See gh-16949
2022-10-04 14:53:35 +02:00
Warren Weckesser 35138daea0 BUG: sparse: Avoid creating a view when ensuring that an array has native byte order. (#17035)
(cherry picked from commit 29ec80b4a4)
2022-10-04 12:49:42 +02:00
Ralf Gommers dc1ae86db6 BLD: add `_USE_MATH_DEFINES` for all Cython-generated code
(cherry picked from commit 076a1f0992)
2022-10-04 12:42:19 +02:00
Ralf Gommers d885c5514a BLD: remove Meson pin, newer versions have fixes we need
This will solve the failure of the "build from sdist" job in Azure.
2022-10-04 12:37:19 +02:00
Tyler Reddy f3ca38db17 MAINT: PR 17132 revisions
* clean up some of my own mistakes from
merge conflict resolution in the build
system
2022-10-03 19:56:09 -06:00
Tyler Reddy 9c923e6014 DOC: update 1.9.2 relnotes. 2022-10-02 14:42:17 -06:00
Ewout ter Hoeven 7b76dba0c9 MAINT: pyproject.toml: Update build system requirements
Require "meson-python>=0.9.0", "Cython>=0.29.32", "pybind11>=2.10.0" and "pythran>=0.12.0" to build SciPy. These updated build-system requirements allow for consistent builds. The updated meson-python and Cython helps with Python 3.11 builds.

Probably a backport candidate to the 1.9 branch if Python 3.11 wheels are to be released on this branch.

(note that build-system requirements are only needed to build SciPy from source, not to run it after a regular pip install, and thus can be set fairly aggressive).

[wheel build]
2022-10-02 14:37:14 -06:00
Matt Haberland 58c8b79e17 TST: stats.studentized_range: fix incorrect test 2022-10-02 14:33:04 -06:00
Nicholas McKibben e079338448 FIX: ensure a hold on GIL before raising warnings/errors (#17096)
FIX: ensure a hold on GIL before raising warnings/errors
2022-10-02 14:32:31 -06:00
Matt Haberland b04b7eb06d MAINT: stats.truncnorm.logcdf/logsf: fix another catastropic cancellation 2022-10-02 14:31:34 -06:00
Naoto Mizuno 7c97930c8e BUG: Fix numerical precision error of truncnorm.logcdf
Resolve the large precision error of truncnorm.logcdf with upper
tail argument. mass_case_central of _log_gauss_mass was inaccurate
due to catastrophic cancellation in logsumexp.
2022-10-02 14:31:11 -06:00
Ewout ter Hoeven 9447b60b18 CI: Update cibuildwheel to 2.10.1
Update the cibuildwheel version used in the wheels.yml configuration from 2.9.0 to 2.10.1.

This is mainly usefull for the updated CPython 3.11 version (from 3.11.0rc1 to v3.11.0rc2).

[wheel build]
2022-10-02 14:30:35 -06:00
Ralf Gommers 466cb94ed1 DOC: fix a formatting issue in the building FAQ doc page
[ci skip]
2022-10-02 14:24:59 -06:00
Ralf Gommers caa9915193 BLD: make MKL detection more robust, add notes on TODOs
If the detection happens via CMake, that results in an upper-case
result for `blas.name()`. So deal with any case, and also that
of using `-Dblas=mkl_rt`.

Note that this does not fix things for using CMake, because that
defaults to the ILP64 interface (xref gh-16988).
Add notes on what is left for MKL support

Also add g77 ABI wrapper and fix a typo in f2py signature file in `_propack`
Note that this is an incomplete fix, because PROPACK is in a bad state,
as discussed in the issue linked in the code comment.
2022-10-02 14:24:45 -06:00
Andrew Nelson 0fd485ec53 TST: cibuildwheel test manylinux_aarch64 2022-10-02 14:23:16 -06:00
Ralf Gommers 6ee00910f2 BLD: use native threads on Windows, not pthreads
[skip actions] [skip circle]
2022-10-02 14:19:31 -06:00
Ralf Gommers b18c9be0da BLD: compensate for funky ifort name mangling on Windows
[skip circle]
2022-10-02 14:15:19 -06:00
Ralf Gommers 74d8dfeac6 BUG: missed one more gcc-specific flag, clean it up
Issue materialized with MSVC as:
```
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
```

[skip actions] [skip circle]
2022-10-02 14:14:56 -06:00
Loïc Estève 08cc962503 DOC: Update numpy supported versions for 1.9.2 2022-10-02 14:12:05 -06:00
Ralf Gommers 0df827a96d BLD: fix usage of `get_install_data`, which defaults to purelib
This resulted in `{py_purelib}/` entries in
`<build-dir>/meson-info/intro-install_plan.json`, and there should
be zero of those.

[skip azp] [skip circle]
2022-10-02 14:10:33 -06:00
Matt Haberland 670782a280 MAINT: stats.mode: fix bug with `axis!=1`, `nan_policy='omit'`, `keepdims=False` (#16954) 2022-10-02 14:03:43 -06:00
Ralf Gommers da01adaead BLD: use compiler flags in a more portable way.
Closes gh-16935
2022-10-02 14:02:58 -06:00
Hood Chatham 705ee88b01 Cast linear_sum_assignment to PyCFunction 2022-10-02 13:41:59 -06:00
Andrew Nelson 461b992cd0 MAINT: minimize, restore squeezed ((1.0)) 2022-10-02 13:40:44 -06:00
Andrew Nelson 0204a3d499 ENH: cibuildwheel infrastructure (#16842)
We're interested in moving to the modern `cibuildwheel` machinery for the release/wheel
build process, following NumPy/pandas, etc.

[skip actions] [skip circleci] [skip ci] [skip azp]
2022-10-02 13:39:49 -06:00
Meekail Zain 12327baab7 FIX: Updated dtype resolution in `_stack_along_minor_axis` (#16628)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Pamphile Roy <roy.pamphile@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-10-02 13:37:27 -06:00
Tyler Reddy e663940b7d
MAINT: fix NumPy upper bound (#16966)
* deals with gh-16964 -- it looks like we've been using
lower version bounds than we should for NumPy in i.e.,
`setup.py` since the `1.7.x` series; it looks like
the wheel-distributed metadata is configured from `setup.py`
until we switch to `meson`/`cibuildwheel`; we're planning to
do that soon anyway, but the fixes still seem sensible to
apply for consistency, or in case last minute `cibuildwheel` blockers
pop up for `1.9.2` (I'm less certain if we should backport this
all the way to `1.7.x`)

[ci skip]
2022-09-06 11:15:46 +03:00
Tyler Reddy 7dfc8a5570
REL: prep for SciPy 1.9.2 (#16911)
[ci skip]
2022-08-27 12:56:24 +03:00
Tyler Reddy 2e5883ef7a REL: set 1.9.1 released 2022-08-26 13:12:35 -06:00
Tyler Reddy fdd33aee7e
Merge pull request #16908 from tylerjereddy/treddy_191_relnotes_update
DOC: 1.9.1 relnotes update
2022-08-26 13:02:48 -06:00
Tyler Reddy 55e4f9f5bd
Update doc/release/1.9.1-notes.rst
[skip azp] [skip actions]

Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com>
2022-08-26 10:42:29 -06:00
Tyler Reddy 04945c5694 DOC: 1.9.1 relnotes update
* update the release notes for SciPy `1.9.1`
after a few more backports

[skip azp] [skip actions]
2022-08-26 10:21:52 -06:00
Tyler Reddy 5f06ddd920
Merge pull request #16904 from rgommers/update-191-pins
BLD: update dependency ranges for meson-python and pybind11 for 1.9.1
2022-08-26 09:59:34 -06:00
Tyler Reddy 987c698275
Merge pull request #16901 from tylerjereddy/treddy_191_backports
MAINT: 1.9.1 backports
2022-08-26 09:50:35 -06:00
Ralf Gommers 8e494e1c9b BLD: update dependency ranges for meson-python and pybind11 for 1.9.1
There are still multiple fixes for meson-python in the pipeline,
e.g. for PyPy support, wheel tags in corner cases, and how
the license info is displayed on PyPI. Hence don't use an upper bound
right now.

[skip circle]
2022-08-26 16:02:13 +03:00
Ralf Gommers 8b97528128 BLD: make the way we count commits for version numbering more robust
I think this will fix the issue with commit count being zero reported
in gh-16702.

(cherry picked from commit 97ee16d7d3)
2022-08-26 11:01:59 +03:00
Warren Weckesser cc0a2bf1be TST: sparse.linalg: Loosen tolerance for the lobpcg test 'test_tolerance_float32' (#16755)
This test has been failing occasionally in CI, with errors slightly greater than
the requested tolerances.

(cherry picked from commit f71e7fad71)
2022-08-26 10:57:22 +03:00
Andrew Nelson c055c31f4b BLD: cp310 needs numpy==1.22.3 2022-08-26 10:54:15 +03:00
Ralf Gommers ec9b0adf68 MAINT: fixes for small issues in backports to v1.9.1 2022-08-26 10:50:03 +03:00
Tyler Reddy 3e9c15d894 DOC: update 1.9.1 relnotes 2022-08-25 15:44:11 -06:00
Matt Haberland eb318818d5 MAINT: optimize.milp: fix input validation when three constraints are passed 2022-08-25 15:41:11 -06:00
Anirudh Dagar e8bb60a907 BUG, DOC: Fix sphinx autosummary generation for `odr` and `czt` (#16862) 2022-08-25 15:40:38 -06:00
Atsushi Sakai 42b4660b60 BUG: interpolate: fix previous and next extrapolate logic error. 2022-08-25 15:40:09 -06:00
warren 630c04a243 BUG/TST: linalg: Check the results of 'schur' more carefully.
The Schur decomposition is not unique, so testing the result
of linalg.schur against hard-coded matrices is not reliable.
The updated tests check that the desired properties of the
result are satisfied, and that the order of the diagonal
elements of the triangular matrix agrees with the given
'sort' parameter.

Closes gh-14517
2022-08-25 15:39:36 -06:00
Ralf Gommers b4122a3174 BLD: add Python 3.11 numpy version to pyproject.toml
This mirrors the change in https://github.com/scipy/oldest-supported-numpy/pull/61
NumPy 1.23.3 is the first numpy version with 3.11 wheels on PyPI.
2022-08-25 15:39:00 -06:00
Ralf Gommers 5fa16e6efd BLD/REL: on Windows use numpy 1.22.3 as the version to build wheels against
Closes gh-16787

[ci skip]
2022-08-25 15:38:47 -06:00
Matt Haberland 12d1358227 DOC: stats.skew/kurtosis: returns NaN when input has only one unique value (#16768) 2022-08-25 15:38:13 -06:00
Eli Schwartz 6ca618a0ee BLD: use a bit more idiomatic approach to constructing paths in meson
Instead of string concatenation, use Meson's path operator, which was
designed based on the same concept as pathlib.Path and uses the /
operator overload (but effectively using .as_posix() for consistency).
This guarantees consistent handling, and also avoids e.g. introspection
files containing duplicated path separators such as
`.../site-packages//scipy/...`

This is also required in order for Meson to internally track when an
install_dir string comes from py3.get_install_dir() after path-based
joining semantics, which is needed for improvements to the mesonpy build
backend.
2022-08-25 15:37:45 -06:00
Ralf Gommers 3b6160128e BLD: make OpenBLAS detection work with CMake (#16750)
This is a fallback detection path, in case pkg-config fails to find `openblas`.
CMake uses the camelcase version of the name.

If CMake is installed and it finds OpenBLAS, the result looks like:
```
Determining dependency 'OpenBLAS' with pkg-config executable '/home/rgommers/anaconda3/envs/scipy-dev/bin/pkg-config'
env[PKG_CONFIG_PATH]:
Called `/home/rgommers/anaconda3/envs/scipy-dev/bin/pkg-config --modversion OpenBLAS` -> 1

CMake binary for 1 is cached.

Determining dependency 'OpenBLAS' with CMake executable '/home/rgommers/anaconda3/envs/scipy-dev/bin/cmake'
Try CMake generator: auto
Calling CMake (['/home/rgommers/anaconda3/envs/scipy-dev/bin/cmake']) in /home/rgommers/code/scipy/build/meson-private/cmake_OpenBLAS with:
  - "-DNAME=OpenBLAS"
  - "-DARCHS=libpyldb-util.cpython-310-x86-64-linux-gnu.so;libpyldb-util.cpython-310-x86-64-linux-gnu.so.2;libpyldb-util.cpython-310-x86-64-linux-gnu.so.2.5.0;libpytalloc-util.cpython-310-x86-64-linux-gnu.so;libpytalloc-util.cpython-310-x86-64-linux-gnu.so.2;libpytalloc-util.cpython-310-x86-64-linux-gnu.so.2.3.3;libsamba-policy.cpython-310-x86-64-linux-gnu.so;libsamba-policy.cpython-310-x86-64-linux-gnu.so.0;libsamba-policy.cpython-310-x86-64-linux-gnu.so.0.0.1"
  - "-DVERSION="
  - "-DCOMPS="
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-DCMAKE_TOOLCHAIN_FILE=/home/rgommers/code/scipy/build/meson-private/cmake_OpenBLAS/CMakeMesonToolchainFile.cmake"
  - "."
  - "-DCMAKE_PREFIX_PATH=/home/rgommers/anaconda3/envs/scipy-dev;/home/rgommers/anaconda3/envs/scipy-dev/x86_64-conda-linux-gnu/sysroot/usr"
using old-style CMake variables for dependency OpenBLAS
Include Dirs:         ['/home/rgommers/anaconda3/envs/scipy-dev/include']
Compiler Definitions: []
Libraries:            ['/home/rgommers/anaconda3/envs/scipy-dev/lib/libopenblas.so']
Run-time dependency openblas found: YES 0.3.20
```

This follows up on comments in gh-16308
2022-08-25 15:37:00 -06:00
Ralf Gommers bcba22a5a8 BLD: install missing `.pxd` files, and update TODOs/FIXMEs in meson.build files (#16749)
* BLD: remove a warning suppression flag for HiGHS extension

This is no longer necessary, the PR linked in the removed comment
is included in our `highs` git submodule now.

* BLD: remove an outdated FIXME from the scipy/integrate/meson.build

This was fixed I believe (there are no skipped or xfailed tests either),
and the comment isn't very informative.

* BLD: remove another FIXME in `cython_optimize/meson.build`, it's not broken

The code can be simplified once the upstream feature is added, but
that's not a FIXME.

* BLD: remove comments about c++14/c++11 support

We can rely on C++14 unconditionally since 2021, see
http://scipy.github.io/devdocs/dev/toolchain.html#c-language-standards

* BLD: update info on including all license files as separate files

* BLD: install missing `scipy/*.pxd` files

No tests were failing, so something is fairly badly wrong in
the test suite.

Also add `optimize.cython_optimize` to the list of submodules that are
public API.

* BLD: remove FIXME about version string generation

This was fixed when adding `--git-dir` to the git invocation,
that made the result independent from the current directory
when invoking the build.

* BLD: remove TODO about `-fallow-argument-mismatch`

This flag is added implicitly via 'fortran_std=legacy' in the
top-level `meson.build`. Warnings that show up are silenced
in multiple modules, so there's no need for a separate TODO here.

* BLD: remove TODO for UNU.RAN version string

This isn't a very useful today, given that we don't use this
version string. The corresponding `setup.py` file also does the
same and doesn't have a TODO.

* BLD: update FIXME to a TODO in `linalg/meson.build`
2022-08-25 15:36:17 -06:00
Tyler Reddy 31ad7261a9
REL: prep for SciPy 1.9.1 (#16736)
* we're probably going to need SciPy `1.9.1` :)
2022-07-29 20:54:05 +02:00
Tyler Reddy 651a9b717d REL: set 1.9.0 released. 2022-07-28 20:30:46 -06:00
Ralf Gommers 253f8942c0
Merge pull request #16727 from tylerjereddy/treddy_final_190_backports
MAINT: final backports for 1.9.0
2022-07-28 22:07:01 +02:00
Tyler Reddy 4e9ed0298a REL: 1.9.0 final unreleased. 2022-07-28 11:24:13 -06:00
Tyler Reddy b83feaca49 DOC: update 1.9.0 relnotes
* changes to lists after backports

* manually remove the note that says
SciPy is "not released yet," as we prepare
for the final release
2022-07-28 11:22:11 -06:00
Matt Haberland ee9b834825 MAINT: stats.monte_carlo_test: used biased estimate of p-value (#16721) 2022-07-28 11:01:44 -06:00
Warren Weckesser 7ecca8da7a MAINT: stats: Work around Cython bug. (#16719)
Because of a bug in Cython, the inner function weigh() (a closure
in _weightedrankedtau()) cannot refer to the memoryview arguments
of _weightedrankedtau().  The work-around here is to assign the
arguments to local variables.
2022-07-28 11:00:33 -06:00
Ralf Gommers 87945b3ff0 DOC: a few mailmap updates
[ci skip]
2022-07-28 10:59:52 -06:00
Matt Haberland 8cefead27a MAINT: optimize.linprog: ensure integrality can be an array (#16684) 2022-07-28 10:59:34 -06:00
Pamphile Roy 15e96a0f7a DOC: pin pydata-sphinx-theme to prevent incoming breaking changes.
[skip ci]
2022-07-27 12:05:15 -07:00
Tyler Reddy c4c934889a REL: set 1.9.0rc3 released. 2022-07-23 10:30:13 -06:00
Ralf Gommers 20d0a1c286
Merge pull request #16570 from tylerjereddy/treddy_rc3_backports
MAINT: backports before 1.9.0rc3
2022-07-23 15:59:02 +02:00
Tyler Reddy 3580547353 MAINT: PR 16570 revisions
* fix `stats.mode` docstring example based
on reviewer feedback

* add note about MSVC build changes
2022-07-22 20:55:19 -06:00
Tyler Reddy 0bc07e8eb8 DOC: update 1.9.0 relnotes. 2022-07-22 11:57:43 -06:00
Matt Haberland 8ee0f8d894 MAINT: stats._axis_nan_policy: preserve dtype of masked arrays where possible (#16664) 2022-07-22 11:52:14 -06:00
Ralf Gommers b2948c011d DOC: update docs on building with Meson (#16638)
[skip azp] [skip github]
2022-07-22 11:51:47 -06:00
Nicholas McKibben 7eff19c8d1 ENH: FIX: update HiGHS submodule to resolve MIP infeasibility error (#16622) 2022-07-22 11:50:53 -06:00
Matt Haberland 6e7251f102 MAINT: stats.truncnorm: simplify remaining methods (#16605)
* MAINT: stats.truncnorm: simplify ppf

* MAINT: stats.truncnorm.rvs: use default inverse transform sampling

* MAINT: stats.truncnorm: replace remaining methods

[skip ci]
2022-07-22 11:50:20 -06:00
Matt Haberland 14bc8f976d MAINT: stats.truncnorm.rvs: improve performance (#16599) 2022-07-22 11:49:43 -06:00
Matt Haberland 04f785ccc7 MAINT: stats.truncnorm: revert changes to PDF method (do in separate PR) 2022-07-22 11:48:00 -06:00
Matt Haberland 1792b2854d BENCH: stats.truncnorm: fix benchmark again
[skip actions] [skip azp]
2022-07-22 11:47:49 -06:00
Matt Haberland 3ba4e1dca7 BENCH: stats.truncnorm: fix mistake
[skip azp] [skip actions]
2022-07-22 11:47:34 -06:00
Matt Haberland e1ccb18a2f BENCH: stats.truncnorm: move failing moment tests to benchmark 2022-07-22 11:47:17 -06:00
Matt Haberland 9b4f6dfe51 ENH: stats: simplify truncnorm pdf 2022-07-22 11:46:56 -06:00
Matt Haberland 3e87d357a6 TST: stats: replace TestTruncnorm::test_moments 2022-07-22 11:36:49 -06:00
Matt Haberland 82b17e7097 ENH: stats: simplify truncnorm pdf 2022-07-22 11:28:05 -06:00
Matt Haberland a483cafbc8 MAINT: stats.truncnorm: fix CDF accuracy issues 2022-07-22 11:27:12 -06:00
Matt Haberland d6c86b7d0e MAINT: stats: fix skew/kurtosis empty 1d input (#16581) 2022-07-22 11:26:35 -06:00
Ralf Gommers 6fdb0e023b MAINT: update bundled licenses for removal of scipy-sphinx-theme
Also add a formatting tweak to make it easier to append license
files (it's now the same for `LICENSES_bundled.txt` as for
`LICENSE_<os-name>.txt` in the scipy-wheels repo.

[ci skip]
2022-07-22 11:25:43 -06:00
Matt Haberland 3d253603fb MAINT: stats.mode: revert gh-15423 (#16429)
Adds a `keepdims` keyword and the related `nan_policy` support for it.
2022-07-22 11:23:42 -06:00
Tyler Reddy e1bea0c8a7
Merge pull request #16671 from rgommers/update-build-deps-1.9.x
BLD: update `meson` and `meson-python` versions for 1.9.0 release
2022-07-22 06:45:31 -06:00
Ralf Gommers 9d40737a75 BLD: update `meson` and `meson-python` versions for 1.9.0 release
This works around an issue where `pip install .` or `python -m build`
end up with a `py3-none` wheel tag, rather than the correct ABI tag.

Pinning the Meson version in `pyproject.toml` will only affect wheel
building, and should be fine.

For the change to `meson.build`, the upper bound doesn't seem to work.
This was never tested before, and is safe to remove.
2022-07-22 12:10:04 +02:00
Tyler Reddy be33c37321 DOC: update 1.9.0 relnotes. 2022-07-08 17:12:04 -06:00
Tyler Reddy cb62b3ada8 REL: set 1.9.0rc3 NOT released. 2022-07-08 17:08:13 -06:00
h-vetinari 52acc57ea2 DOC: Reflect MSVC minimum toolchain requirement (#16563) 2022-07-08 17:06:33 -06:00
Ralf Gommers cbb41007eb BLD: fix `__STDC_VERSION__` check in `special/_round.h` (#16551) 2022-07-08 17:05:57 -06:00
Ralf Gommers c1f6f8c87a BLD: fix an outdated requirement for macOS arm64 in pyproject.toml
NumPy 1.20 did build on macOS arm64, but there are no wheels.
This change matches an earlier one made in `oldest-supported-numpy`.

[ci skip]
2022-07-08 17:04:41 -06:00
h-vetinari 1e5d0922d2 DOC: reflect correctly where windows wheels are built (#16514)
[ci skip]
2022-07-08 17:04:07 -06:00
Tyler Reddy da012af5b7
Merge pull request #16553 from rgommers/error-on-too-new-python
BLD: raise an error with clear message for too-new Python version
2022-07-06 19:34:05 -06:00
Ralf Gommers 3c2e427b1f DOC: update phrasing in 1.9.0 release notes
This is a follow-up to gh-16556

[ci skip]
2022-07-05 20:27:58 +02:00
Ralf Gommers cd70d8b762
DOC: small tweaks to 1.9.0 release notes (#16556) 2022-07-05 19:01:05 +02:00
Ralf Gommers fb029314a4 BLD: raise an error with clear message for too-new Python version
This works for both `python install xxx`, which gives:
```
RuntimeError: Your Python version is too new. SciPy 1.9 supports Python 3.8-3.11; if you are trying to build from source for the most recent SciPy version you may hit this error as well. Please build from the `main` branch on GitHub instead.
```
as the last line.

For installing through `meson` or `meson-python`, we get:
```
meson.build:55:2: ERROR: Problem encountered: Your Python version is too new. SciPy 1.9 supports Python 3.8-3.11; if you are trying to build from source for the most recent SciPy version you may hit this error as well. Please build from the `main` branch on GitHub instead.

A full log can be found at /home/path/to/log
Meson build setup failed! ({0} elapsed)
```

Through pip or build we get some more boilerplate at the end that is
not avoidable, but the error message is still clear:
```
      Program python3 found: YES (/home/rgommers/anaconda3/envs/scipy-dev/bin/python3.10)

      ../../meson.build:55:2: ERROR: Problem encountered: Your Python version is too new. SciPy 1.9 supports Python 3.8-3.11; if you are trying to build from source for the most recent SciPy version you may hit this error as well. Please build from the `main` branch on GitHub instead.

      ...
      AttributeError: module 'mesonpy' has no attribute 'prepare_metadata_for_build_wheel'

      During handling of the above exception, another exception occurred:

          ....
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=/home/rgommers/code/scipy/.mesonpy-native-file.ini', '-Ddebug=true', '-Doptimization=2', '--prefix=/home/rgommers/anaconda3/envs/scipy-dev', '/home/rgommers/code/scipy', '/home/rgommers/code/scipy/.mesonpy-_3w2qa5b/build']' returned non-zero exit status 1.

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
```

Closes gh-14986

Note that this patch should be reverted after SciPy 1.9.0 is released.
We just need a single sdist on PyPI with this message. After that
we can simply rely on the correct metadata in `pyproject.toml`.
2022-07-05 14:56:02 +02:00
Tyler Reddy a6a7709541 REL: set 1.9.0rc2 released 2022-07-04 14:10:05 -06:00
Tyler Reddy b87fb4f583
Merge pull request #16539 from tylerjereddy/treddy_190_rc2_more_backports
MAINT: more 1.9.0rc2 backports
2022-07-03 20:28:51 -06:00
Tyler Reddy 0a688f5f56 DOC: update 1.9.0 relnotes. 2022-07-03 19:03:09 -06:00
Eli Schwartz 6c98bf6586 BLD: fix regression in building _lsap with symbol visibility
In commit 6d310c89ab, the PyMODINIT_FUNC
annotation was dropped from this module. It had been recently added, but
then a long-running PR was merged and, presumably due to `git rebase`,
reverted this diff hunk.

Fixes gh-16540
2022-07-03 18:58:49 -06:00
Tyler Reddy addb641e69 DOC: update 1.9.0 relnotes. 2022-07-03 14:09:43 -06:00
Ralf Gommers a3476fde65 MAINT: fix umfpack test failure with numpy 1.23
The reason is a divide-by-zero warning that our test suite settings
convert to an error. So ignore these warnings, because they're
coming from inside `scikit-umfpack`.

This has been failing consistently in the Azure pre-release job.

Closes gh-16523

[skip github]
2022-07-03 14:05:33 -06:00
Pamphile Roy e38f33a29b MAINT: use correct type for element wise comparison in `io.matlab` (#16393)
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
2022-07-03 14:05:10 -06:00
Ralf Gommers acf1556a1b
Merge pull request #16526 from tylerjereddy/treddy_rc2_backports
MAINT: 1.9.0rc2 backports
2022-07-03 12:19:03 +02:00
Tyler Reddy d50f319e2d DOC: update 1.9.0 relnotes. 2022-07-02 20:01:37 -06:00
Ralf Gommers 881f943227 REL: more tweaks to sdist contents
We did ship `doc/` after all, and it makes sense to include as a
snapshot, or for building the docs from sdist as some packagers
may want to do.

Also add a couple of files to the setup.py-generated sdist,
for consistency.

For a comprehensive test of the differences between sdists generated
by `distutils` and by `meson-python`, I ran:

```bash
set -x
git clean -xdf
python setup.py sdist
mv dist/scipy*.tar.gz ../scipy-setuppy.tar.gz
git clean -xdf
python -m build --sdist
mv dist/scipy*.tar.gz ../scipy-meson.tar.gz
git clean -xdf
mkdir dist
cd dist
mkdir sdist_content_setuppy
cd sdist_content_setuppy
tar -xzvf ../../../scipy-setuppy.tar.gz
cd ..
mkdir sdist_content_meson
cd sdist_content_meson
tar -xzvf ../../../scipy-meson.tar.gz
cd ../..
python ../tmp/compare_sdists.py
```

With the contents of `compare_sdists.py` being:

```python
import os

def list_files(basedir):
    """
    Returns all files in the given directory (including in subdirs)
    """
    files_out = list()
    for root, dirnames, filenames in os.walk(basedir):
        if root == 'dist':
            continue
        for filename in filenames:
            relpath = os.path.relpath(
                        os.path.join(root, filename),
                        start=basedir)
            files_out.append(relpath)

    return files_out

def compare_files(tree1, tree2):
    print(f"\n\nNot in f{tree2}\n\n")
    files_tree1 = list_files(tree1)
    files_tree2 = list_files(tree2)
    for file in files_tree1:
        if not file in files_tree2:
            print(file)

    print(f"\n\nNot in f{tree1}\n\n")
    for file in files_tree2:
        if not file in files_tree1:
            print(file)

if __name__ == '__main__':
    tree1 = '/home/rgommers/code/scipy/dist/sdist_content_meson/scipy-1.10.0.dev0/'
    tree2 = '/home/rgommers/code/scipy/dist/sdist_content_setuppy/scipy-1.10.0.dev0+1347.5ff12cc/'
    assert os.path.exists(tree1)
    assert os.path.exists(tree2)
    compare_files(tree1, tree2)
```

The result:

```

Not in f/home/rgommers/code/scipy/dist/sdist_content_setuppy/scipy-1.10.0.dev0+1347.5ff12cc/

LICENSES_bundled.txt
CONTRIBUTING.rst
scipy/special/tests/data/boost/ellint_rf_0yy_ipp/ellint_rf_0yy.txt
scipy/special/tests/data/boost/bessel_i_prime_int_data_ipp/bessel_i_prime_int_data.txt
<many more .txt files in tests/data/>

Not in f/home/rgommers/code/scipy/dist/sdist_content_meson/scipy-1.10.0.dev0/

.coveragerc
MANIFEST.in
scipy/version.py
scipy/linalg/_matfuncs_sqrtm_triu.cpp
scipy/fftpack/MANIFEST.in
scipy/_lib/highs/.git
scipy/_lib/boost/.git
scipy/_lib/unuran/.git
scipy/stats/_hypotests_pythran.cpp
scipy/stats/_boost/.gitignore
scipy/special/tests/data/gsl.npz
scipy/special/tests/data/local.npz
scipy/special/tests/data/boost.npz
scipy/interpolate/_rbfinterp_pythran.cpp
scipy/signal/_correlate_nd.c
scipy/signal/_spectral.cpp
scipy/signal/_bspline_util.c
scipy/signal/_max_len_seq_inner.cpp
scipy/signal/_lfilter.c
scipy/optimize/_group_columns.cpp
scipy/sparse/linalg/_propack/.gitignore
scipy/sparse/linalg/_propack/PROPACK/.git
tools/docker_dev/workspace_config
tools/docker_dev/Dockerfile
tools/docker_dev/fix_permissions
tools/docker_dev/environment.yml
tools/docker_dev/settings.json
tools/docker_dev/gitpod.Dockerfile
tools/docker_dev/meson.Dockerfile
tools/ci/README.txt
doc/source/_static/scipy-mathjax/.git
```

So we're leaving out:

1. All generated files
2. Some CI files (consistent, since most CI files aren't included in
                  either sdist)
3. .git and .gitignore files
4. MANIFEST.in (not useful, one cannot create an sdist from an sdist)
5. .coveragerc (basically also a CI file)
2022-07-02 19:56:38 -06:00
Ralf Gommers 217e77509d BLD: clean up unwanted files in sdist, via `.gitattributes` 2022-07-02 19:56:07 -06:00
Ralf Gommers 116e31955a BLD: fix warnings from f2py templating parsing
Vendors the relevant code from numpy.distutils. It hasn't changed
in a long time, so this is fine maintenance-wise.

Of course this code is very ugly, but we're stuck with using it
as long as we have the templated f2py files lying around.
2022-07-02 19:55:32 -06:00
Ralf Gommers 89555d0bd4 MAINT: remove raw html from README.rst
This was causing an issue with uploading the sdist to PyPI.
Tested on TestPyPI

Closes gh-16465

[ci skip]
2022-07-02 19:54:51 -06:00
Ross Barnowski 7318c1e13f DOC: Update Returns section of optimize.linprog. (#16482)
* DOC: Update Returns section of optimize.linprog.

Update the description of the OptimizeResult object to
note that the return type of the individual fields depends on
whether the optimization terminates successfully.

Add recommendation for users to check the OptimizeResult.success
attribute prior to any subsequent analysis.

Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>

Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
2022-07-02 19:54:05 -06:00
sabonerune 9dfa81a0cd BUG: fix fail to open tempfile in messagestream.pyx (#8850) 2022-07-02 19:52:56 -06:00
Toshiki Kataoka fa321f2e87 BUG: Fix rmul dispatch of spmatrix (#15235)
* BUG: Fix rmul dispatch of spmatrix

* TST: fix to test spmatrix

* TST: stop parametrizing dtype

* MAINT: Clarify doc of `_mul_dispatch`

* BUG: Handle NotImplemented in rmul
2022-07-02 18:25:32 -06:00
Tyler Reddy bc7a09902d
Merge pull request #16512 from h-vetinari/propack_1.9
[1.9] MAINT: skip complex128 propack tests on windows
2022-07-01 16:52:04 -06:00
H. Vetinari 02374cd2f3 MAINT: skip complex128 propack tests on windows 2022-07-01 15:07:35 +02:00
Tyler Reddy c31f711f6a
Merge pull request #16473 from mdhaber/linprog_bc_note
REL: update 1.9.0 release notes
2022-06-26 16:14:00 -06:00
Tyler Reddy cc40144a92 REL: set 1.9.0rc2 unreleased 2022-06-26 16:07:24 -06:00
Matt Haberland 3d6a126f80 REL: update 1.9.0 release notes 2022-06-26 13:41:23 -05:00
Tyler Reddy 72a5f46978 REL: set 1.9.0rc1 2022-06-23 11:36:22 -03:00
Tyler Reddy 000fefbe33
Merge pull request #16458 from tylerjereddy/treddy_final_190rc1_backports
MAINT: 1.9.0 backports
2022-06-23 07:37:11 -06:00
Tyler Reddy e65e03040d DOC: update 1.9.0 relnotes. 2022-06-23 03:30:09 -06:00
Tyler Reddy 545d4558aa TST: skip 32-bit test_pdist_correlation_iris_nonC 2022-06-23 06:20:29 -03:00
warren d24acbe90a DOC: Copy-edit 1.9.0-notes.rst
* Fix a typo: "it's" -> "its"
* Attempt to use capitalization and punctuation more consistently.

[skip azp]
2022-06-23 06:19:57 -03:00
Ewout ter Hoeven bde716929e DOC: optimize: Mark deprecated linprog methods explicitly (#16436)
Co-authored-by: Matt Haberland <mhaberla@calpoly.edu>
2022-06-23 06:19:44 -03:00
Tyler Reddy 5fc4041e2e
MAINT: version bounds 1.9.0rc1 (#16353)
For reference, last branching we did this: gh-15191
2022-06-22 13:01:47 +02:00
Ralf Gommers a6cfe46c52
Merge pull request #16451 from tylerjereddy/treddy_190_more_backports_rd2
MAINT: few more 1.9.0 backports
2022-06-22 12:54:34 +02:00
Tyler Reddy f390fd7973 DOC: update 1.9.0 relnotes 2022-06-21 19:29:34 -06:00
Matt Haberland 807086dbbd MAINT: stats.shapiro: don't modify input in place 2022-06-21 19:23:37 -06:00
Ralf Gommers f883581043 TST: fix test issues with casting-related warnings with numpy >1.23
Closes gh-16403
2022-06-21 19:22:04 -06:00
Antony Lee 9c73f1429c BUG: Make KDTree more robust against nans.
In KDTree construction, when splitting on the median, calling
std::nth_element and then std::partition (via partition_pivot) in
succession caused inconsistent tree builds, because nth_element
effectively treats nans as smaller than anything (the check it does is
`!(*j < *i)` for all i on the left and j on the right, cf. cppreference)
whereas partition (as written here) treats nans as larger (the predicate
in partition_pivot returns false for nans, which are thus placed on the
right), which caused various bugs with inputs containing nans: silently
incorrect values in some cases, segfaults in others (e.g. the added
test).

To fix that, rewrite the partition predicate to match (effectively) the
form used by std::nth_element.  While one may consider trying
`p = start_idx + n_points / 2` instead, this fails because there may be
many points equal to the median which nth_partition places at arbitrary
places on the left.
2022-06-21 19:21:23 -06:00
Hood Chatham 9df52f1516 BUG Fix signature of `*_IIR_forback` in `signal._bspline_util` (#15955)
The precision parameter has an issue where it is declared in `_splinemodule.c`
with type `double` but implemented with type `float`. This is a regression after
1.6.0, introduced when the code was switched to using Tempita templating.

Also aplit declarations into header file and include them also into `_splinemodule.c`.
This lets us detect mistakes in the declarations at compile time.

Co-authored-by: Ralf Gommers <ralf.gommers@gmail.com>
2022-06-21 19:20:20 -06:00
Ralf Gommers c545f52ce9
Merge pull request #16420 from tylerjereddy/treddy_190_more_backports
MAINT: next round of 1.9.0 backports
2022-06-17 06:17:06 +02:00
Tyler Reddy c2dbd85c1a DOC: update 1.9.0 relnotes. 2022-06-16 17:09:13 -06:00
Pamphile Roy 16918f6f9e DOC: dark theme css adjustments. (#16379)
[skip actions] [skip azp]
2022-06-16 15:39:17 -06:00
Pamphile Roy 01bc78ec28 MAINT: update pydata-sphinx-theme (#16374) 2022-06-16 15:38:38 -06:00
Tyler Reddy ae5f773739 DOC: update 1.9.0 relnotes
* update author/issue/PR lists

* mention the variable rename to `SCIPY_USE_PROPACK`
2022-06-16 11:12:48 -06:00
Warren Weckesser 0da047b9c0 BUG: spatial: Handle integer arrays in HalfspaceIntersection. (#16414) 2022-06-16 10:34:31 -06:00
Tyler Reddy 4937a67ceb TST: adjust 32-bit xfails for HiGHS
* ensure that two HiGHS-related tests
that segfault for 32-bit Linux runs
in the wheels repo are not only marked
with `xfail`, but do not execute at all
(to avoid segfaulting, of course)

* for one of the tests, this will be conditional
on 32-bit platform

* for the other test, there was already an `xfail`
mark so I've just bumped it up to not execute for
now
2022-06-16 10:33:32 -06:00
Ralf Gommers 42c7c89af2 MAINT: update Boost submodule to include Cygwin fix
Closes gh-15296 (now really)
2022-06-16 10:32:19 -06:00
Tyler Reddy 6bc77dea88 MAINT: PR 16361 revisions
* set `SCIPY_USE_PROPACK=1` for meson jobs on all three
platforms in CI

* fix linter issues...
2022-06-16 10:24:14 -06:00
Tyler Reddy 8450a45f52 MAINT: PR 16361 revisions
* update the error message to reflect the new
environment variable given reviewer feedback
(`USE_PROPACK` -> `SCIPY_USE_PROPACK`)
2022-06-16 10:23:58 -06:00
Tyler Reddy 0b53fc4c9c MAINT: SCIPY_USE_PROPACK
* this is effectively a forward port and modernization
of the release branch `PROPACK` shims that were added in
gh-15432; in short, `PROPACK` + Windows + some linalg backends
was causing all sorts of trouble, and this has never been resolved

* I've switched to `SCIPY_USE_PROPACK` instead of `USE_PROPACK`
for the opt-in, since this was requested, though the change
between release branches may cause a little confusion (another
release note adjustment to add maybe)

* I think the issues are painful to reproduce; for my part,
I did the following just to check the proper skipping/accounting
of tests:

- `SCIPY_USE_PROPACK=1 python dev.py -j 20 -t scipy/sparse/linalg`
  - `932 passed, 172 skipped, 8 xfailed in 115.57s (0:01:55)`
- `python dev.py -j 20 -t scipy/sparse/linalg`
  - `787 passed, 317 skipped, 8 xfailed in 114.80s (0:01:54)`

* why am I doing this now? well, to be frank the process of manually
backporting this for each release is error-prone, and may cause
additional confusion/debate, which I'd like to avoid. Besides, if it
is broken in `main` we may as well have the shims there as well. I would
point out that you may want to add `SCIPY_USE_PROPACK` to 1 or 2 jobs
in CI? The other reason is that if usage of `PROPACK` spreads, I don't
want to be manually applying more skips/shims on each release (which
I already had to do here with two new tests it seems)
2022-06-16 10:23:41 -06:00
Tyler Reddy ca8fda51d0 MAINT, TST: sup warning for theilslopes
* suppress rather than check for a warning
in `test_theilslopes_warnings()` because
the warning does not show up for 32-bit Windows
with at least some versions of NumPy (issue
for wheels repo)
2022-06-16 10:19:39 -06:00
Ralf Gommers 298f308a7e BLD: update Pythran requirement to 0.11.0, to support Clang >=13
See gh-16292
2022-06-16 10:18:43 -06:00
Tyler Reddy c36aeb37a4 TST: bump tol for _axis_nan_policy_test
* apply the patch Matt suggested in gh-16337

* I was easily able to reproduce the failure reported
there on a Linux box with a Python 3.9 venv where NumPy
`1.19.3` was used at test/runtime to mimic the wheels
repo, and confirm that the tests pass with this patch
2022-06-16 10:17:57 -06:00
Tyler Reddy 8620a22106
MAINT: git security shim for 1.9.x (#16329)
replicated gh-16139 on the latest maintenance branch
because the `master` branch of the wheels repo will
encounter the issues described in that PR (for example, see:
https://github.com/MacPython/scipy-wheels/pull/166 which
has Travis and Azure failures caused by those same
versioning issues)

[ci skip]
2022-06-01 06:38:14 +02:00
Tyler Reddy b9bb99c1a0
Merge pull request #16326 from tupui/version_switcher_1.9
REL: update version switcher for 1.9
2022-05-31 09:47:15 -06:00
Pamphile Roy d5b80fbf1b REL: update version switcher for 1.9.
[skip ci]
2022-05-31 11:15:27 +02:00
173 changed files with 6675 additions and 1633 deletions

22
.gitattributes vendored
View File

@ -1,3 +1,25 @@
# Excluding files from an sdist generated by meson-python
#########################################################
# Note: when adding to this list, be aware that you need to commit your changes
# before they take effect (can be confusing during testing)
.circleci/* export-ignore
.github/* export-ignore
ci/* export-ignore
.coveragerc export-ignore
.git* export-ignore
*.yml export-ignore
*.yaml export-ignore
.mailmap export-ignore
MANIFEST.in export-ignore
pavement.py export-ignore
tools/ci/* export-ignore
tools/docker_dev/* export-ignore
# Dealing with line endings
###########################
* text=auto
tools/win32/build_scripts/nsis_scripts/*.nsi.in eol=crlf

View File

@ -101,6 +101,7 @@ jobs:
- name: Test SciPy
run: |
export OMP_NUM_THREADS=2
export SCIPY_USE_PROPACK=1
python dev.py -n -j 2
test_venv_install:

View File

@ -97,7 +97,7 @@ jobs:
shell: bash -l {0}
run: |
conda activate scipy-dev
python -m pip install meson==0.61.1
python -m pip install meson==0.62.2
# Python.org installers still use 10.9, so let's use that too. Note
# that scikit-learn already changed to 10.13 in Jan 2021, so increasing
# this number in the future (if needed) should not be a problem.
@ -112,6 +112,7 @@ jobs:
run: |
conda activate scipy-dev
export OMP_NUM_THREADS=2
export SCIPY_USE_PROPACK=1
python dev.py -n -j 2
- name: Ccache statistics

219
.github/workflows/wheels.yml vendored Normal file
View File

@ -0,0 +1,219 @@
# Workflow to build and test wheels.
# To work on the wheel building infrastructure on a fork, comment out:
#
# if: github.repository == 'scipy/scipy'
#
# in the get_commit_message job include [wheel build] in your commit
# message to trigger the build. All files related to wheel building are located
# at tools/wheels/
name: Wheel builder
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: "9 9 * * 6"
push:
branches:
- maintenance/**
pull_request:
branches:
- main
- maintenance/**
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
get_commit_message:
name: Get commit message
runs-on: ubuntu-latest
if: github.repository == 'scipy/scipy'
outputs:
message: ${{ steps.commit_message.outputs.message }}
steps:
- name: Checkout scipy
uses: actions/checkout@v3
# Gets the correct commit message for pull request
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get commit message
id: commit_message
run: |
set -xe
COMMIT_MSG=$(git log --no-merges -1)
RUN="0"
if [[ "$COMMIT_MSG" == *"[wheel build]"* ]]; then
RUN="1"
fi
echo "::set-output name=message::$RUN"
echo github.ref ${{ github.ref }}
build_wheels:
name: Build wheel for ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }}
needs: get_commit_message
if: >-
contains(needs.get_commit_message.outputs.message, '1') ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
runs-on: ${{ matrix.buildplat[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# Github Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
# should also be able to do multi-archs on a single entry, e.g.
# [windows-2019, win*, "AMD64 x86"]. However, those two require a different compiler setup
# so easier to separate out here.
- [ubuntu-20.04, manylinux, x86_64]
- [ubuntu-20.04, manylinux, aarch64]
# When the macos-10.15 image is retired the gfortran/openblas chain
# may have to be reworked because the gfortran-4.9.0 compiler currently
# used in CI doesn't work in the macos-11.0 image. This will require a more
# recent gfortran (gfortran-9 is present on the macOS-11.0 image), and
# will probably require that the prebuilt openBLAS is updated.
# xref https://github.com/andyfaff/scipy/pull/28#issuecomment-1203496836
- [macos-10.15, macosx, x86_64]
- [macos-12, macosx, arm64]
- [windows-2019, win, AMD64]
python: [["cp38", "3.8"], ["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11.0-alpha - 3.11.0"]]
# python[0] is used to specify the python versions made by cibuildwheel
# python[1] is installed by actions/setup-python for the separate
# macosx_arm64 build. Once cibuildwheel can do the macosx_arm64 cross build
# we can get rid of this duplication and just have ["cp38", "cp39"].
# The actions/setup-python can only use the form ["3.8'].
env:
IS_32_BIT: ${{ matrix.buildplat[2] == 'x86' }}
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout scipy
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v4.2.0
with:
python-version: ${{ matrix.python[1]}}
- name: win_amd64 - install rtools
run: |
# mingw-w64
choco install rtools --no-progress
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
if: ${{ runner.os == 'Windows' && env.IS_32_BIT == 'false' }}
# - name: win32 - configure mingw for 32-bit builds
# run: |
# # taken from numpy wheels.yml script
# # Force 32-bit mingw. v 8.1.0 is the current version used to build
# # the 32 bit openBLAS library (not sure if that matters)
# choco uninstall mingw
# choco install -y mingw --forcex86 --force --version=8.1.0
# echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin;" >> $env:GITHUB_PATH
# echo $(gfortran --version)
# echo $(gcc --version)
# if: ${{ runner.os == 'Windows' && env.IS_32_BIT == 'true' }}
- name: Set up QEMU
if: ${{ runner.os == 'Linux' && matrix.buildplat[2] == 'aarch64' }}
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.10.1
# Build all wheels here, but the macosx_arm64 job in its own entry.
# cibuildwheel is currently unable to pass configuration flags to
# CIBW_BUILD_FRONTEND https://github.com/pypa/cibuildwheel/issues/1227
# (pip/build). Cross compilation with meson requires an initial
# configuration step to create a build directory. The subsequent wheel
# build then needs to use that directory. This can be done with pip
# using a command like:
# python -m pip wheel --config-settings builddir=build .
if: >-
( ! contains(matrix.buildplat[2], 'arm64' ) )
env:
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
- name: Build macosx_arm64
if: ${{ matrix.buildplat[1] == 'macosx' && matrix.buildplat[2] == 'arm64' }}
run: |
export PLAT="arm64"
export _PYTHON_HOST_PLATFORM="macosx-12.0-arm64"
export CROSS_COMPILE=1
# Need macOS >= 11 for arm compilation.
export MACOSX_DEPLOYMENT_TARGET=11.0
# SDK root needs to be set early, installation of gfortran/openblas
# needs to go in the correct location.
export SDKROOT=/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk
export ARCHFLAGS=" -arch arm64 "
# install dependencies for the build machine
pip install meson cython pybind11 pythran ninja oldest-supported-numpy build delocate meson-python
# sets up gfortran compiler/openblas, sets compiler flags.
bash tools/wheels/cibw_before_build_macos.sh $(pwd)
export PKG_CONFIG_PATH=/opt/arm64-builds/lib/pkgconfig
export PKG_CONFIG=/usr/local/bin/pkg-config
export CFLAGS=" -arch arm64 $CFLAGS"
export CXXFLAGS=" -arch arm64 $CXXFLAGS"
export LD_LIBRARY_PATH="/opt/arm64-builds/lib:$FC_LIBDIR:$LD_LIBRARY_PATH"
meson setup --cross-file $(pwd)/tools/wheels/cross_arm64.txt build
# use the pip frontend because the build front end does not end up
# obeying the configuration flags it's passed.
# For example: `python -m build -Cbuilddir=dir` does not end up using
# dir as the meson build directory. This is an issue because
# the cross-compile specification is contained in that directory.
python -m pip wheel -w dist -vvv --config-settings builddir=build .
rm dist/numpy*.whl
# The `.so` are all converted to `-rpath/libgfortran` by
# gfortran/meson, with all absolute paths removed.
# Enables delocate to find the libopenblas/libgfortran libraries.
export DYLD_LIBRARY_PATH=/opt/gfortran-darwin-arm64/lib/gcc/arm64-apple-darwin20.0.0/10.2.1:/opt/arm64-builds/lib
delocate-listdeps dist/scipy*.whl
delocate-wheel --require-archs=arm64 -k -w wheelhouse dist/scipy*.whl
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
- name: Upload wheels
if: success()
shell: bash
env:
SCIPY_STAGING_UPLOAD_TOKEN: ${{ secrets.SCIPY_STAGING_UPLOAD_TOKEN }}
SCIPY_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.SCIPY_NIGHTLY_UPLOAD_TOKEN }}
run: |
source tools/wheels/upload_wheels.sh
set_upload_vars
# trigger an upload to
# https://anaconda.org/scipy-wheels-nightly/scipy
# for cron jobs or "Run workflow" (restricted to main branch).
# Tags will upload to
# https://anaconda.org/multibuild-wheels-staging/scipy
# The tokens were originally generated at anaconda.org
upload_wheels

View File

@ -79,6 +79,7 @@ jobs:
- name: prep-test
run: |
echo "PYTHONPATH=${env:installed_path}" >> $env:GITHUB_ENV
echo "SCIPY_USE_PROPACK=1" >> $env:GITHUB_ENV
- name: test
run: |
mkdir tmp

View File

@ -18,6 +18,8 @@
@endolith <endolith@gmail.com> endolith <endolith@gmail.com>
@FormerPhysicist <Former@physicist.net> FormerPhysicist <Former@physicist.net>
@gaulinmp <gaulinmp+git@gmail.com> Mac <gaulinmp+git@gmail.com>
@h-vetinari <h.vetinari@gmx.com> h-vetinari <h.vetinari@gmx.com>
@h-vetinari <h.vetinari@gmx.com> H. Vetinari <h.vetinari@gmx.com>
@ksemb <ksms@gmx.de> ksemb <ksms@gmx.de>
@kshitij12345 <kshitijkalambarkar@gmail.com> kshitij12345 <kshitijkalambarkar@gmail.com>
@luzpaz <luzpaz@users.noreply.github.com> Unknown <kunda@scribus.net>
@ -443,6 +445,7 @@ Shivnaren Srinivasan <shivnaren@gmail.com> srinivasan <shivnaren@gmail.com>
Skipper Seabold <jsseabold@gmail.com> skip <skip@localhost>
Shinya SUZUKI <sshinya@bio.titech.ac.jp> Shinya SUZUKI <minasitawakou@gmail.com>
Smit Lunagariya <55887635+Smit-create@users.noreply.github.com> Smit-create <55887635+Smit-create@users.noreply.github.com>
Smit Lunagariya <smitlunagariya.mat18@itbhu.ac.in> Smit-create <smitlunagariya.mat18@itbhu.ac.in>
Sourav Singh <souravsingh@users.noreply.github.com> Sourav Singh <4314261+souravsingh@users.noreply.github.com>
Srikiran <srikiran@dhcp-v233-179.pv.reshsg.uci.edu> sriki18 <sriki18@users.noreply.github.com>
Stefan Endres <stefan.c.endres@gmail.com> stefan-endres <stefan.c.endres@gmail.com>

View File

@ -1,10 +1,9 @@
----
The SciPy repository and source distributions bundle a number of libraries that
are compatibly licensed. We list these here.
Name: scipy-sphinx-theme
Files: doc/scipy-sphinx-theme/*
License: 3-clause BSD, PSF and Apache 2.0
For details, see doc/sphinxext/LICENSE.txt
Name: Decorator
Files: scipy/_lib/decorator.py

View File

@ -2,6 +2,7 @@ include MANIFEST.in
include *.txt
# Top-level build script
include setup.py
include meson.build
include pyproject.toml
# All source files
recursive-include scipy *
@ -9,10 +10,11 @@ recursive-include benchmarks *
# All documentation
recursive-include doc *
# Add build and testing tools
include runtests.py
include runtests.py dev.py
include .coveragerc
include site.cfg.example
include tox.ini pytest.ini
include tox.ini pytest.ini mypy.ini
include CITATION.bib
recursive-include tools *
# Exclude what we don't want to include
recursive-exclude scipy/linalg/src/id_dist/src *_subr_*.f

View File

@ -1,12 +1,3 @@
.. raw:: html
<p>
<h1>
<a href="https://docs.scipy.org/doc/scipy/reference/"><img valign="middle" src="doc/source/_static/logo.svg" height="50" height="50" alt="SciPy logo"/></a>
SciPy
</h1>
</p>
.. image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A
:target: https://numfocus.org

View File

@ -182,7 +182,7 @@ stages:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python3.8 get-pip.py && \
pip3 --version && \
pip3 install setuptools==59.6.0 wheel numpy==1.18.5 cython==0.29.21 pybind11 pytest pytest-timeout pytest-xdist pytest-env pytest-cov Pillow mpmath pythran==0.10.0 && \
pip3 install setuptools==59.6.0 wheel numpy==1.18.5 cython==0.29.21 pybind11 pytest pytest-timeout pytest-xdist pytest-env pytest-cov Pillow mpmath pythran==0.11.0 && \
apt-get -y install gcc-5 g++-5 gfortran-8 wget && \
cd .. && \
mkdir openblas && cd openblas && \
@ -295,7 +295,7 @@ stages:
numpy==1.21.4
Pillow
pybind11
pythran==0.10.0
pythran==0.11.0
pytest
pytest-cov
pytest-env

View File

@ -162,6 +162,33 @@ class InferentialStats(Benchmark):
stats.mstats.kruskal(self.a, self.b)
# Benchmark data for the truncnorm stats() method.
# The data in each row is:
# a, b, mean, variance, skewness, excess kurtosis. Generated using
# https://gist.github.com/WarrenWeckesser/636b537ee889679227d53543d333a720
truncnorm_cases = [[-20, -19, -19.052343945976656, 0.002725073018195613,
-1.9838693623377885, 5.871801893091683],
[-30, -29, -29.034401237736176, 0.0011806604886186853,
-1.9929615171469608, 5.943905539773037],
[-40, -39, -39.02560741993011, 0.0006548827702932775,
-1.9960847672775606, 5.968744357649675],
[39, 40, 39.02560741993011, 0.0006548827702932775,
1.9960847672775606, 5.968744357649675]]
truncnorm_cases = np.array(truncnorm_cases)
class TruncnormStats(Benchmark):
param_names = ['case', 'moment']
params = [list(range(len(truncnorm_cases))), ['m', 'v', 's', 'k']]
def track_truncnorm_stats_error(self, case, moment):
result_indices = dict(zip(['m', 'v', 's', 'k'], range(2, 6)))
ref = truncnorm_cases[case, result_indices[moment]]
a, b = truncnorm_cases[case, 0:2]
res = stats.truncnorm(a, b).stats(moments=moment)
return np.abs((res - ref)/ref)
class DistributionsAll(Benchmark):
# all distributions are in this list. A conversion to a set is used to
# remove duplicates that appear more than once in either `distcont` or

View File

@ -125,6 +125,8 @@ change is made.
* `scipy.optimize`
- `scipy.optimize.cython_optimize`
* `scipy.signal`
- `scipy.signal.windows`

View File

@ -2,8 +2,6 @@
SciPy 1.9.0 Release Notes
==========================
.. note:: Scipy 1.9.0 is not released yet!
.. contents::
SciPy 1.9.0 is the culmination of 6 months of hard work. It contains
@ -17,7 +15,7 @@ run your code with ``python -Wd`` and check for ``DeprecationWarning`` s).
Our development attention will now shift to bug-fix releases on the
1.9.x branch, and on adding new features on the main branch.
This release requires Python 3.8+ and NumPy 1.18.5 or greater.
This release requires Python 3.8-3.11 and NumPy 1.18.5 or greater.
For running on PyPy, PyPy3 6.0+ is required.
@ -26,16 +24,17 @@ For running on PyPy, PyPy3 6.0+ is required.
Highlights of this release
**************************
- We have modernized our build system to use ``meson``, substantially reducing
our source build times
- We have modernized our build system to use ``meson``, substantially improving
our build performance, and providing better build-time configuration and
cross-compilation support,
- Added `scipy.optimize.milp`, new function for mixed-integer linear
programming.
programming,
- Added `scipy.stats.fit` for fitting discrete and continuous distributions
to data.
to data,
- Tensor-product spline interpolation modes were added to
`scipy.interpolate.RegularGridInterpolator`.
`scipy.interpolate.RegularGridInterpolator`,
- A new global optimizer (DIviding RECTangles algorithm)
`scipy.optimize.direct`
`scipy.optimize.direct`.
************
@ -51,7 +50,7 @@ New features
`scipy.interpolate.RegularGridInterpolator` and its tutorial.
- `scipy.interpolate.RegularGridInterpolator` and `scipy.interpolate.interpn`
now accept descending ordered points.
- ``RegularGridInterpolator`` now handles length-1 grid axes
- ``RegularGridInterpolator`` now handles length-1 grid axes.
- The ``BivariateSpline`` subclasses have a new method ``partial_derivative``
which constructs a new spline object representing a derivative of an
original spline. This mirrors the corresponding functionality for univariate
@ -60,15 +59,15 @@ New features
`scipy.linalg` improvements
===========================
- `scipy.linalg.expm` now accepts nD arrays. It's speed is also improved.
- Minimum required LAPACK version is bumped to ``3.7.1``
- `scipy.linalg.expm` now accepts nD arrays. Its speed is also improved.
- Minimum required LAPACK version is bumped to ``3.7.1``.
`scipy.fft` improvements
========================
- added ``uarray`` multimethods for `scipy.fft.fht` and `scipy.fft.ifht`
- Added ``uarray`` multimethods for `scipy.fft.fht` and `scipy.fft.ifht`
to allow provision of third party backend implementations such as those
recently added to CuPy
recently added to CuPy.
`scipy.optimize` improvements
=============================
@ -89,18 +88,18 @@ New features
- The default method of `scipy.optimize.linprog` is now ``'highs'``.
- Added `scipy.optimize.milp`, new function for mixed-integer linear
programming.
- added Newton-TFQMR method to ``newton_krylov``
- added support for the ``Bounds`` class in ``shgo`` and ``dual_annealing`` for
a more uniform API across `scipy.optimize`
- added the ``vectorized`` keyword to ``differential_evolution``
- ``approx_fprime`` now works with vector-valued functions
- Added Newton-TFQMR method to ``newton_krylov``.
- Added support for the ``Bounds`` class in ``shgo`` and ``dual_annealing`` for
a more uniform API across `scipy.optimize`.
- Added the ``vectorized`` keyword to ``differential_evolution``.
- ``approx_fprime`` now works with vector-valued functions.
`scipy.signal` improvements
===========================
- The new window function `scipy.signal.windows.kaiser_bessel_derived` was
added to compute the Kaiser-Bessel derived window.
- single-precision ``hilbert`` operations are now faster as a result of more
consistent ``dtype`` handling
- Single-precision ``hilbert`` operations are now faster as a result of more
consistent ``dtype`` handling.
`scipy.sparse` improvements
===========================
@ -119,11 +118,11 @@ New features
`scipy.sparse.linalg` improvements
==================================
- ``lobpcg`` performance improvements for small input cases
- ``lobpcg`` performance improvements for small input cases.
`scipy.spatial` improvements
============================
- Add an ``order`` parameter to `scipy.spatial.transform.Rotation.from_quat`
- Add an ``order`` parameter to `scipy.spatial.transform.Rotation.from_quat`
and `scipy.spatial.transform.Rotation.as_quat` to specify quaternion format.
@ -194,12 +193,12 @@ New features
- Add a `integers` method to `scipy.stats.qmc.QMCEngine`. It allows sampling
integers using any QMC sampler.
- improved the fit speed and accuracy of ``stats.pareto``
- Improved the fit speed and accuracy of ``stats.pareto``.
- added ``qrvs`` method to ``NumericalInversePolynomial`` to match the
situation for ``NumericalInverseHermite``
- Added ``qrvs`` method to ``NumericalInversePolynomial`` to match the
situation for ``NumericalInverseHermite``.
- faster random variate generation for ``gennorm`` and ``nakagami``
- Faster random variate generation for ``gennorm`` and ``nakagami``.
- ``lloyd_centroidal_voronoi_tessellation`` has been added to allow improved
sample distributions via iterative application of Voronoi diagrams and
@ -219,7 +218,7 @@ Deprecated features
- Due to collision with the shape parameter ``n`` of several distributions,
use of the distribution ``moment`` method with keyword argument ``n`` is
deprecated. Keyword ``n`` is replaced with keyword ``order``.
deprecated. Keyword ``n`` is replaced with keyword ``order``.
- Similarly, use of the distribution ``interval`` method with keyword arguments
``alpha`` is deprecated. Keyword ``alpha`` is replaced with keyword
``confidence``.
@ -245,39 +244,39 @@ Expired Deprecations
There is an ongoing effort to follow through on long-standing deprecations.
The following previously deprecated features are affected:
- Object arrays in sparse matrices now raise an error
- Inexact indices into sparse matrices now raise an error
- Object arrays in sparse matrices now raise an error.
- Inexact indices into sparse matrices now raise an error.
- Passing ``radius=None`` to `scipy.spatial.SphericalVoronoi` now raises an
error (not adding ``radius`` defaults to 1, as before)
error (not adding ``radius`` defaults to 1, as before).
- Several BSpline methods now raise an error if inputs have ``ndim > 1``.
- The ``_rvs`` method of statistical distributions now requires a ``size``
parameter
parameter.
- Passing a ``fillvalue`` that cannot be cast to the output type in
`scipy.signal.convolve2d` now raises an error
`scipy.signal.convolve2d` now raises an error.
- `scipy.spatial.distance` now enforces that the input vectors are
one-dimensional.
- Removed ``stats.itemfreq``
- Removed ``stats.median_absolute_deviation``
- Removed ``stats.itemfreq``.
- Removed ``stats.median_absolute_deviation``.
- Removed ``n_jobs`` keyword argument and use of ``k=None`` from
``kdtree.query``
- Removed ``right`` keyword from ``interpolate.PPoly.extend``
- Removed ``debug`` keyword from ``scipy.linalg.solve_*``
- Removed class ``_ppform`` ``scipy.interpolate``
- Removed BSR methods ``matvec`` and ``matmat``
- Removed ``mlab`` truncation mode from ``cluster.dendrogram``
- Removed ``cluster.vq.py_vq2``
``kdtree.query``.
- Removed ``right`` keyword from ``interpolate.PPoly.extend``.
- Removed ``debug`` keyword from ``scipy.linalg.solve_*``.
- Removed class ``_ppform`` ``scipy.interpolate``.
- Removed BSR methods ``matvec`` and ``matmat``.
- Removed ``mlab`` truncation mode from ``cluster.dendrogram``.
- Removed ``cluster.vq.py_vq2``.
- Removed keyword arguments ``ftol`` and ``xtol`` from
``optimize.minimize(method='Nelder-Mead')``
- Removed ``signal.windows.hanning``
``optimize.minimize(method='Nelder-Mead')``.
- Removed ``signal.windows.hanning``.
- Removed LAPACK ``gegv`` functions from ``linalg``; this raises the minimally
required LAPACK version to 3.7.1
- Removed ``spatial.distance.matching``
- Removed the alias ``scipy.random`` for ``numpy.random``
required LAPACK version to 3.7.1.
- Removed ``spatial.distance.matching``.
- Removed the alias ``scipy.random`` for ``numpy.random``.
- Removed docstring related functions from ``scipy.misc`` (``docformat``,
``inherit_docstring_from``, ``extend_notes_in_docstring``,
``replace_notes_in_docstring``, ``indentcount_lines``, ``filldoc``,
``unindent_dict``, ``unindent_string``).
- Removed ``linalg.pinv2``
- Removed ``linalg.pinv2``.
******************************
Backwards incompatible changes
@ -290,8 +289,11 @@ Backwards incompatible changes
output will be a scalar or ``np.ndarray`` rather than a masked array with
``mask=False``.
- The default method of `scipy.optimize.linprog` is now ``'highs'``, not
``'interior-point'`` (which is now deprecated), so callback functions and some
options are no longer supported with the default method.
``'interior-point'`` (which is now deprecated), so callback functions and
some options are no longer supported with the default method. With the
default method, the ``x`` attribute of the returned ``OptimizeResult`` is
now ``None`` (instead of a non-optimal array) when an optimal solution
cannot be found (e.g. infeasible problem).
- For `scipy.stats.combine_pvalues`, the sign of the test statistic returned
for the method ``"pearson"`` has been flipped so that higher values of the
statistic now correspond to lower p-values, making the statistic more
@ -309,7 +311,7 @@ Backwards incompatible changes
- Init of `MultinomialQMC` now require the number of trials with `n_trials`.
Hence, `MultinomialQMC.random` output has now the correct shape ``(n, pvals)``.
- Several function-specific warnings (``F_onewayConstantInputWarning``,
``F_onewayBadInputSizesWarning``, ``PearsonRConstantInputWarning``,
``F_onewayBadInputSizesWarning``, ``PearsonRConstantInputWarning``,
``PearsonRNearConstantInputWarning``, ``SpearmanRConstantInputWarning``, and
``BootstrapDegenerateDistributionWarning``) have been replaced with more
general warnings.
@ -334,6 +336,13 @@ Other changes
``FITPACK`` routines in `scipy.interpolate`, which power ``splrep``,
``splev`` etc., and ``*UnivariateSpline`` and ``*BivariateSpline`` classes.
- the ``USE_PROPACK`` environment variable has been renamed to
``SCIPY_USE_PROPACK``; setting to a non-zero value will enable
the usage of the ``PROPACK`` library as before
- Building SciPy on windows with MSVC now requires at least the vc142
toolset (available in Visual Studio 2019 and higher).
Lazy access to subpackages
==========================
@ -392,6 +401,7 @@ Authors
*******
* endolith (12)
* h-vetinari (11)
* Caio Agiani (2) +
* Emmy Albert (1) +
* Joseph Albert (1)
@ -408,16 +418,16 @@ Authors
* avishai231 (1) +
* Blair Azzopardi (1)
* Sayantika Banik (2) +
* Ross Barnowski (8)
* Ross Barnowski (9)
* Christoph Baumgarten (3)
* Nickolai Belakovski (1)
* Peter Bell (9)
* Sebastian Berg (2)
* Sebastian Berg (3)
* Bharath (1) +
* bobcatCA (2) +
* boussoffara (2) +
* Islem BOUZENIA (1) +
* Jake Bowhay (40) +
* Jake Bowhay (41) +
* Matthew Brett (11)
* Dietrich Brunn (2) +
* Michael Burkhart (2) +
@ -428,7 +438,7 @@ Authors
* CJ Carey (3)
* Thomas A Caswell (2)
* Ali Cetin (2) +
* Hood Chatham (4) +
* Hood Chatham (5) +
* Klesk Chonkin (1)
* Craig Citro (1) +
* Dan Cogswell (1) +
@ -446,11 +456,10 @@ Authors
* Isuru Fernando (3)
* Joseph Fox-Rabinovitz (1)
* Ryan Gibson (4) +
* Ralf Gommers (302)
* Ralf Gommers (327)
* Srinivas Gorur-Shandilya (1) +
* Alex Griffing (2)
* h-vetinari (3)
* Matt Haberland (435)
* Matt Haberland (461)
* Tristan Hearn (1) +
* Jonathan Helgert (1) +
* Samuel Hinton (1) +
@ -460,6 +469,7 @@ Authors
* Yikun Jiang (1) +
* JuliaMelle01 (1) +
* jyuv (12) +
* Toshiki Kataoka (1)
* Chris Keefe (1) +
* Robert Kern (4)
* Andrew Knyazev (11)
@ -471,6 +481,7 @@ Authors
* Peter Mahler Larsen (8)
* Eric Larson (4)
* Laurynas Mikšys (1) +
* Antony Lee (1)
* Gregory R. Lee (2)
* lerichi (1) +
* Tim Leslie (2)
@ -479,7 +490,7 @@ Authors
* lutefiskhotdish (1) +
* Cong Ma (12)
* Syrtis Major (1)
* Nicholas McKibben (17)
* Nicholas McKibben (18)
* Melissa Weber Mendonça (10)
* Mark Mikofski (1)
* Jarrod Millman (13)
@ -499,15 +510,16 @@ Authors
* Amit Portnoy (1) +
* Quentin Barthélemy (9)
* Patrick N. Raanes (1) +
* Tyler Reddy (93)
* Pamphile Roy (192)
* Tyler Reddy (185)
* Pamphile Roy (199)
* Vivek Roy (2) +
* sabonerune (1) +
* Niyas Sait (2) +
* Atsushi Sakai (25)
* Mazen Sayed (1) +
* Eduardo Schettino (5) +
* Daniel Schmitz (6) +
* Eli Schwartz (3) +
* Eli Schwartz (4) +
* SELEE (2) +
* Namami Shanker (4)
* siddhantwahal (1) +
@ -523,15 +535,14 @@ Authors
* Aleksandr Tagilov (1) +
* Masayuki Takagi (1) +
* Sai Teja (1) +
* Ewout ter Hoeven (1) +
* Ewout ter Hoeven (2) +
* Will Tirone (2)
* Bas van Beek (7)
* Dhruv Vats (1)
* H. Vetinari (4)
* Arthur Volant (1)
* Samuel Wallan (5)
* Stefan van der Walt (8)
* Warren Weckesser (81)
* Warren Weckesser (84)
* Anreas Weh (1)
* Nils Werner (1)
* Aviv Yaish (1) +
@ -544,7 +555,7 @@ Authors
* Pavel Zun (1) +
* David Zwicker (1) +
A total of 152 people contributed to this release.
A total of 154 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.
@ -553,11 +564,18 @@ This list of names is automatically generated, and may not be fully complete.
Issues closed for 1.9.0
***********************
* `#1884 <https://github.com/scipy/scipy/issues/1884>`__: stats distributions fit problems (Trac #1359)
* `#2047 <https://github.com/scipy/scipy/issues/2047>`__: derivatives() method is missing in BivariateSpline (Trac #1522)
* `#2071 <https://github.com/scipy/scipy/issues/2071>`__: TST: stats: \`check_sample_var\` should be two-sided (Trac #1546)
* `#2414 <https://github.com/scipy/scipy/issues/2414>`__: stats binom at non-integer n (Trac #1895)
* `#2623 <https://github.com/scipy/scipy/issues/2623>`__: stats.distributions statistical power of test suite
* `#2625 <https://github.com/scipy/scipy/issues/2625>`__: wilcoxon() function does not return z-statistic
* `#2650 <https://github.com/scipy/scipy/issues/2650>`__: (2D) Interpolation functions should work with complex numbers
* `#2834 <https://github.com/scipy/scipy/issues/2834>`__: ksone fitting
* `#2868 <https://github.com/scipy/scipy/issues/2868>`__: nan and stats.percentileofscore
* `#2877 <https://github.com/scipy/scipy/issues/2877>`__: distributions.ncf numerical issues
* `#2993 <https://github.com/scipy/scipy/issues/2993>`__: optimize.approx_fprime & jacobians
* `#3214 <https://github.com/scipy/scipy/issues/3214>`__: stats distributions ppf-cdf roundtrip
* `#3758 <https://github.com/scipy/scipy/issues/3758>`__: discrete distribution defined by \`values\` with non-integer...
* `#4130 <https://github.com/scipy/scipy/issues/4130>`__: BUG: stats: fisher_exact returns incorrect p-value
* `#4897 <https://github.com/scipy/scipy/issues/4897>`__: expm is 10x as slow as matlab according to http://stackoverflow.com/questions/30048315
@ -565,59 +583,106 @@ Issues closed for 1.9.0
* `#5266 <https://github.com/scipy/scipy/issues/5266>`__: Deprecated routines in Netlib LAPACK >3.5.0
* `#5890 <https://github.com/scipy/scipy/issues/5890>`__: Undefined behavior when using scipy.interpolate.RegularGridInterpolator...
* `#5982 <https://github.com/scipy/scipy/issues/5982>`__: Keyword collision in scipy.stats.levy_stable.interval
* `#6006 <https://github.com/scipy/scipy/issues/6006>`__: Dirichlet doesn't accept its own random variates as input to...
* `#6472 <https://github.com/scipy/scipy/issues/6472>`__: scipy.stats.invwishart does not check if scale matrix is symmetric
* `#6551 <https://github.com/scipy/scipy/issues/6551>`__: BUG: stats: inconsistency in docs and behavior of gmean and hmean
* `#6624 <https://github.com/scipy/scipy/issues/6624>`__: incorrect handling of nan by RegularGridInterpolator
* `#6882 <https://github.com/scipy/scipy/issues/6882>`__: Certain recursive scipy.integrate.quad (e.g. dblquad and nquad)...
* `#7469 <https://github.com/scipy/scipy/issues/7469>`__: Misleading interp2d documentation
* `#7560 <https://github.com/scipy/scipy/issues/7560>`__: Should RegularGridInterpolator support length 1 dimensions?
* `#8850 <https://github.com/scipy/scipy/issues/8850>`__: Scipy.interpolate.griddata Error : Exception ignored in: 'scipy.spatial.qhull._Qhull.__dealloc__'
* `#8928 <https://github.com/scipy/scipy/issues/8928>`__: BUG: scipy.stats.norm wrong expected value of function when loc...
* `#9213 <https://github.com/scipy/scipy/issues/9213>`__: __STDC_VERSION__ check in C++ code
* `#9231 <https://github.com/scipy/scipy/issues/9231>`__: infinite loop in stats.fisher_exact
* `#9313 <https://github.com/scipy/scipy/issues/9313>`__: geometric distribution stats.geom returns negative values if...
* `#9524 <https://github.com/scipy/scipy/issues/9524>`__: interpn returns nan with perfectly valid data
* `#9591 <https://github.com/scipy/scipy/issues/9591>`__: scipy.interpolate.interp1d with kind=“previous” doesn't extrapolate...
* `#9815 <https://github.com/scipy/scipy/issues/9815>`__: stats.mode's nan_policy 'propagate' not working?
* `#9944 <https://github.com/scipy/scipy/issues/9944>`__: documentation for \`scipy.interpolate.RectBivariateSpline\` is...
* `#9999 <https://github.com/scipy/scipy/issues/9999>`__: BUG: malloc() calls in Cython and C that are not checked for...
* `#10096 <https://github.com/scipy/scipy/issues/10096>`__: Add literature reference for circstd (and circvar?)
* `#10446 <https://github.com/scipy/scipy/issues/10446>`__: RuntimeWarning: invalid value encountered in stats.genextreme
* `#10577 <https://github.com/scipy/scipy/issues/10577>`__: Additional discussion for scipy.stats roadmap
* `#10821 <https://github.com/scipy/scipy/issues/10821>`__: Errors with the Yeo-Johnson Transform that also Appear in Scikit-Learn
* `#10983 <https://github.com/scipy/scipy/issues/10983>`__: LOBPCG inefficinet when computing > 20% of eigenvalues
* `#11145 <https://github.com/scipy/scipy/issues/11145>`__: unexpected SparseEfficiencyWarning at scipy.sparse.linalg.splu
* `#11406 <https://github.com/scipy/scipy/issues/11406>`__: scipy.sparse.linalg.svds (v1.4.1) on singular matrix does not...
* `#11447 <https://github.com/scipy/scipy/issues/11447>`__: scipy.interpolate.interpn: Handle ValueError('The points in dimension...
* `#11673 <https://github.com/scipy/scipy/issues/11673>`__: intlinprog: integer linear program solver
* `#11742 <https://github.com/scipy/scipy/issues/11742>`__: MAINT: stats: getting skewness alone takes 34000x longer than...
* `#11806 <https://github.com/scipy/scipy/issues/11806>`__: Unexpectedly poor results when distribution fitting with \`weibull_min\`...
* `#11828 <https://github.com/scipy/scipy/issues/11828>`__: UnivariateSpline gives varying results when multithreaded on...
* `#11948 <https://github.com/scipy/scipy/issues/11948>`__: fitting discrete distributions
* `#12073 <https://github.com/scipy/scipy/issues/12073>`__: Add note in documentation
* `#12370 <https://github.com/scipy/scipy/issues/12370>`__: truncnorm.rvs is painfully slow on version 1.5.0rc2
* `#12456 <https://github.com/scipy/scipy/issues/12456>`__: Add generalized mean calculation
* `#12480 <https://github.com/scipy/scipy/issues/12480>`__: RectBivariateSpline derivative evaluator is slow
* `#12485 <https://github.com/scipy/scipy/issues/12485>`__: linprog returns an incorrect message
* `#12506 <https://github.com/scipy/scipy/issues/12506>`__: ENH: stats: one-sided p-values for statistical tests
* `#12545 <https://github.com/scipy/scipy/issues/12545>`__: stats.pareto.fit raises RuntimeWarning
* `#12548 <https://github.com/scipy/scipy/issues/12548>`__: scipy.stats.skew returning MaskedArray
* `#12633 <https://github.com/scipy/scipy/issues/12633>`__: Offer simpler development workflow?
* `#12658 <https://github.com/scipy/scipy/issues/12658>`__: scipy.stats.levy_stable.pdf can be inaccurate and return nan
* `#12733 <https://github.com/scipy/scipy/issues/12733>`__: scipy.stats.truncnorm.cdf slow
* `#12838 <https://github.com/scipy/scipy/issues/12838>`__: Accept multiple matrices in \`scipy.linalg.expm\`
* `#12848 <https://github.com/scipy/scipy/issues/12848>`__: DOC: stats: multivariate distribution documentation issues
* `#12870 <https://github.com/scipy/scipy/issues/12870>`__: Levy Stable Random Variates Code has a typo
* `#12871 <https://github.com/scipy/scipy/issues/12871>`__: Levy Stable distribution uses parameterisation that is not location...
* `#13200 <https://github.com/scipy/scipy/issues/13200>`__: Errors made by scipy.optimize.linprog
* `#13462 <https://github.com/scipy/scipy/issues/13462>`__: Too many warnings and results objects in public API for scipy.stats
* `#13582 <https://github.com/scipy/scipy/issues/13582>`__: ENH: stats: \`rv_continuous.stats\` with array shapes: use \`_stats\`...
* `#13615 <https://github.com/scipy/scipy/issues/13615>`__: RFC: switch to Meson as a build system
* `#13632 <https://github.com/scipy/scipy/issues/13632>`__: stats.rv_discrete is not checking that xk values are integers
* `#13655 <https://github.com/scipy/scipy/issues/13655>`__: MAINT: stats.rv_generic: \`moment\` method falls back to \`_munp\`...
* `#13689 <https://github.com/scipy/scipy/issues/13689>`__: Wilcoxon does not appropriately detect ties when mode=exact.
* `#13835 <https://github.com/scipy/scipy/issues/13835>`__: Change name of \`alpha\` parameter in \`interval()\` method
* `#13872 <https://github.com/scipy/scipy/issues/13872>`__: Add method details or reference to \`scipy.integrate.dblquad\`
* `#13912 <https://github.com/scipy/scipy/issues/13912>`__: Adding Poisson Disc sampling to QMC
* `#13996 <https://github.com/scipy/scipy/issues/13996>`__: Fisk distribution documentation typo
* `#14035 <https://github.com/scipy/scipy/issues/14035>`__: \`roots_jacobi\` support for large parameter values
* `#14081 <https://github.com/scipy/scipy/issues/14081>`__: \`scipy.optimize._linprog_simplex._apply_pivot\` relies on asymmetric...
* `#14095 <https://github.com/scipy/scipy/issues/14095>`__: scipy.stats.norm.pdf takes too much time and memory
* `#14162 <https://github.com/scipy/scipy/issues/14162>`__: Thread safety RectBivariateSpline
* `#14267 <https://github.com/scipy/scipy/issues/14267>`__: BUG: online doc returns 404 - wrong \`reference\` in url
* `#14313 <https://github.com/scipy/scipy/issues/14313>`__: ks_2samp: example description does not match example output
* `#14418 <https://github.com/scipy/scipy/issues/14418>`__: \`ttest_ind\` for two sampled distributions with the same single...
* `#14455 <https://github.com/scipy/scipy/issues/14455>`__: Adds Mixed Integer Linear Programming from highs
* `#14462 <https://github.com/scipy/scipy/issues/14462>`__: Shapiro test returning negative p-value
* `#14471 <https://github.com/scipy/scipy/issues/14471>`__: methods 'revised simplex' and 'interior-point' are extremely...
* `#14505 <https://github.com/scipy/scipy/issues/14505>`__: \`Optimization converged to parameters that are outside the range\`...
* `#14527 <https://github.com/scipy/scipy/issues/14527>`__: Segmentation fault with KDTree
* `#14548 <https://github.com/scipy/scipy/issues/14548>`__: Add convention flag to quanternion in \`Scipy.spatial.transform.rotation.Rotation\`
* `#14565 <https://github.com/scipy/scipy/issues/14565>`__: optimize.minimize: Presence of callback causes method TNC to...
* `#14622 <https://github.com/scipy/scipy/issues/14622>`__: BUG: (sort of) mannwhitneyu hits max recursion limit with imbalanced...
* `#14645 <https://github.com/scipy/scipy/issues/14645>`__: ENH: MemoryError when trying to bootstrap with large amounts...
* `#14716 <https://github.com/scipy/scipy/issues/14716>`__: BUG: stats: The \`loguniform\` distribution is overparametrized.
* `#14731 <https://github.com/scipy/scipy/issues/14731>`__: BUG: Incorrect residual graph in scipy.sparse.csgraph.maximum_flow
* `#14745 <https://github.com/scipy/scipy/issues/14745>`__: BUG: scipy.ndimage.convolve documentation is incorrect
* `#14750 <https://github.com/scipy/scipy/issues/14750>`__: ENH: Add one more derivative-free optimization method
* `#14753 <https://github.com/scipy/scipy/issues/14753>`__: Offer to collaborate on truncated normal estimation by minimax...
* `#14777 <https://github.com/scipy/scipy/issues/14777>`__: BUG: Wrong limit and no warning in stats.t for df=np.inf
* `#14793 <https://github.com/scipy/scipy/issues/14793>`__: BUG: Missing pairs in cKDTree.query_pairs when coordinates contain...
* `#14861 <https://github.com/scipy/scipy/issues/14861>`__: BUG: unclear error message when all bounds are all equal for...
* `#14889 <https://github.com/scipy/scipy/issues/14889>`__: BUG: NumPy's \`random\` module should not be in the \`scipy\`...
* `#14914 <https://github.com/scipy/scipy/issues/14914>`__: CI job with code coverage is failing (yet again)
* `#14926 <https://github.com/scipy/scipy/issues/14926>`__: RegularGridInterpolator should be called RectilinearGridInterpolator
* `#14986 <https://github.com/scipy/scipy/issues/14986>`__: Prevent new Python versions from trying to install older releases...
* `#14994 <https://github.com/scipy/scipy/issues/14994>`__: BUG: Levy stable
* `#15009 <https://github.com/scipy/scipy/issues/15009>`__: BUG: scipy.stats.multiscale_graphcorr p-values are computed differently...
* `#15059 <https://github.com/scipy/scipy/issues/15059>`__: BUG: documentation inconsistent with code for find_peaks_cwt
* `#15082 <https://github.com/scipy/scipy/issues/15082>`__: DOC: Sampling from the truncated normal
* `#15110 <https://github.com/scipy/scipy/issues/15110>`__: BUG: truncnorm.cdf returns incorrect values at tail
* `#15125 <https://github.com/scipy/scipy/issues/15125>`__: Deprecate \`scipy.spatial.distance.kulsinski\`
* `#15133 <https://github.com/scipy/scipy/issues/15133>`__: BUG: Log_norm description is incorrect and produces incorrect...
* `#15150 <https://github.com/scipy/scipy/issues/15150>`__: BUG: RBFInterpolator is much slower than Rbf for vector data
* `#15172 <https://github.com/scipy/scipy/issues/15172>`__: BUG: special: High relative error in \`log_ndtr\`
* `#15195 <https://github.com/scipy/scipy/issues/15195>`__: BUGS: stats: Tracking issue for distributions that warn and/or...
* `#15199 <https://github.com/scipy/scipy/issues/15199>`__: BUG: Error occured \`spsolve_triangular\`
* `#15210 <https://github.com/scipy/scipy/issues/15210>`__: BUG: A sparse matrix raises a ValueError when \`__rmul__\` with...
* `#15245 <https://github.com/scipy/scipy/issues/15245>`__: MAINT: scipy.stats._levy_stable should be treated as subpackage...
* `#15252 <https://github.com/scipy/scipy/issues/15252>`__: DOC: Multivariate normal CDF docstring typo
* `#15296 <https://github.com/scipy/scipy/issues/15296>`__: BUG: SciPy 1.7.x build failure on Cygwin
* `#15308 <https://github.com/scipy/scipy/issues/15308>`__: BUG: OpenBLAS 0.3.18 support
* `#15338 <https://github.com/scipy/scipy/issues/15338>`__: DOC: Rename \`\*args\` param in \`f_oneway\` to \`\*samples\`
* `#15345 <https://github.com/scipy/scipy/issues/15345>`__: BUG: boschloo_exact gives pvalue > 1 (and sometimes nan)
* `#15368 <https://github.com/scipy/scipy/issues/15368>`__: build warnings for \`unuran_wrapper.pyx\`
* `#15373 <https://github.com/scipy/scipy/issues/15373>`__: BUG: Tippetts and Pearsons method for combine_pvalues are not...
@ -625,25 +690,33 @@ Issues closed for 1.9.0
* `#15456 <https://github.com/scipy/scipy/issues/15456>`__: Segfault in HiGHS code when building with Mingw-w64 on Windows
* `#15458 <https://github.com/scipy/scipy/issues/15458>`__: DOC: Documentation inaccuracy of scipy.interpolate.bisplev
* `#15488 <https://github.com/scipy/scipy/issues/15488>`__: ENH: missing examples for scipy.optimize in docs
* `#15507 <https://github.com/scipy/scipy/issues/15507>`__: BUG: scipy.optimize.linprog: the algorithm determines the problem...
* `#15508 <https://github.com/scipy/scipy/issues/15508>`__: BUG: Incorrect error message in multivariate_normal
* `#15541 <https://github.com/scipy/scipy/issues/15541>`__: BUG: scipy.stats.powerlaw, why should x ∈ (0,1)? x can exceed...
* `#15551 <https://github.com/scipy/scipy/issues/15551>`__: MAINT: stats: deprecating non-numeric array support in \`stats.mode\`
* `#15568 <https://github.com/scipy/scipy/issues/15568>`__: BENCH/CI: Benchmark timeout
* `#15572 <https://github.com/scipy/scipy/issues/15572>`__: BUG: \`scipy.spatial.transform.rotation\`, wrong deprecation...
* `#15575 <https://github.com/scipy/scipy/issues/15575>`__: BUG: Tests failing for initial build [arm64 machine]
* `#15589 <https://github.com/scipy/scipy/issues/15589>`__: BUG: scipy.special.factorialk docstring inconsistent with behaviour
* `#15601 <https://github.com/scipy/scipy/issues/15601>`__: BUG: Scalefactors for \`signal.csd\` with \`average=='median'\`...
* `#15617 <https://github.com/scipy/scipy/issues/15617>`__: ENH: stats: all multivariate distributions should be freezable
* `#15631 <https://github.com/scipy/scipy/issues/15631>`__: BUG: stats.fit: intermittent failure in doctest
* `#15635 <https://github.com/scipy/scipy/issues/15635>`__: CI:ASK: Remove LaTeX doc builds?
* `#15638 <https://github.com/scipy/scipy/issues/15638>`__: DEV: \`dev.py\` missing PYTHONPATH when building doc
* `#15644 <https://github.com/scipy/scipy/issues/15644>`__: DOC: stats.ks_1samp: incorrect commentary in examples
* `#15666 <https://github.com/scipy/scipy/issues/15666>`__: CI: CircleCI build_docs failure on main
* `#15670 <https://github.com/scipy/scipy/issues/15670>`__: BUG: AssertionError in test__dual_annealing.py in test_bounds_class
* `#15689 <https://github.com/scipy/scipy/issues/15689>`__: BUG: default value of shape parameter in fit method of rv_continuous...
* `#15692 <https://github.com/scipy/scipy/issues/15692>`__: CI: scipy.scipy (Main refguide_asv_check) failure in main
* `#15696 <https://github.com/scipy/scipy/issues/15696>`__: DOC: False information in docs - scipy.stats.ttest_1samp
* `#15700 <https://github.com/scipy/scipy/issues/15700>`__: BUG: AssertionError in test_propack.py
* `#15730 <https://github.com/scipy/scipy/issues/15730>`__: BUG: "terminate called after throwing an instance of 'std::out_of_range'"...
* `#15732 <https://github.com/scipy/scipy/issues/15732>`__: DEP: execute deprecation of inexact indices into sparse matrices
* `#15734 <https://github.com/scipy/scipy/issues/15734>`__: DEP: deal with deprecation of ndim >1 in bspline
* `#15735 <https://github.com/scipy/scipy/issues/15735>`__: DEP: add actual DeprecationWarning for sym_pos-keyword of scipy.linalg.solve
* `#15736 <https://github.com/scipy/scipy/issues/15736>`__: DEP: Remove \`debug\` keyword from \`scipy.linalg.solve_\*\`
* `#15737 <https://github.com/scipy/scipy/issues/15737>`__: DEP: Execute deprecation of pinv2
* `#15739 <https://github.com/scipy/scipy/issues/15739>`__: DEP: sharpen deprecation for >1-dim inputs in optimize.minimize
* `#15740 <https://github.com/scipy/scipy/issues/15740>`__: DEP: Execute deprecation for squeezing input vectors in spatial.distance
* `#15741 <https://github.com/scipy/scipy/issues/15741>`__: DEP: remove spatial.distance.matching
* `#15742 <https://github.com/scipy/scipy/issues/15742>`__: DEP: raise if fillvalue cannot be cast to output type in \`signal.convolve2d\`
@ -665,8 +738,10 @@ Issues closed for 1.9.0
* `#15762 <https://github.com/scipy/scipy/issues/15762>`__: DEP: remove stats.median_absolute_deviation
* `#15773 <https://github.com/scipy/scipy/issues/15773>`__: BUG: iirfilter allows Wn[1] < Wn[0] for band-pass and band-stop...
* `#15780 <https://github.com/scipy/scipy/issues/15780>`__: BUG: CI on Azure broken with PyTest 7.1
* `#15843 <https://github.com/scipy/scipy/issues/15843>`__: BUG: scipy.stats.brunnermunzel incorrectly returns nan for undocumented...
* `#15854 <https://github.com/scipy/scipy/issues/15854>`__: CI: Windows Meson job failing sometimes on OpenBLAS binary download
* `#15866 <https://github.com/scipy/scipy/issues/15866>`__: BUG/CI: Wrong python version used for tests labeled "Linux Tests...
* `#15871 <https://github.com/scipy/scipy/issues/15871>`__: BUG: stats: Test failure of \`TestTruncnorm.test_moments\` on...
* `#15899 <https://github.com/scipy/scipy/issues/15899>`__: BUG: _calc_uniform_order_statistic_medians documentation example...
* `#15927 <https://github.com/scipy/scipy/issues/15927>`__: BUG: Inconsistent handling of INF and NAN in signal.convolve
* `#15931 <https://github.com/scipy/scipy/issues/15931>`__: BUG: scipy/io/arff/tests/test_arffread.py::TestNoData::test_nodata...
@ -674,6 +749,7 @@ Issues closed for 1.9.0
* `#15961 <https://github.com/scipy/scipy/issues/15961>`__: BUG: scipy.stats.beta and bernoulli fails with float32 inputs
* `#15962 <https://github.com/scipy/scipy/issues/15962>`__: Race condition in macOS Meson build between \`_matfuncs_expm\`...
* `#15987 <https://github.com/scipy/scipy/issues/15987>`__: CI: \`np.matrix\` deprecation warning
* `#16007 <https://github.com/scipy/scipy/issues/16007>`__: BUG: Confusing documentation in \`ttest_ind_from_stats\`
* `#16011 <https://github.com/scipy/scipy/issues/16011>`__: BUG: typo in documentation for scipy.optimize.basinhopping
* `#16020 <https://github.com/scipy/scipy/issues/16020>`__: BUG: dev.py FileNotFoundError
* `#16027 <https://github.com/scipy/scipy/issues/16027>`__: jc should be (n-1)/2
@ -689,6 +765,29 @@ Issues closed for 1.9.0
* `#16219 <https://github.com/scipy/scipy/issues/16219>`__: \`TestSobol.test_0dim\` failure on 32-bit Linux job
* `#16233 <https://github.com/scipy/scipy/issues/16233>`__: BUG: Memory leak in function \`sf_error\` due to new reference...
* `#16254 <https://github.com/scipy/scipy/issues/16254>`__: DEP: add deprecation warning to \`maxiter\` kwarg in \`_minimize_tnc\`
* `#16292 <https://github.com/scipy/scipy/issues/16292>`__: BUG: compilation error: no matching constructor for initialization...
* `#16300 <https://github.com/scipy/scipy/issues/16300>`__: BLD: pip install build issue with meson in Ubuntu virtualenv
* `#16337 <https://github.com/scipy/scipy/issues/16337>`__: TST: stats/tests/test_axis_nan_policy.py::test_axis_nan_policy_full...
* `#16347 <https://github.com/scipy/scipy/issues/16347>`__: TST, MAINT: 32-bit Linux test failures in wheels repo
* `#16358 <https://github.com/scipy/scipy/issues/16358>`__: TST, MAINT: test_theilslopes_warnings fails on 32-bit Windows
* `#16378 <https://github.com/scipy/scipy/issues/16378>`__: DOC: pydata-sphinx-theme v0.9 defaults to darkmode depending...
* `#16381 <https://github.com/scipy/scipy/issues/16381>`__: BUG: bootstrap get ValueError for paired statistic
* `#16382 <https://github.com/scipy/scipy/issues/16382>`__: BUG: truncnorm.fit does not fit correctly
* `#16403 <https://github.com/scipy/scipy/issues/16403>`__: MAINT: NumPy main will require a few updates due to new floating...
* `#16409 <https://github.com/scipy/scipy/issues/16409>`__: BUG: SIGSEGV in qhull when array type is wrong
* `#16418 <https://github.com/scipy/scipy/issues/16418>`__: BUG: breaking change: scipy.stats.mode returned value has changed...
* `#16419 <https://github.com/scipy/scipy/issues/16419>`__: BUG: scipy.stats.nbinom.logcdf returns wrong results when some...
* `#16426 <https://github.com/scipy/scipy/issues/16426>`__: BUG: stats.shapiro inplace modification of user array
* `#16446 <https://github.com/scipy/scipy/issues/16446>`__: BUG: Issue with stripping on macOS Monterey + xcode 13.2
* `#16465 <https://github.com/scipy/scipy/issues/16465>`__: BLD: new sdist has some metadata issues
* `#16466 <https://github.com/scipy/scipy/issues/16466>`__: BUG: linprog failure - OptimizeResult.x returns NoneType
* `#16495 <https://github.com/scipy/scipy/issues/16495>`__: HiGHS does not compile on windows (on conda-forge infra)
* `#16523 <https://github.com/scipy/scipy/issues/16523>`__: BUG: test failure in pre-release job: \`TestFactorized.test_singular_with_umfpack\`
* `#16540 <https://github.com/scipy/scipy/issues/16540>`__: BLD: meson 0.63.0 and new CI testing failures on Linux
* `#16555 <https://github.com/scipy/scipy/issues/16555>`__: Building 1.9.x branch from source requires fix in meson-python...
* `#16609 <https://github.com/scipy/scipy/issues/16609>`__: BUG: \`scipy.optimize.linprog\` reports optimal for trivially...
* `#16681 <https://github.com/scipy/scipy/issues/16681>`__: BUG: linprog integrality only accepts list, not array
* `#16718 <https://github.com/scipy/scipy/issues/16718>`__: BUG: memoryview error with Cython 0.29.31
***********************
Pull requests for 1.9.0
@ -702,17 +801,20 @@ Pull requests for 1.9.0
* `#13955 <https://github.com/scipy/scipy/pull/13955>`__: DOC: SciPy extensions for code style and docstring guidelines.
* `#14003 <https://github.com/scipy/scipy/pull/14003>`__: DOC: clarify the definition of the pdf of \`stats.fisk\`
* `#14036 <https://github.com/scipy/scipy/pull/14036>`__: ENH: fix numerical issues in roots_jacobi and related special...
* `#14087 <https://github.com/scipy/scipy/pull/14087>`__: DOC: explain null hypotheses in ttest functions
* `#14142 <https://github.com/scipy/scipy/pull/14142>`__: DOC: Add better error message for unpacking issue
* `#14143 <https://github.com/scipy/scipy/pull/14143>`__: Support LinearOperator in expm_multiply
* `#14300 <https://github.com/scipy/scipy/pull/14300>`__: ENH: Adding DIRECT algorithm to \`\`scipy.optimize\`\`
* `#14576 <https://github.com/scipy/scipy/pull/14576>`__: ENH: stats: add one-sample Monte Carlo hypothesis test
* `#14642 <https://github.com/scipy/scipy/pull/14642>`__: ENH: add Lloyd's algorithm to \`scipy.spatial\` to improve a...
* `#14718 <https://github.com/scipy/scipy/pull/14718>`__: DOC: stats: adjust bootstrap doc to emphasize that batch controls...
* `#14781 <https://github.com/scipy/scipy/pull/14781>`__: BUG: stats: handle infinite \`df\` in \`t\` distribution
* `#14847 <https://github.com/scipy/scipy/pull/14847>`__: ENH: BLD: enable building SciPy with Meson
* `#14877 <https://github.com/scipy/scipy/pull/14877>`__: DOC: ndimage convolve origin documentation (#14745)
* `#15001 <https://github.com/scipy/scipy/pull/15001>`__: ENH: sparse.linalg: More comprehensive tests (Not only for 1-D...
* `#15026 <https://github.com/scipy/scipy/pull/15026>`__: ENH: allow approx_fprime to work with vector-valued func
* `#15079 <https://github.com/scipy/scipy/pull/15079>`__: ENH:linalg: expm overhaul and ndarray processing
* `#15140 <https://github.com/scipy/scipy/pull/15140>`__: ENH: Make \`stats.kappa3\` work with array inputs
* `#15154 <https://github.com/scipy/scipy/pull/15154>`__: DOC: a small bug in docstring example of \`lobpcg\`
* `#15165 <https://github.com/scipy/scipy/pull/15165>`__: MAINT: Avoid using del to remove numpy symbols in scipy.__init__.py
* `#15168 <https://github.com/scipy/scipy/pull/15168>`__: REL: set version to 1.9.0.dev0
@ -733,8 +835,10 @@ Pull requests for 1.9.0
* `#15223 <https://github.com/scipy/scipy/pull/15223>`__: DOC: x0->x for finite_diff_rel_step docstring closes #15208
* `#15230 <https://github.com/scipy/scipy/pull/15230>`__: ENH: expose submodules via \`__getattr__\` to allow lazy access
* `#15234 <https://github.com/scipy/scipy/pull/15234>`__: TST: stats: mark very slow tests as \`xslow\`
* `#15235 <https://github.com/scipy/scipy/pull/15235>`__: BUG: Fix rmul dispatch of spmatrix
* `#15243 <https://github.com/scipy/scipy/pull/15243>`__: DOC: stats: add reference for gstd
* `#15244 <https://github.com/scipy/scipy/pull/15244>`__: Added example for morphology: binary_dilation and erosion
* `#15250 <https://github.com/scipy/scipy/pull/15250>`__: ENH: Make \`stats.kappa4\` work with array
* `#15251 <https://github.com/scipy/scipy/pull/15251>`__: [MRG] ENH: Update \`laplacian\` function introducing the new...
* `#15255 <https://github.com/scipy/scipy/pull/15255>`__: MAINT: Remove \`distutils\` usage in \`runtests.py\` to fix deprecation...
* `#15259 <https://github.com/scipy/scipy/pull/15259>`__: MAINT: optimize, special, signal: Use custom warnings instead...
@ -749,6 +853,7 @@ Pull requests for 1.9.0
* `#15286 <https://github.com/scipy/scipy/pull/15286>`__: MAINT: Highs submodule CI issue - use shallow cloning
* `#15289 <https://github.com/scipy/scipy/pull/15289>`__: DOC: Misc numpydoc formatting.
* `#15291 <https://github.com/scipy/scipy/pull/15291>`__: DOC: some more docstring/numpydoc formatting.
* `#15294 <https://github.com/scipy/scipy/pull/15294>`__: ENH: add integrality constraints for linprog
* `#15300 <https://github.com/scipy/scipy/pull/15300>`__: DOC: Misc manual docs updates.
* `#15302 <https://github.com/scipy/scipy/pull/15302>`__: DOC: More docstring reformatting.
* `#15304 <https://github.com/scipy/scipy/pull/15304>`__: CI: fix Gitpod build by adding HiGHS submodule checkout
@ -839,6 +944,7 @@ Pull requests for 1.9.0
* `#15578 <https://github.com/scipy/scipy/pull/15578>`__: Make Windows Python setup more standard
* `#15581 <https://github.com/scipy/scipy/pull/15581>`__: MAINT: clarify deprecation warning spatial.transform.rotation
* `#15583 <https://github.com/scipy/scipy/pull/15583>`__: DOC: clarify O(N) SO(N) in random rotations
* `#15586 <https://github.com/scipy/scipy/pull/15586>`__: ENH: stats: Add 'alternative' and confidence interval to pearsonr
* `#15590 <https://github.com/scipy/scipy/pull/15590>`__: DOC: factorialk docstring inconsistent with code
* `#15597 <https://github.com/scipy/scipy/pull/15597>`__: DOC: update \`hyp2f1\` docstring example based on doctest
* `#15598 <https://github.com/scipy/scipy/pull/15598>`__: BUG/ENH: \`lsq_linear\`: fixed incorrect \`lsmr_tol\` in first...
@ -850,6 +956,7 @@ Pull requests for 1.9.0
* `#15625 <https://github.com/scipy/scipy/pull/15625>`__: MAINT: Clean up \`type: ignore\` comments related to third-party...
* `#15626 <https://github.com/scipy/scipy/pull/15626>`__: TST, MAINT: ignore np distutils dep
* `#15629 <https://github.com/scipy/scipy/pull/15629>`__: MAINT: stats: fix \`trim1\` \`axis\` behavior
* `#15632 <https://github.com/scipy/scipy/pull/15632>`__: ENH: stats.wilcoxon: return z-statistic (as requested)
* `#15634 <https://github.com/scipy/scipy/pull/15634>`__: CI: Improve concurrency to cancel running jobs on PR update
* `#15645 <https://github.com/scipy/scipy/pull/15645>`__: DOC: Add code example to the documentation of \`sparse.linalg.cg\`.
* `#15646 <https://github.com/scipy/scipy/pull/15646>`__: DOC: stats.ks_1samp: correct examples
@ -857,6 +964,7 @@ Pull requests for 1.9.0
* `#15648 <https://github.com/scipy/scipy/pull/15648>`__: DOC: Add examples to documentation for \`scipy.special.ellipr{c,d,f,g,j}\`
* `#15649 <https://github.com/scipy/scipy/pull/15649>`__: DEV/DOC: remove latex/pdf documentation
* `#15651 <https://github.com/scipy/scipy/pull/15651>`__: DOC: stats.ks_2samp/stats.kstest: correct examples
* `#15652 <https://github.com/scipy/scipy/pull/15652>`__: DOC: stats.circstd: add reference, notes, comments
* `#15655 <https://github.com/scipy/scipy/pull/15655>`__: REL: fix small issue in pavement.py for release note writing
* `#15656 <https://github.com/scipy/scipy/pull/15656>`__: DOC: Fix example for subset_by_index in eigh doc
* `#15661 <https://github.com/scipy/scipy/pull/15661>`__: DOC: Additional examples for optimize user guide
@ -875,6 +983,7 @@ Pull requests for 1.9.0
* `#15712 <https://github.com/scipy/scipy/pull/15712>`__: ENH: \`scipy.stats.qmc.Sobol\`: allow 32 or 64 bit computation
* `#15715 <https://github.com/scipy/scipy/pull/15715>`__: ENH: stats: add _axis_nan_policy_factory to moment
* `#15718 <https://github.com/scipy/scipy/pull/15718>`__: ENH: Migration of \`write_release_and_log\` into standalone script
* `#15723 <https://github.com/scipy/scipy/pull/15723>`__: TST: stats: make \`check_sample_var\` two-sided
* `#15724 <https://github.com/scipy/scipy/pull/15724>`__: TST: stats: simplify \`check_sample_mean\`
* `#15725 <https://github.com/scipy/scipy/pull/15725>`__: DEV: Try to detect scipy from dev installed path
* `#15728 <https://github.com/scipy/scipy/pull/15728>`__: ENH: changed vague exception messages to a more descriptive ones...
@ -883,10 +992,12 @@ Pull requests for 1.9.0
* `#15766 <https://github.com/scipy/scipy/pull/15766>`__: BUG: improve exceptions for private attributes in refactored...
* `#15768 <https://github.com/scipy/scipy/pull/15768>`__: [DOC] fix typo in cython optimize help example
* `#15769 <https://github.com/scipy/scipy/pull/15769>`__: MAINT: stats: check integrality in \`_argcheck\` as needed
* `#15771 <https://github.com/scipy/scipy/pull/15771>`__: MAINT: stats: resolve discrete rvs dtype platform dependency
* `#15774 <https://github.com/scipy/scipy/pull/15774>`__: MAINT: stats: remove deprecated \`median_absolute_deviation\`
* `#15775 <https://github.com/scipy/scipy/pull/15775>`__: DOC: stats.lognorm: rephrase note about parameterization
* `#15776 <https://github.com/scipy/scipy/pull/15776>`__: DOC: stats.powerlaw: more explicit explanation of support
* `#15777 <https://github.com/scipy/scipy/pull/15777>`__: MAINT: stats.shapiro: subtract median from shapiro input
* `#15778 <https://github.com/scipy/scipy/pull/15778>`__: MAINT: stats: more specific error type from \`rv_continuous.fit\`
* `#15779 <https://github.com/scipy/scipy/pull/15779>`__: CI: don't run meson tests on forks and remove skip flags
* `#15782 <https://github.com/scipy/scipy/pull/15782>`__: DEPR: remove k=None in KDTree.query
* `#15783 <https://github.com/scipy/scipy/pull/15783>`__: CI:Pin pytest version to 7.0.1 on Azure
@ -923,6 +1034,7 @@ Pull requests for 1.9.0
* `#15840 <https://github.com/scipy/scipy/pull/15840>`__: DOC: special: Add 'Examples' for wrightomega.
* `#15842 <https://github.com/scipy/scipy/pull/15842>`__: DOC: Add examples for \`CGS\`, \`GCROTMK\` and \`BiCGSTAB\` iterative...
* `#15846 <https://github.com/scipy/scipy/pull/15846>`__: DOC: Add efficiency condition for CSC sparse matrix and remove...
* `#15847 <https://github.com/scipy/scipy/pull/15847>`__: BUG: adds warning to scipy.stats.brunnermunzel
* `#15848 <https://github.com/scipy/scipy/pull/15848>`__: DOC: fix interp2d docs showing wrong Z array ordering.
* `#15850 <https://github.com/scipy/scipy/pull/15850>`__: MAINT: sparse.linalg: Missing tfqmr in the re-entrancy test
* `#15853 <https://github.com/scipy/scipy/pull/15853>`__: DEP: remove the keyword debug from linalg.solve
@ -940,6 +1052,7 @@ Pull requests for 1.9.0
* `#15887 <https://github.com/scipy/scipy/pull/15887>`__: DEP: remove ftol/xtol from neldermead
* `#15894 <https://github.com/scipy/scipy/pull/15894>`__: [BUG] make p-values consistent with the literature
* `#15895 <https://github.com/scipy/scipy/pull/15895>`__: CI: remove pin on Jinja2
* `#15898 <https://github.com/scipy/scipy/pull/15898>`__: DOC: stats: correct documentation of \`wilcoxon\`'s behavior...
* `#15900 <https://github.com/scipy/scipy/pull/15900>`__: DOC: fix import in example in _morestats
* `#15905 <https://github.com/scipy/scipy/pull/15905>`__: MAINT: stats._moment: warn when catastrophic cancellation occurs
* `#15909 <https://github.com/scipy/scipy/pull/15909>`__: DEP: deal with deprecation of ndim >1 in bspline
@ -947,6 +1060,7 @@ Pull requests for 1.9.0
* `#15914 <https://github.com/scipy/scipy/pull/15914>`__: MAINT: special: Clean up C style in ndtr.c
* `#15916 <https://github.com/scipy/scipy/pull/15916>`__: MAINT: stats: adjust tolerance of failing TestTruncnorm
* `#15917 <https://github.com/scipy/scipy/pull/15917>`__: MAINT: stats: remove support for \`_rvs\` without \`size\` parameter
* `#15920 <https://github.com/scipy/scipy/pull/15920>`__: ENH: stats.mannwhitneyu: add iterative implementation
* `#15923 <https://github.com/scipy/scipy/pull/15923>`__: MAINT: stats: attempt to consolidate warnings and errors
* `#15932 <https://github.com/scipy/scipy/pull/15932>`__: MAINT: stats: fix and thoroughly test \`rv_sample\` at non-integer...
* `#15933 <https://github.com/scipy/scipy/pull/15933>`__: TST: test_nodata respect endianness
@ -956,15 +1070,19 @@ Pull requests for 1.9.0
* `#15946 <https://github.com/scipy/scipy/pull/15946>`__: DEP: remove inheritance to \`QMCEngine\` in \`MultinomialQMC\`...
* `#15947 <https://github.com/scipy/scipy/pull/15947>`__: DOC: Revamp contributor setup guides
* `#15953 <https://github.com/scipy/scipy/pull/15953>`__: DOC: Add meson docs to use gcc, clang build in parallel and optimization...
* `#15955 <https://github.com/scipy/scipy/pull/15955>`__: BUG Fix signature of D_IIR_forback(1,2)
* `#15959 <https://github.com/scipy/scipy/pull/15959>`__: ENH: Developer CLI for SciPy
* `#15965 <https://github.com/scipy/scipy/pull/15965>`__: MAINT: stats: ensure that \`rv_continuous._fitstart\` shapes...
* `#15968 <https://github.com/scipy/scipy/pull/15968>`__: BUG: Fix debug and coverage arguments with dev.py
* `#15970 <https://github.com/scipy/scipy/pull/15970>`__: BLD: specify \`cython_lapack\` dependency for \`matfuncs_expm\`
* `#15973 <https://github.com/scipy/scipy/pull/15973>`__: DOC: Add formula renderings to integrate.nquad.
* `#15981 <https://github.com/scipy/scipy/pull/15981>`__: ENH: optimize: Add Newton-TFQMR method and some tests for Newton-Krylov
* `#15982 <https://github.com/scipy/scipy/pull/15982>`__: BENCH: stats: Distribution memory and CDF/PPF round trip benchmarks
* `#15983 <https://github.com/scipy/scipy/pull/15983>`__: TST: sparse.linalg: Add tests for the parameter \`show\`
* `#15991 <https://github.com/scipy/scipy/pull/15991>`__: TST: fix for np.kron matrix issue.
* `#15992 <https://github.com/scipy/scipy/pull/15992>`__: DOC: Fixed \`degrees\` parameter in return section
* `#15997 <https://github.com/scipy/scipy/pull/15997>`__: MAINT: integrate: add \`recursive\` to QUADPACK Fortran sources
* `#15998 <https://github.com/scipy/scipy/pull/15998>`__: BUG: Fix yeojohnson when transformed data has zero variance
* `#15999 <https://github.com/scipy/scipy/pull/15999>`__: MAINT: Adds doit.db.db to gitignore
* `#16004 <https://github.com/scipy/scipy/pull/16004>`__: MAINT: rename MaximumFlowResult.residual to flow
* `#16005 <https://github.com/scipy/scipy/pull/16005>`__: DOC: sparse.linalg: Fixed the description of input matrix of...
@ -977,6 +1095,7 @@ Pull requests for 1.9.0
* `#16024 <https://github.com/scipy/scipy/pull/16024>`__: CI: unpin pytest and pytest-xdist
* `#16026 <https://github.com/scipy/scipy/pull/16026>`__: BUG: Allow \`spsolve_triangular\` to work with matrices with...
* `#16029 <https://github.com/scipy/scipy/pull/16029>`__: BUG: Fix meson-info file errors and add more informative exception
* `#16030 <https://github.com/scipy/scipy/pull/16030>`__: MAINT: stats: more accurate error message for \`multivariate_normal\`
* `#16032 <https://github.com/scipy/scipy/pull/16032>`__: FIX: show warning when passing NAN into input of convolve method
* `#16037 <https://github.com/scipy/scipy/pull/16037>`__: MAINT: fix missing \`f\` prefix on f-strings
* `#16042 <https://github.com/scipy/scipy/pull/16042>`__: MAINT: stats.dirichlet: fix interface inconsistency
@ -984,6 +1103,7 @@ Pull requests for 1.9.0
* `#16045 <https://github.com/scipy/scipy/pull/16045>`__: ENH: Use circleci-artifacts-redirector-action
* `#16051 <https://github.com/scipy/scipy/pull/16051>`__: MAINT: Miscellaneous small changes to filter_design
* `#16053 <https://github.com/scipy/scipy/pull/16053>`__: Mark fitpack sources as \`recursive\`
* `#16055 <https://github.com/scipy/scipy/pull/16055>`__: MAINT: stats: replace \`np.var\` with \`_moment(..., 2)\` to...
* `#16058 <https://github.com/scipy/scipy/pull/16058>`__: DEV: Fix meson debian python build
* `#16060 <https://github.com/scipy/scipy/pull/16060>`__: MAINT: Allow all Latin-1 Unicode letters in the source code.
* `#16062 <https://github.com/scipy/scipy/pull/16062>`__: DOC: Document QUADPACK routines used in \`\*quad\`
@ -1039,8 +1159,10 @@ Pull requests for 1.9.0
* `#16230 <https://github.com/scipy/scipy/pull/16230>`__: BUG: fix extension module initialization, needs use of PyMODINIT_FUNC,...
* `#16239 <https://github.com/scipy/scipy/pull/16239>`__: MAINT: tools: Add more output to a refguide-check error message.
* `#16241 <https://github.com/scipy/scipy/pull/16241>`__: DOC: stats: update roadmap
* `#16242 <https://github.com/scipy/scipy/pull/16242>`__: BUG: Make KDTree more robust against nans.
* `#16245 <https://github.com/scipy/scipy/pull/16245>`__: DEP: Execute deprecation of pinv2
* `#16247 <https://github.com/scipy/scipy/pull/16247>`__: DOC:linalg: Remove references to removed pinv2 function
* `#16248 <https://github.com/scipy/scipy/pull/16248>`__: DOC: prep 1.9.0 release notes
* `#16249 <https://github.com/scipy/scipy/pull/16249>`__: Refguide check verbosity abs names
* `#16257 <https://github.com/scipy/scipy/pull/16257>`__: DEP: Deprecation follow-ups
* `#16259 <https://github.com/scipy/scipy/pull/16259>`__: Revert "CI: pin Pip to 22.0.4 to avoid issues with \`--no-build-isolation\`"
@ -1062,3 +1184,59 @@ Pull requests for 1.9.0
* `#16304 <https://github.com/scipy/scipy/pull/16304>`__: MAINT: add a more informative error message for broken installs
* `#16309 <https://github.com/scipy/scipy/pull/16309>`__: BLD: CI: fix issue in wheel metadata, and add basic "build in...
* `#16316 <https://github.com/scipy/scipy/pull/16316>`__: REL: update version switcher for 1.8.1
* `#16321 <https://github.com/scipy/scipy/pull/16321>`__: DOC: fix incorrect formatting of deprecation tags
* `#16326 <https://github.com/scipy/scipy/pull/16326>`__: REL: update version switcher for 1.9
* `#16329 <https://github.com/scipy/scipy/pull/16329>`__: MAINT: git security shim for 1.9.x
* `#16339 <https://github.com/scipy/scipy/pull/16339>`__: MAINT, TST: bump tol for _axis_nan_policy_test
* `#16341 <https://github.com/scipy/scipy/pull/16341>`__: BLD: update Pythran requirement to 0.11.0, to support Clang >=13
* `#16353 <https://github.com/scipy/scipy/pull/16353>`__: MAINT: version bounds 1.9.0rc1
* `#16360 <https://github.com/scipy/scipy/pull/16360>`__: MAINT, TST: sup warning for theilslopes
* `#16361 <https://github.com/scipy/scipy/pull/16361>`__: MAINT: SCIPY_USE_PROPACK
* `#16370 <https://github.com/scipy/scipy/pull/16370>`__: MAINT: update Boost submodule to include Cygwin fix
* `#16374 <https://github.com/scipy/scipy/pull/16374>`__: MAINT: update pydata-sphinx-theme
* `#16379 <https://github.com/scipy/scipy/pull/16379>`__: DOC: dark theme css adjustments
* `#16390 <https://github.com/scipy/scipy/pull/16390>`__: TST, MAINT: adjust 32-bit xfails for HiGHS
* `#16393 <https://github.com/scipy/scipy/pull/16393>`__: MAINT: use correct type for element wise comparison
* `#16414 <https://github.com/scipy/scipy/pull/16414>`__: BUG: spatial: Handle integer arrays in HalfspaceIntersection.
* `#16420 <https://github.com/scipy/scipy/pull/16420>`__: MAINT: next round of 1.9.0 backports
* `#16422 <https://github.com/scipy/scipy/pull/16422>`__: TST: fix test issues with casting-related warnings with numpy...
* `#16427 <https://github.com/scipy/scipy/pull/16427>`__: MAINT: stats.shapiro: don't modify input in place
* `#16429 <https://github.com/scipy/scipy/pull/16429>`__: MAINT: stats.mode: revert gh-15423
* `#16436 <https://github.com/scipy/scipy/pull/16436>`__: DOC: optimize: Mark deprecated linprog methods explicitly
* `#16444 <https://github.com/scipy/scipy/pull/16444>`__: BUG: fix fail to open tempfile in messagestream.pyx (#8850)
* `#16451 <https://github.com/scipy/scipy/pull/16451>`__: MAINT: few more 1.9.0 backports
* `#16453 <https://github.com/scipy/scipy/pull/16453>`__: DOC: Copy-edit 1.9.0-notes.rst
* `#16457 <https://github.com/scipy/scipy/pull/16457>`__: TST: skip 32-bit test_pdist_correlation_iris_nonC
* `#16458 <https://github.com/scipy/scipy/pull/16458>`__: MAINT: 1.9.0 backports
* `#16473 <https://github.com/scipy/scipy/pull/16473>`__: REL: update 1.9.0 release notes
* `#16482 <https://github.com/scipy/scipy/pull/16482>`__: DOC: Update Returns section of optimize.linprog.
* `#16484 <https://github.com/scipy/scipy/pull/16484>`__: MAINT: remove raw html from README.rst
* `#16485 <https://github.com/scipy/scipy/pull/16485>`__: BLD: fix warnings from f2py templating parsing
* `#16493 <https://github.com/scipy/scipy/pull/16493>`__: BLD: clean up unwanted files in sdist, via \`.gitattributes\`
* `#16507 <https://github.com/scipy/scipy/pull/16507>`__: REL: more tweaks to sdist contents
* `#16512 <https://github.com/scipy/scipy/pull/16512>`__: [1.9] MAINT: skip complex128 propack tests on windows
* `#16514 <https://github.com/scipy/scipy/pull/16514>`__: DOC: reflect correctly where windows wheels are built
* `#16526 <https://github.com/scipy/scipy/pull/16526>`__: MAINT: 1.9.0rc2 backports
* `#16530 <https://github.com/scipy/scipy/pull/16530>`__: MAINT: fix umfpack test failure with numpy 1.23
* `#16539 <https://github.com/scipy/scipy/pull/16539>`__: MAINT: more 1.9.0rc2 backports
* `#16541 <https://github.com/scipy/scipy/pull/16541>`__: BLD: fix regression in building _lsap with symbol visibility
* `#16549 <https://github.com/scipy/scipy/pull/16549>`__: BLD: fix an outdated requirement for macOS arm64 in pyproject.toml
* `#16551 <https://github.com/scipy/scipy/pull/16551>`__: BLD: fix \`__STDC_VERSION__\` check in \`special/_round.h\`
* `#16553 <https://github.com/scipy/scipy/pull/16553>`__: BLD: raise an error with clear message for too-new Python version
* `#16556 <https://github.com/scipy/scipy/pull/16556>`__: DOC: small tweaks to 1.9.0 release notes
* `#16563 <https://github.com/scipy/scipy/pull/16563>`__: DOC: Reflect MSVC minimum toolchain requirement
* `#16570 <https://github.com/scipy/scipy/pull/16570>`__: MAINT: backports before 1.9.0rc3
* `#16572 <https://github.com/scipy/scipy/pull/16572>`__: MAINT: update bundled licenses for removal of scipy-sphinx-theme
* `#16581 <https://github.com/scipy/scipy/pull/16581>`__: MAINT: stats: fix skew/kurtosis empty 1d input
* `#16586 <https://github.com/scipy/scipy/pull/16586>`__: MAINT: stats.truncnorm: improve CDF accuracy/speed
* `#16593 <https://github.com/scipy/scipy/pull/16593>`__: TST: stats: replace TestTruncnorm::test_moments
* `#16599 <https://github.com/scipy/scipy/pull/16599>`__: MAINT: stats.truncnorm.rvs: improve performance
* `#16605 <https://github.com/scipy/scipy/pull/16605>`__: MAINT: stats.truncnorm: simplify remaining methods
* `#16622 <https://github.com/scipy/scipy/pull/16622>`__: ENH: FIX: update HiGHS submodule to resolve MIP infeasibility...
* `#16638 <https://github.com/scipy/scipy/pull/16638>`__: DOC: update docs on building with Meson
* `#16664 <https://github.com/scipy/scipy/pull/16664>`__: MAINT: stats._axis_nan_policy: preserve dtype of masked arrays...
* `#16671 <https://github.com/scipy/scipy/pull/16671>`__: BLD: update \`meson\` and \`meson-python\` versions for 1.9.0...
* `#16684 <https://github.com/scipy/scipy/pull/16684>`__: MAINT: optimize.linprog: ensure integrality can be an array
* `#16688 <https://github.com/scipy/scipy/pull/16688>`__: DOC: a few mailmap updates
* `#16719 <https://github.com/scipy/scipy/pull/16719>`__: MAINT: stats: Work around Cython bug.
* `#16721 <https://github.com/scipy/scipy/pull/16721>`__: MAINT: stats.monte_carlo_test: used biased estimate of p-value

View File

@ -0,0 +1,53 @@
==========================
SciPy 1.9.1 Release Notes
==========================
.. contents::
SciPy 1.9.1 is a bug-fix release with no new features
compared to 1.9.0. Notably, some important meson build
fixes are included.
Authors
=======
* Anirudh Dagar (1)
* Ralf Gommers (12)
* Matt Haberland (2)
* Andrew Nelson (1)
* Tyler Reddy (14)
* Atsushi Sakai (1)
* Eli Schwartz (1)
* Warren Weckesser (2)
A total of 8 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.9.1
-----------------------
* `#14517 <https://github.com/scipy/scipy/issues/14517>`__: scipy/linalg/tests/test_decomp.py::TestSchur::test_sort test...
* `#16765 <https://github.com/scipy/scipy/issues/16765>`__: DOC: \`scipy.stats.skew\` no longer returns 0 on constant input
* `#16787 <https://github.com/scipy/scipy/issues/16787>`__: BUG: Can't build 1.10 with mingw-w64 toolchain and numpy 1.21.6...
* `#16813 <https://github.com/scipy/scipy/issues/16813>`__: BUG: scipy.interpolate interp1d extrapolate behaviour change...
* `#16878 <https://github.com/scipy/scipy/issues/16878>`__: BUG: optimize.milp fails to execute when given exactly 3 constraints
Pull requests for 1.9.1
-----------------------
* `#16709 <https://github.com/scipy/scipy/pull/16709>`__: BLD: make the way we count commits for version numbering more...
* `#16736 <https://github.com/scipy/scipy/pull/16736>`__: REL: prep for SciPy 1.9.1
* `#16749 <https://github.com/scipy/scipy/pull/16749>`__: BLD: install missing \`.pxd\` files, and update TODOs/FIXMEs...
* `#16750 <https://github.com/scipy/scipy/pull/16750>`__: BLD: make OpenBLAS detection work with CMake
* `#16755 <https://github.com/scipy/scipy/pull/16755>`__: TST: sparse.linalg: Loosen tolerance for the lobpcg test 'test_tolerance_float32'
* `#16760 <https://github.com/scipy/scipy/pull/16760>`__: BLD: use a bit more idiomatic approach to constructing paths...
* `#16768 <https://github.com/scipy/scipy/pull/16768>`__: DOC: stats.skew/kurtosis: returns NaN when input has only one...
* `#16794 <https://github.com/scipy/scipy/pull/16794>`__: BLD/REL: on Windows use numpy 1.22.3 as the version to build...
* `#16822 <https://github.com/scipy/scipy/pull/16822>`__: BUG/TST: linalg: Check the results of 'schur' more carefully.
* `#16825 <https://github.com/scipy/scipy/pull/16825>`__: BUG: interpolate: fix "previous" and "next" extrapolate logic...
* `#16862 <https://github.com/scipy/scipy/pull/16862>`__: BUG, DOC: Fix sphinx autosummary generation for \`odr\` and \`czt\`
* `#16881 <https://github.com/scipy/scipy/pull/16881>`__: MAINT: optimize.milp: fix input validation when three constraints...
* `#16901 <https://github.com/scipy/scipy/pull/16901>`__: MAINT: 1.9.1 backports
* `#16904 <https://github.com/scipy/scipy/pull/16904>`__: BLD: update dependency ranges for meson-python and pybind11 for...

View File

@ -0,0 +1,71 @@
==========================
SciPy 1.9.2 Release Notes
==========================
.. contents::
SciPy 1.9.2 is a bug-fix release with no new features
compared to 1.9.1. It also provides wheel for Python 3.11
on several platforms.
Authors
=======
* Hood Chatham (1)
* Thomas J. Fan (1)
* Ralf Gommers (22)
* Matt Haberland (5)
* Julien Jerphanion (1)
* Loïc Estève (1)
* Nicholas McKibben (2)
* Naoto Mizuno (1)
* Andrew Nelson (3)
* Tyler Reddy (28)
* Pamphile Roy (1)
* Ewout ter Hoeven (2)
* Warren Weckesser (1)
* Meekail Zain (1) +
A total of 14 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.9.2
-----------------------
* `#16545 <https://github.com/scipy/scipy/issues/16545>`__: BUG: 1.9.0rc1: \`OptimizeResult\` not populated when \`optimize.milp\`...
* `#16569 <https://github.com/scipy/scipy/issues/16569>`__: BUG: \`sparse.hstack\` returns incorrect result when the stack...
* `#16898 <https://github.com/scipy/scipy/issues/16898>`__: BUG: optimize.minimize backwards compatability in scipy 1.9
* `#16935 <https://github.com/scipy/scipy/issues/16935>`__: BUG: using msvc + meson to build scipy --> cl cannot be used...
* `#16952 <https://github.com/scipy/scipy/issues/16952>`__: BUG: error from \`scipy.stats.mode\` with \`NaN\`s, \`axis !=...
* `#16964 <https://github.com/scipy/scipy/issues/16964>`__: BUG: scipy 1.7.3 wheels on PyPI require numpy<1.23 in contradiction...
* `#17026 <https://github.com/scipy/scipy/issues/17026>`__: BUG: ncf_gen::ppf(..) causes segfault
* `#17050 <https://github.com/scipy/scipy/issues/17050>`__: Pearson3 PPF does not function properly with negative skew.
* `#17124 <https://github.com/scipy/scipy/issues/17124>`__: BUG: OSX-64 Test failure test_ppf_against_tables getting NaN
Pull requests for 1.9.2
-----------------------
* `#16628 <https://github.com/scipy/scipy/pull/16628>`__: FIX: Updated dtype resolution in \`_stack_along_minor_axis\`
* `#16814 <https://github.com/scipy/scipy/pull/16814>`__: FIX: milp: return feasible solutions if available on time out
* `#16842 <https://github.com/scipy/scipy/pull/16842>`__: ENH: cibuildwheel infrastructure
* `#16909 <https://github.com/scipy/scipy/pull/16909>`__: MAINT: minimize, restore squeezed ((1.0)) addresses #16898
* `#16911 <https://github.com/scipy/scipy/pull/16911>`__: REL: prep for SciPy 1.9.2
* `#16922 <https://github.com/scipy/scipy/pull/16922>`__: DOC: update version switcher for 1.9.1 and pin theme to 0.9
* `#16934 <https://github.com/scipy/scipy/pull/16934>`__: MAINT: cast \`linear_sum_assignment\` to PyCFunction
* `#16943 <https://github.com/scipy/scipy/pull/16943>`__: BLD: use compiler flags in a more portable way
* `#16954 <https://github.com/scipy/scipy/pull/16954>`__: MAINT: stats.mode: fix bug with \`axis!=1\`, \`nan_policy='omit'\`,...
* `#16966 <https://github.com/scipy/scipy/pull/16966>`__: MAINT: fix NumPy upper bound
* `#16969 <https://github.com/scipy/scipy/pull/16969>`__: BLD: fix usage of \`get_install_data\`, which defaults to purelib
* `#16975 <https://github.com/scipy/scipy/pull/16975>`__: DOC: Update numpy supported versions for 1.9.2
* `#16991 <https://github.com/scipy/scipy/pull/16991>`__: BLD: fixes for building with MSVC and Intel Fortran
* `#17011 <https://github.com/scipy/scipy/pull/17011>`__: Rudimentary test for manylinux_aarch64 with cibuildwheel
* `#17013 <https://github.com/scipy/scipy/pull/17013>`__: BLD: make MKL detection a little more robust, add notes on TODOs
* `#17046 <https://github.com/scipy/scipy/pull/17046>`__: CI: Update cibuildwheel to 2.10.1
* `#17055 <https://github.com/scipy/scipy/pull/17055>`__: MAINT: stats.pearson3: fix ppf for negative skew
* `#17064 <https://github.com/scipy/scipy/pull/17064>`__: BUG: Fix numerical precision error of \`truncnorm.logcdf\` when...
* `#17096 <https://github.com/scipy/scipy/pull/17096>`__: FIX: ensure a hold on GIL before raising warnings/errors
* `#17127 <https://github.com/scipy/scipy/pull/17127>`__: TST: stats.studentized_range: fix incorrect test
* `#17131 <https://github.com/scipy/scipy/pull/17131>`__: MAINT: pyproject.toml: Update build system requirements
* `#17132 <https://github.com/scipy/scipy/pull/17132>`__: MAINT: 1.9.2 backports

122
doc/release/1.9.3-notes.rst Normal file
View File

@ -0,0 +1,122 @@
==========================
SciPy 1.9.3 Release Notes
==========================
.. contents::
SciPy 1.9.3 is a bug-fix release with no new features
compared to 1.9.2.
Authors
=======
* Jelle Aalbers (1)
* Peter Bell (1)
* Jake Bowhay (3)
* Matthew Brett (3)
* Evgeni Burovski (5)
* drpeteb (1) +
* Sebastian Ehlert (1) +
* GavinZhang (1) +
* Ralf Gommers (2)
* Matt Haberland (15)
* Lakshaya Inani (1) +
* Joseph T. Iosue (1)
* Nathan Jacobi (1) +
* jmkuebler (1) +
* Nikita Karetnikov (1) +
* Lechnio (1) +
* Nicholas McKibben (1)
* Andrew Nelson (1)
* o-alexandre-felipe (1) +
* Tirth Patel (1)
* Tyler Reddy (51)
* Martin Reinecke (1)
* Marie Roald (1) +
* Pamphile Roy (2)
* Eli Schwartz (1)
* serge-sans-paille (1)
* ehsan shirvanian (1) +
* Mamoru TASAKA (1) +
* Samuel Wallan (1)
* Warren Weckesser (7)
* Gavin Zhang (1) +
A total of 31 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.9.3
-----------------------
* `#3691 <https://github.com/scipy/scipy/issues/3691>`__: scipy.interpolate.UnivariateSpline segfault
* `#5286 <https://github.com/scipy/scipy/issues/5286>`__: BUG: multivariate_normal returns a pdf for values outside its...
* `#6551 <https://github.com/scipy/scipy/issues/6551>`__: BUG: stats: inconsistency in docs and behavior of gmean and hmean
* `#9245 <https://github.com/scipy/scipy/issues/9245>`__: running scipy.interpolate.tests.test_fitpack::test_bisplev_integer_overflow...
* `#12471 <https://github.com/scipy/scipy/issues/12471>`__: test_bisplev_integer_overflow: Segmentation fault (core dumped)
* `#13321 <https://github.com/scipy/scipy/issues/13321>`__: Bug: setting iprint=0 hides all output from fmin_l_bfgs_b, but...
* `#13730 <https://github.com/scipy/scipy/issues/13730>`__: \`scipy.stats.mood\` does not correct for ties
* `#14019 <https://github.com/scipy/scipy/issues/14019>`__: ks_2samp throws \`RuntimeWarning: overflow encountered in double_scalars\`
* `#14589 <https://github.com/scipy/scipy/issues/14589>`__: \`shgo\` error since scipy 1.8.0.dev0+1529.803e52d
* `#14591 <https://github.com/scipy/scipy/issues/14591>`__: Input data validation for RectSphereBivariateSpline
* `#15101 <https://github.com/scipy/scipy/issues/15101>`__: BUG: binom.pmf - RuntimeWarning: divide by zero
* `#15342 <https://github.com/scipy/scipy/issues/15342>`__: BUG: scipy.optimize.minimize: Powell's method function evaluated...
* `#15964 <https://github.com/scipy/scipy/issues/15964>`__: BUG: lombscargle fails if argument is a view
* `#16211 <https://github.com/scipy/scipy/issues/16211>`__: BUG: Possible bug when using winsorize on pandas data instead...
* `#16459 <https://github.com/scipy/scipy/issues/16459>`__: BUG: stats.ttest_ind returns wrong p-values with permutations
* `#16500 <https://github.com/scipy/scipy/issues/16500>`__: odr.Model default meta value fails with __getattr__
* `#16519 <https://github.com/scipy/scipy/issues/16519>`__: BUG: Error in error message for incorrect sample dimension in...
* `#16527 <https://github.com/scipy/scipy/issues/16527>`__: BUG: dimension of isuppz in syevr is mistranslated
* `#16600 <https://github.com/scipy/scipy/issues/16600>`__: BUG: \`KDTree\`'s optional argument \`eps\` seems to have no...
* `#16656 <https://github.com/scipy/scipy/issues/16656>`__: dtype not preserved with operations on sparse arrays
* `#16751 <https://github.com/scipy/scipy/issues/16751>`__: BUG: \`stats.fit\` on \`boltzmann\` expects \`bound\` for \`lambda\`,...
* `#17012 <https://github.com/scipy/scipy/issues/17012>`__: BUG: Small oversight in sparse.linalg.lsmr?
* `#17020 <https://github.com/scipy/scipy/issues/17020>`__: BUG: Build failure due to problems with shebang line in cythoner.py
* `#17088 <https://github.com/scipy/scipy/issues/17088>`__: BUG: stats.rayleigh.fit: returns \`loc\` that is inconsistent...
* `#17104 <https://github.com/scipy/scipy/issues/17104>`__: BUG? Incorrect branch in \`LAMV\` / \`_specfunc.lamv\`
* `#17196 <https://github.com/scipy/scipy/issues/17196>`__: DOC: keepdims in stats.mode is incorrectly documented
Pull requests for 1.9.3
-----------------------
* `#5288 <https://github.com/scipy/scipy/pull/5288>`__: BUG: multivariate_normal returns a pdf for values outside its...
* `#13322 <https://github.com/scipy/scipy/pull/13322>`__: Bug: setting iprint=0 hides all output from fmin_l_bfgs_b, but...
* `#13349 <https://github.com/scipy/scipy/pull/13349>`__: BUG: stats: Reformulate loggamma._rvs to handle c << 1.
* `#13411 <https://github.com/scipy/scipy/pull/13411>`__: BUG: fix out-of-bound evaluations in optimize.minimize, powell...
* `#15363 <https://github.com/scipy/scipy/pull/15363>`__: BUG: fix powell evaluated outside limits
* `#15381 <https://github.com/scipy/scipy/pull/15381>`__: BUG: fix stats.rv_histogram for non-uniform bins
* `#16212 <https://github.com/scipy/scipy/pull/16212>`__: stats.mood: correct for when ties are present
* `#16288 <https://github.com/scipy/scipy/pull/16288>`__: BUG: fix a crash in \`fpknot\`
* `#16318 <https://github.com/scipy/scipy/pull/16318>`__: MAINT: stats: fix _contains_nan on Pandas Series
* `#16460 <https://github.com/scipy/scipy/pull/16460>`__: Fix ttest permutations
* `#16506 <https://github.com/scipy/scipy/pull/16506>`__: MAINT: fix SHGO extra arguments
* `#16521 <https://github.com/scipy/scipy/pull/16521>`__: BUG: Fix error in error message for incorrect sample dimension...
* `#16525 <https://github.com/scipy/scipy/pull/16525>`__: MAINT: stats.ks_2samp: always emit warning when exact method...
* `#16528 <https://github.com/scipy/scipy/pull/16528>`__: BUG: fix syevr series segfault by explicitly specifying operator...
* `#16562 <https://github.com/scipy/scipy/pull/16562>`__: BUG: optimize: Fix differential_evolution error message.
* `#16573 <https://github.com/scipy/scipy/pull/16573>`__: FIX: \`odr.Model\` error with default \`meta\` value
* `#16588 <https://github.com/scipy/scipy/pull/16588>`__: FIX: stats: ignore divide-by-zero warnings from Boost binom impl
* `#16590 <https://github.com/scipy/scipy/pull/16590>`__: MAINT: stats.vonmises: wrap rvs to -pi, pi interval
* `#16630 <https://github.com/scipy/scipy/pull/16630>`__: BUG: eps param no effect fixed
* `#16645 <https://github.com/scipy/scipy/pull/16645>`__: MAINT: Ensure Pythran input for lombscargle are contiguous
* `#16649 <https://github.com/scipy/scipy/pull/16649>`__: Detect integer overflow in bivariate splines in fitpackmodule.c,...
* `#16657 <https://github.com/scipy/scipy/pull/16657>`__: BUG: sparse: Fix indexing sparse matrix with empty index arguments.
* `#16669 <https://github.com/scipy/scipy/pull/16669>`__: FIX: spurious divide error with \`gmean\`
* `#16701 <https://github.com/scipy/scipy/pull/16701>`__: BUG: fix mutable data types as default arguments in \`ord.{Data,RealData}\`
* `#16752 <https://github.com/scipy/scipy/pull/16752>`__: MAINT: stats.boltzmann: correct _shape_info typo
* `#16780 <https://github.com/scipy/scipy/pull/16780>`__: BUG: interpolate: sanity check x and y in make_interp_spline(x,...
* `#16836 <https://github.com/scipy/scipy/pull/16836>`__: MAINT: avoid \`func_data\`, it conflicts with system header on...
* `#16872 <https://github.com/scipy/scipy/pull/16872>`__: BUG: interpolate: work array sizes for RectSphereBivariateSpline
* `#16965 <https://github.com/scipy/scipy/pull/16965>`__: BUG: linalg: Fix the XSLOW test test_sgesdd_lwork_bug_workaround()
* `#17043 <https://github.com/scipy/scipy/pull/17043>`__: MAINT: fix small LSMR problem
* `#17090 <https://github.com/scipy/scipy/pull/17090>`__: MAINT: stats.rayleigh: enforce constraint on location
* `#17105 <https://github.com/scipy/scipy/pull/17105>`__: FIX: special: use intended branching for \`lamv\` implementation
* `#17166 <https://github.com/scipy/scipy/pull/17166>`__: MAINT: stats.rv_discrete.pmf: should be zero at non-integer argument
* `#17176 <https://github.com/scipy/scipy/pull/17176>`__: REL: Prep for SciPy 1.9.3
* `#17190 <https://github.com/scipy/scipy/pull/17190>`__: BUG: special: Fix two XSLOW test failures.
* `#17193 <https://github.com/scipy/scipy/pull/17193>`__: MAINT: update meson.build to make it work on IBM i system
* `#17200 <https://github.com/scipy/scipy/pull/17200>`__: BLD: fix issue with incomplete threads dependency handling
* `#17204 <https://github.com/scipy/scipy/pull/17204>`__: Keepdims incorrectly documneted fix
* `#17209 <https://github.com/scipy/scipy/pull/17209>`__: MAINT: Handle numpy's deprecation of accepting out-of-bound integers.
* `#17210 <https://github.com/scipy/scipy/pull/17210>`__: BLD: fix invalid shebang for build helper script

View File

@ -0,0 +1,20 @@
==========================
SciPy 1.9.4 Release Notes
==========================
.. contents::
SciPy 1.9.4 is a bug-fix release with no new features
compared to 1.9.3.
Authors
=======
Issues closed for 1.9.4
-----------------------
Pull requests for 1.9.4
-----------------------

View File

@ -38,18 +38,21 @@ Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618
#version_switcher_button[data-active-version-name*="dev"] {
background-color: #E69F00;
border-color: #E69F00;
color: white;
}
/* green for `stable` */
#version_switcher_button[data-active-version-name*="stable"] {
background-color: #009E73;
border-color: #009E73;
color: white;
}
/* red for `old` */
#version_switcher_button:not([data-active-version-name*="stable"]):not([data-active-version-name*="dev"]):not([data-active-version-name*="pull"]) {
background-color: #980F0F;
border-color: #980F0F;
color: white;
}
/* Taken from NumPy */
@ -159,3 +162,40 @@ h3 {
margin-bottom: 0rem;
color: #484848;
}
/* Dark theme tweaking
Matplotlib images are in png and inverted while other output
types are assumed to be normal images.
*/
html[data-theme=dark] img[src*='.png'] {
filter: invert(0.82) brightness(0.8) contrast(1.2);
}
html[data-theme=dark] .MathJax_SVG * {
fill: var(--pst-color-text-base);
}
/* Main index page overview cards */
html[data-theme=dark] .shadow {
box-shadow: 0 .5rem 1rem rgba(250, 250, 250, .6) !important
}
html[data-theme=dark] .intro-card .card-header {
background-color:var(--pst-color-background);
color: #150458 !important;
}
html[data-theme=dark] .intro-card .card-footer {
background-color:var(--pst-color-background);
}
html[data-theme=dark] h1 {
color: var(--pst-color-primary);
}
html[data-theme=dark] h3 {
color: #0a6774;
}

View File

@ -1,11 +1,16 @@
[
{
"name": "1.9.0 (dev)",
"name": "1.10.0 (dev)",
"version": "dev",
"url": "https://scipy.github.io/devdocs/"
},
{
"name": "1.8.1 (stable)",
"name": "1.9.0 (stable)",
"version":"1.9.0",
"url": "https://docs.scipy.org/doc/scipy-1.9.0/"
},
{
"name": "1.8.1",
"version":"1.8.1",
"url": "https://docs.scipy.org/doc/scipy-1.8.1/"
},

View File

@ -185,9 +185,9 @@ html_logo = '_static/logo.svg'
html_favicon = '_static/favicon.ico'
html_theme_options = {
"logo_link": "index",
"github_url": "https://github.com/scipy/scipy",
"navbar_end": ["version-switcher", "navbar-icon-links"],
"twitter_url": "https://twitter.com/SciPy_team",
"navbar_end": ["theme-switcher", "version-switcher", "navbar-icon-links"],
"switcher": {
"json_url": "https://scipy.github.io/devdocs/_static/version_switcher.json",
"version_match": version,
@ -261,6 +261,16 @@ np_docscrape.ClassDoc.extra_public_methods = [ # should match class.rst
autosummary_generate = True
# maps functions with a name same as a class name that is indistinguishable
# Ex: scipy.signal.czt and scipy.signal.CZT or scipy.odr.odr and scipy.odr.ODR
# Otherwise, the stubs are overwritten when the name is same for
# OS (like MacOS) which has a filesystem that ignores the case
# See https://github.com/sphinx-doc/sphinx/pull/7927
autosummary_filename_map = {
"scipy.odr.odr": "odr-function",
"scipy.signal.czt": "czt-function",
}
# -----------------------------------------------------------------------------
# Autodoc

View File

@ -93,7 +93,7 @@ library is MKL and if so, use the CBLAS API instead of the BLAS API.
If autodetection fails or if the user wants to override this
autodetection mechanism, use the following:
_For ``meson`` based builds (new in 1.9.0):_
*For ``meson`` based builds (new in 1.9.0):*
Use the ``-Duse-g77-abi=true`` build option. E.g.,::
@ -106,7 +106,7 @@ example)::
$ meson setup builddir -Duse-g77-abi=true -Dblas=blas -Dlapack=lapack -Dpython.install_env=auto
$ meson install -C builddir
_For ``distutils`` based builds:_
*For ``distutils`` based builds:*
Set the environment variable ``SCIPY_USE_G77_ABI_WRAPPER`` to 0 or 1 to disable
or enable using CBLAS API.

View File

@ -6,21 +6,17 @@ How to build SciPy with Meson
.. warning::
The change over from a `numpy.distutils` to a Meson based build is still a
work in progress. There may be rough edges, and not all platforms and build
configurations are supported yet. These instructions should work reliably on
Linux with a conda environment and OpenBLAS as the BLAS/LAPACK library.
macOS still has one known issue which may occasionally lead to issues
(however, multiple testers have reported success, it's not deterministic -
see https://github.com/rgommers/scipy/issues/31). Windows does work with a
specific setup, but is not officially supported yet (if you want to use it
on Windows anyway, please look at
`this CI job <https://github.com/rgommers/scipy/blob/meson/.github/workflows/windows.yml>`_.
for details)! Other Unix-like OSes may work, but are untested (please open
an issue if you have tested and something seems broken).
For the current status, see
`this tracking issue <https://github.com/rgommers/scipy/issues/22>`_.
The change over from a `numpy.distutils` to a Meson based build happened
recently, so there may still be rough edges. All platforms are supported,
however niche configurations may not yet be tested. These instructions
should work reliably on Linux and macOS with a conda environment and
OpenBLAS as the BLAS/LAPACK library.
Building SciPy on Windows has always been a little tricky - it does work
provided that all build dependencies are installed (most importantly,
OpenBLAS and a compatible set of compilers: either Mingw-w64 or MSVC + Intel
Fortran works). If you have issues on Windows, please look at
`this CI job <https://github.com/scipy/scipy/blob/main/.github/workflows/windows.yml>`_
for details.
Quickstart from scratch
@ -36,15 +32,13 @@ suite::
conda env create -f environment.yml
conda activate scipy-dev
python dev.py
python dev.py test
Full details and explanation
============================
To build SciPy, we need the SciPy ``main`` branch. Note that further work
on Meson integration is being done in the ``meson`` branch from ``@rgommers``'s
fork. We stay with SciPy ``main`` here::
To build SciPy, let's start with a clean repo::
git clone git@github.com:scipy/scipy.git
git submodule update --init
@ -65,10 +59,10 @@ fixes and new features in Meson - hence we need a ``>=0.60.x`` release
(automatically installed via use of ``environment.yml`` above).
Meson uses a configure and a build stage. To configure it for putting the build
artifacts in ``build/`` and a local install under ``installdir/`` and then
artifacts in ``build/`` and a local install under ``build-install/`` and then
build::
meson setup build --prefix=$PWD/installdir
meson setup build --prefix=$PWD/build-install
ninja -C build
In the command above, ``-C`` is followed by the name of the build directory.
@ -76,16 +70,16 @@ You can have multiple builds at the same time. Meson is fully out-of-place, so
those builds will not interfere with each other. You can for example have a GCC
build, a Clang build and a debug build in different directories.
To then install SciPy into the prefix (``installdir/`` here, but note that
To then install SciPy into the prefix (``build-install/`` here, but note that
that's just an arbitrary name we picked here)::
meson install -C build
It will then install to ``installdir/lib/python3.9/site-packages/scipy``, which
It will then install to ``build-install/lib/python3.9/site-packages/scipy``, which
is not on your Python path, so to add it do (*note, having to use ``PYTHONPATH``
is temporary, this will be changed once we merge support for building wheels*)::
export PYTHONPATH=$PWD/installdir/lib/python3.9/site-packages/
export PYTHONPATH=$PWD/build-install/lib/python3.9/site-packages/
Now we should be able to import ``scipy`` and run the tests. Remembering that
we need to move out of the root of the repo to ensure we pick up the package
@ -99,15 +93,8 @@ running the tests should also work, for example::
pytest --pyargs scipy
Current status (24 Dec '21) is that the full test suite passes on Linux, macOS
and Windows with OpenBLAS, without any build warnings on Linux (with GCC 9 at
least) and a moderate amount on the other platforms. There is CI (one job in
SciPy ``main``, and more on ``@rgommers``'s fork) to keep it that way.
The current status is already good enough to work on both build related issues
(e.g. build warnings, debugging some C/C++ extension) and on general SciPy
development. It is already a much smoother/faster experience than
working with the default ``distutils``-based build one gets with
``python setup.py develop`` - especially when working on compiled code.
The full test suite should pass, without any build warnings on Linux (with GCC
9 at least) and a moderate amount on the other platforms.
The ``dev.py`` interface
@ -117,24 +104,25 @@ The above configure-build-install-test docs are useful to understand how the
Meson build works, and for working on build improvements.
If you want the "all-in-one" command for all of the above, run::
python dev.py
python dev.py test
This interface has many options, allowing you to perform all regular
development-related tasks (building, running tests, building docs, running
benchmarks, etc.). Here we document a few of the most commonly used options;
run ``python dev.py --help`` for more details.
run ``python dev.py --help`` or ``--help`` on each of the subcommands for more
details.
Use the following command to build and install SciPy::
python dev.py --build-only
python dev.py build
To run the tests use (``-n`` is short for ``--no-build``)::
To run the tests use::
python dev.py -n
python dev.py test
To run the tests for a particular submodule(let's say ``optimize``), you can use::
python dev.py -n -s optimize
python dev.py test -s optimize
To learn more about Meson
@ -187,7 +175,7 @@ it does mean that one current workflow is no longer supported.
The recommended workflow is to use ``python dev.py``. This works exactly the
same way as ``python runtests.py`` worked before. What it does is rebuild if
needed, and then install SciPy to a private directory (default is
``installdir/`` in-tree) before running tests or other development tasks. This
``build-install/`` in-tree) before running tests or other development tasks. This
way modifications to pure Python code get picked up.
If you use an IDE with, e.g., a "Run" button for scripts which were pointing to
@ -195,13 +183,15 @@ an in-place build, and you would really like to continue using that same
workflow instead of ``python dev.py``, then you have a few options:
- After modifying pure Python code in the SciPy repo, install it on the command
line with ``python dev.py --only-build``, or with ``meson install -C build``
line with ``python dev.py build``, or with ``meson install -C build``
before running your script.
- If your IDE supports it, customize what the "Run" button does before running
the script, to do the install each time (this is expected to take 2-3 sec.)
before executing the script. *Note that the Spyder IDE does not yet support
this; its developers are looking at implementing support before the SciPy
1.9.0 release).*
the script, to do the install each time (this is expected to take 2-3 sec)
For this to work, the install directory
(``build-install/lib/python3.X/site-packages`` inside the repo by default)
should be added to ``PYTHONPATH``. *Note that the Spyder IDE does not yet
support this; its developers are looking at implementing support before the
SciPy 1.9.0 release).*
**Q: I'm seeing a warning "Broken python installation detected. ..."**

View File

@ -78,6 +78,8 @@ The table shows the NumPy versions suitable for each major Python version.
1.7.0/1 >=3.7, <3.10 >=1.16.5, <1.23.0
1.7.2-x >=3.7, <3.11 >=1.16.5, <1.24.0
1.8 >=3.8, <3.11 >=1.17.3, <1.24.0
1.9.0/1 >=3.8, <3.12 >=1.18.5, <1.25.0
1.9.2 >=3.8, <3.12 >=1.18.5, <1.26.0
================= ======================== =======================
In specific cases, such as a particular architecture, these requirements
@ -107,7 +109,7 @@ Currently, SciPy wheels are being built as follows:
Linux (nightly) ``ubuntu-18.04`` GCC 6.5 See ``azure-pipelines.yml``
Linux (release) ``ubuntu-18.04`` GCC 7.5 Built in separate repo [6]_
OSX ``macOS-10.15`` LLVM 12.0.0 Built in separate repo [6]_
Windows ``windows-2019`` Visual Studio 2019 (16.11) See ``azure-pipelines.yml``
Windows ``windows-2019`` Visual Studio 2019 (vc142) Built in separate repo [6]_
================ ======================== =========================== ==============================
Note that the OSX wheels additionally vendor gfortran 4.9,
@ -118,36 +120,98 @@ C Compilers
~~~~~~~~~~~
SciPy is compatible with most modern C compilers (in particular ``clang``).
In addition to concerns about compatibility with non-standard platforms,
there was a long-standing restriction that Windows builds of SciPy had to use
the same version of the Microsoft Visual C++ compiler as were used for CPython
itself, for reasons of ABI-compatibility [7]_, [8]_.
Nowadays, there is reasonable support for recent C language standards across
all relevant compilers, though this is very different from how things used to
be. The following paragraphs primarily discuss the evolution of these
constraints; readers who do not care about historical context can skip ahead
to the table at the end.
With the introduction of the "Universal C Runtime" [9]_ since the release of
Visual Studio 2015, this restriction has been lifted. For more context, see the
explanations by Steve Dower (member of the CPython-on-Windows core developers)
on this topic [10]_.
In the past, the most restrictive compiler on relevant platform in terms
of C support was the Microsoft Visual C++ compiler & toolset (together known
as MSVC) [7]_ [8]_. Up until Visual Studio 2013, each MSVC version came with
an updated C Runtime (CRT) library that was incompatible with the previous
ones.
The use of MS Visual Studio 9.0 (which doesn't have support for C99)
to build Python 2.7 has meant that C code in SciPy has had to conform
to the earlier C90 standard for the language and standard library.
With the dropping of Python 2.7 for SciPy 1.3.x, the C90 restriction is no
longer imposed by compilers.
This lack of compatibility of the Application Binary Interface (ABI) meant
that all projects wanting to communicate across this interface (e.g. calling a
function from a shared library) needed to be (re)compiled with the same MSVC
version. The long support of CPython 2.7 meant that python itself was stuck
for a long time with VS 2008 (in order not to break the ABI in patch
releases), and thus SciPy was stuck on that version as well.
The use of VS 2008 (which doesn't have support for C99) to compile builds for
CPython 2.7 meant for a long time that C code in SciPy has had to conform
to the earlier C90 standard for the language and standard library. After
dropping support for CPython 2.7 in SciPy 1.3.x, that restriction was finally
lifted (though only gradually at first).
With the introduction of the "Universal C Runtime" (UCRT) [9]_ since the
release of Visual Studio 2015, the ABI of C Runtime has been stable, which
means that the restriction of having to use the same compiler version for
SciPy as for the underlying CPython version is no longer applicable. This
stability is not indefinite though: Microsoft has been planning [10]_ an
ABI-breaking release - across the compiler resp. C/C++ standard libraries -
(tentatively called "vNext") for quite a while, but so far it is unclear
when this will arrive. Once that happens, SciPy will again be restricted to
at most the last ABI-compatible Visual Studio release (currently VS 2022)
until all CPython versions supported according to NEP29 have been built
upstream with vNext-compatible compilers.
More specifically, there is a distinction between the Microsoft Visual
Studio version and the version of the targeted "toolset", which is defined
[11]_ as "The Microsoft C++ compiler, linker, standard libraries, and related
utilities". Each version of Visual Studio comes with a default version of the
MSVC toolset (for example VS2017 with vc141, VS2019 with vc142), but it is
possible to target older toolsets even in newer versions of Visual Studio.
Due to the nature of compilers (i.e. split into frontend and backend), it
depends whether the limiting factor for supporting a given feature (e.g. in C)
is due to the version of Visual Studio or the toolset, but in general the
latter is a harder barrier and thus the effective lower bound.
This is due to the fact that while the ABI stays compatible between toolset
versions (until vNext), all linking operations must use a toolset at least
as new as the one used to build any of the involved artefacts, meaning that
toolset version bumps tend to be "infectious", as in: requiring all consuming
libraries to also bump their toolset (and probably compiler) version. This is
more of an issue for NumPy than SciPy, as the latter has only a small C API
and is compiled against by far fewer projects than NumPy. Additionally, using
a newer toolset means that users of libraries that compile C++ code (as SciPy
does) might also need a newer Microsoft Visual C++ Redistributable, which
might have to be distributed to them [12]_.
Summing up, the minimal requirement for the MSVC compiler resp. toolset per
SciPy version was determined predominantly by the oldest supported CPython
version at the time. The first SciPy version to raise the minimal requirement
beyond that was SciPy 1.9, due to the inclusion of the HiGHS submodule, which
does not compile with vc141 (and the aggressive removal of VS2017 in public CI
making it infeasible to keep ensuring that everything everywhere works with
non-default toolset versions).
============== ================= ================= =================
SciPy version CPython support MS Visual C++ Toolset version
============== ================= ================= =================
Until 1.2 2.7 & 3.4+ VS 2008 (9.0) vc90
1.3, 1.4 3.5+ VS 2010 (10.0) vc100
1.5 3.6+ VS 2015 (14.0) vc140
1.6, 1.7 3.7+ VS 2017 (14.1) vc141
1.8 3.8+ VS 2017 (14.1) vc141
1.9 3.8+ VS 2019 (14.20) vc142
============== ================= ================= =================
In terms of C language standards, it's relevant to note that C11 has optional
features [11]_ (e.g. atomics, threading), some of which (VLAs & complex types)
features [13]_ (e.g. atomics, threading), some of which (VLAs & complex types)
were mandatory in the C99 standard. C17 (occasionally called C18) can be
considered a bug fix for C11, so generally, C11 may be skipped entirely.
SciPy has been restricted in the use of more advanced language features by the
available compiler support, and Microsoft in particular has taken very long to
achieve conformance to C99/C11/C17, however starting from MS Visual Studio 16.8,
C11/C17 is supported [12]_ (though without the C11 optional features).
C11/C17 is supported [14]_ (though without the C11 optional features).
C99 ``<complex.h>`` would be particularly interesting for SciPy;
MSVC conformance for this is being tracked here [13]_.
MSVC conformance for this is being tracked here [15]_.
Therefore, using C features beyond C90 was only possible insofar there was support on
windows; however, as of as of the end of 2021, a sufficiently recent compiler is used.
Windows; however, as of as of the end of 2021, a sufficiently recent compiler is used.
This is because GCC & LLVM support all relevant C11 features with the oldest currently
used versions, and C17 is just a bugfix for C11, as mentioned above. In short:
@ -186,20 +250,20 @@ CPython) has been recent enough to support even C++17.
Since the official builds (see above) use a pretty recent version of LLVM,
the bottleneck for C++ support is therefore the oldest supported GCC version,
where SciPy has been constrained mainly by the version in the oldest supported
manylinux versions & images [14]_.
manylinux versions & images [16]_.
At the end of 2021 (with the final removal of ``manylinux1`` wheels), SciPy
now has a minimum GCC requirement of GCC 6.3, which has full C++14 support
[15]_. This corresponds to the lowest present GCC version in relevant manylinux
[17]_. This corresponds to the lowest present GCC version in relevant manylinux
versions - somewhat surprisingly, it is not the oldest remaining
``manylinux2010`` that is the most restrictive (due to the ABI-compatible
"RHEL Dev Toolset" backports, it has GCC 8.3), but actually ``manylinux_2_24``
that only comes with GCC 6.3 [16]_.
that only comes with GCC 6.3 [18]_.
C++17 _language_ support will require GCC >= 7 (released May 2017). As of the
end of 2021, support for the entirety of the C++17 standard library has not yet
been completed across all compilers; similarly, support for C++20 and C++23
is still under heavy development. [15]_
is still under heavy development. [17]_
Fortran Compilers
~~~~~~~~~~~~~~~~~
@ -226,7 +290,7 @@ is a build dependency (currently with the possibility to opt out).
OpenMP support
^^^^^^^^^^^^^^
For various reasons [17]_, SciPy cannot be distributed with built-in OpenMP support.
For various reasons [19]_, SciPy cannot be distributed with built-in OpenMP support.
When using the optional Pythran support, OpenMP-enabled parallel code can be
generated when building from source.
@ -255,7 +319,7 @@ scikit-umfpack Recent https://pypi.org/project/scikit-umfpack/
=============== ======== ==========================================
Moreover, Scipy supports interaction with other libraries. The test suite
Moreover, SciPy supports interaction with other libraries. The test suite
has additional compatibility tests that are run when these are installed:
========================= ======== ====================================
@ -327,14 +391,16 @@ References
.. [4] https://github.com/scipy/oldest-supported-numpy
.. [5] https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted
.. [6] https://github.com/MacPython/scipy-wheels
.. [7] https://pythondev.readthedocs.io/windows.html#python-and-visual-studio-version-matrix
.. [7] https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-in-visual-studio
.. [8] https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
.. [9] https://docs.microsoft.com/en-gb/cpp/windows/universal-crt-deployment
.. [10] https://discuss.python.org/t/toolchain-upgrade-on-windows/6377/4
.. [11] https://en.wikipedia.org/wiki/C11_%28C_standard_revision%29#Optional_features
.. [12] https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/
.. [13] https://developercommunity.visualstudio.com/t/Support-for-C99-Complex-numbers/1409049?space=8&q=complex
.. [14] https://github.com/mayeut/pep600_compliance
.. [15] https://en.cppreference.com/w/cpp/compiler_support
.. [16] https://github.com/pypa/manylinux/issues/1012
.. [17] https://github.com/scipy/scipy/issues/10239
.. [10] https://github.com/microsoft/STL/issues/169
.. [11] https://docs.microsoft.com/en-us/cpp/build/projects-and-build-systems-cpp#the-msvc-toolset
.. [12] https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist
.. [13] https://en.wikipedia.org/wiki/C11_%28C_standard_revision%29#Optional_features
.. [14] https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/
.. [15] https://developercommunity.visualstudio.com/t/Support-for-C99-Complex-numbers/1409049?space=8&q=complex
.. [16] https://github.com/mayeut/pep600_compliance
.. [17] https://en.cppreference.com/w/cpp/compiler_support
.. [18] https://github.com/pypa/manylinux/issues/1012
.. [19] https://github.com/scipy/scipy/issues/10239

View File

@ -0,0 +1 @@
.. include:: ../release/1.9.1-notes.rst

View File

@ -0,0 +1 @@
.. include:: ../release/1.9.2-notes.rst

View File

@ -0,0 +1 @@
.. include:: ../release/1.9.3-notes.rst

View File

@ -0,0 +1 @@
.. include:: ../release/1.9.4-notes.rst

View File

@ -8,6 +8,10 @@ see the `commit logs <https://github.com/scipy/scipy/commits/>`_.
.. toctree::
:maxdepth: 1
release.1.9.4
release.1.9.3
release.1.9.2
release.1.9.1
release.1.9.0
release.1.8.1
release.1.8.0

View File

@ -1,7 +1,7 @@
# Note: this should disappear at some point. For now, please keep it
# in sync with the doc dependencies in pyproject.toml
Sphinx!=3.1.0, !=4.1.0
pydata-sphinx-theme>=0.8.1
Sphinx!=4.1.0
pydata-sphinx-theme==0.9.0
sphinx-panels>=0.5.2
sphinx-tabs
numpydoc

View File

@ -18,7 +18,7 @@ dependencies:
- pkg-config # note: not available on Windows
- libblas=*=*openblas # helps avoid pulling in MKL
- pybind11
- pythran>=0.9.12
- pythran>=0.11.0
# For testing and benchmarking
- pytest
- pytest-cov
@ -32,7 +32,7 @@ dependencies:
- numpydoc
- ipython
- matplotlib
- pydata-sphinx-theme>=0.8.1
- pydata-sphinx-theme==0.9.0
- sphinx-panels
- sphinx-tabs
# For linting
@ -45,4 +45,4 @@ dependencies:
- rich-click
- click
- doit>=0.36.0
- pydevtool==0.2.0
- pydevtool

View File

@ -4,17 +4,13 @@ project(
# Note that the git commit hash cannot be added dynamically here (it is added
# in the dynamically generated and installed `scipy/version.py` though - see
# tools/version_utils.py
version: '1.9.0.dev0',
version: '1.9.4',
license: 'BSD-3',
meson_version: '>= 0.60',
meson_version: '>= 0.62.2',
default_options: [
'buildtype=debugoptimized',
'c_std=c99',
'cpp_std=c++14', # TODO: use c++11 if 14 is not available
# TODO: the below -Wno flags are all needed to silence warnings in
# f2py-generated code. This should be fixed in f2py itself.
'c_args=-Wno-unused-function -Wno-conversion -Wno-misleading-indentation -Wno-incompatible-pointer-types',
'fortran_args=-Wno-conversion',
'cpp_std=c++14',
'fortran_std=legacy',
'blas=openblas',
'lapack=openblas'
@ -23,12 +19,24 @@ project(
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
# This argument is called -Wno-unused-but-set-variable by GCC, however Clang
# doesn't recognize that.
if cc.has_argument('-Wno-unused-but-set-variable')
add_global_arguments('-Wno-unused-but-set-variable', language : 'c')
endif
# TODO: the below -Wno flags are all needed to silence warnings in
# f2py-generated code. This should be fixed in f2py itself.
_global_c_args = cc.get_supported_arguments(
'-Wno-unused-but-set-variable',
'-Wno-unused-function',
'-Wno-conversion',
'-Wno-misleading-indentation',
'-Wno-incompatible-pointer-types',
)
add_project_arguments(_global_c_args, language : 'c')
# We need -lm for all C code (assuming it uses math functions, which is safe to
# assume for SciPy). For C++ it isn't needed, because libstdc++/libc++ is
# guaranteed to depend on it. For Fortran code, Meson already adds `-lm`.
@ -37,8 +45,28 @@ if m_dep.found()
add_project_link_arguments('-lm', language : 'c')
endif
if host_machine.system() == 'os400'
# IBM i system, needed to avoid build errors - see gh-17193
add_project_arguments('-D__STDC_FORMAT_MACROS', language : 'cpp')
add_project_link_arguments('-Wl,-bnotextro', language : 'c')
add_project_link_arguments('-Wl,-bnotextro', language : 'cpp')
add_project_link_arguments('-Wl,-bnotextro', language : 'fortran')
endif
# Adding at project level causes many spurious -lgfortran flags.
add_languages('fortran', native: false)
ff = meson.get_compiler('fortran')
if ff.has_argument('-Wno-conversion')
add_project_arguments('-Wno-conversion', language: 'fortran')
endif
is_windows = host_machine.system() == 'windows'
# Intel Fortran on Windows does things differently, so deal with that
if is_windows and ff.get_id() == 'intel-cl'
_ifort_flags = ff.get_supported_arguments('/MD', '/names:lowercase', '/assume:underscore')
add_project_arguments(_ifort_flags, language: 'fortran')
endif
cython = find_program('cython')
pythran = find_program('pythran')
@ -48,7 +76,17 @@ copier = find_program(['cp', 'scipy/_build_utils/copyfiles.py'])
# https://mesonbuild.com/Python-module.html
py_mod = import('python')
# NOTE: with Meson >=0.64.0 we can add `pure: false` here and remove that line
# everywhere else, see https://github.com/mesonbuild/meson/pull/10783.
py3 = py_mod.find_installation()
# SciPy 1.9.0-specific error message, see the same message in
# `scipy/__init__.py` and gh-14986
if py3.language_version().version_compare('>=3.12')
error('Your Python version is too new. SciPy 1.9 supports ' +
'Python 3.8-3.11; if you are trying to build from source for the ' +
'most recent SciPy version you may hit this error as well. Please ' +
'build from the `main` branch on GitHub instead.')
endif
py3_dep = py3.dependency()
subdir('scipy')

View File

@ -10,13 +10,13 @@
[build-system]
build-backend = 'mesonpy'
requires = [
"meson-python>=0.5.0",
"Cython>=0.29.21",
"pybind11>=2.4.3",
"pythran>=0.9.12",
"meson-python>=0.9.0", # we need more fixes in meson-python, so no upper bound now
"Cython>=0.29.32,<3.0",
"pybind11>=2.4.3,<2.11.0",
"pythran>=0.9.12,<0.13.0",
# `wheel` is needed for non-isolated builds, given that `meson-python`
# doesn't list it as a runtime requirement (at least in 0.5.0)
"wheel",
"wheel<0.38.0",
# NumPy dependencies - to update these, sync from
# https://github.com/scipy/oldest-supported-numpy/, and then
@ -28,31 +28,40 @@ requires = [
"numpy==1.19.2; python_version=='3.8' and platform_machine=='aarch64' and platform_python_implementation != 'PyPy'",
# aarch64 for py39 is covered by default requirement below
# arm64 on Darwin supports Python 3.8 and above requires numpy>=1.20.0
"numpy==1.20.0; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Darwin'",
"numpy==1.20.0; python_version=='3.9' and platform_machine=='arm64' and platform_system=='Darwin'",
# arm64 on Darwin supports Python 3.8 and above requires numpy>=1.21.0
# (first version with arm64 wheels available)
"numpy==1.21.0; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Darwin'",
"numpy==1.21.0; python_version=='3.9' and platform_machine=='arm64' and platform_system=='Darwin'",
# loongarch64 requires numpy>=1.22.0
"numpy==1.22.0; platform_machine=='loongarch64'",
# On Windows we need to avoid 1.21.6, 1.22.0 and 1.22.1 because they were
# built with vc142. 1.22.3 is the first version that has 32-bit Windows
# wheels *and* was built with vc141. So use that:
"numpy==1.22.3; python_version=='3.10' and platform_system=='Windows' and platform_python_implementation != 'PyPy'",
# default numpy requirements
"numpy==1.18.5; python_version=='3.8' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_machine!='aarch64' and platform_machine!='loongarch64' and platform_python_implementation != 'PyPy'",
"numpy==1.19.3; python_version=='3.9' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_machine!='loongarch64' and platform_python_implementation != 'PyPy'",
# Note that 1.21.3 was the first version with a complete set of 3.10 wheels,
# however macOS was broken and it's safe to build against 1.21.6 on all platforms
# however macOS was broken and it's safe C API/ABI-wise to build against 1.21.6
# (see oldest-supported-numpy issues gh-28 and gh-45)
"numpy==1.21.6; python_version=='3.10' and platform_machine!='loongarch64' and platform_python_implementation != 'PyPy'",
"numpy==1.21.6; python_version=='3.10' and (platform_system!='Windows' and platform_machine!='loongarch64') and platform_python_implementation != 'PyPy'",
"numpy==1.23.2; python_version=='3.11' and platform_python_implementation != 'PyPy'",
# For Python versions which aren't yet officially supported,
# we specify an unpinned NumPy which allows source distributions
# to be used and allows wheels to be used as soon as they
# become available.
"numpy; python_version>='3.11'",
"numpy; python_version>='3.12'",
"numpy; python_version>='3.8' and platform_python_implementation=='PyPy'",
]
[project]
name = "SciPy"
# TODO: add `license-files` once PEP 639 is accepted (see meson-python#88)
# at that point, no longer include them in `py3.install_sources()`
license = {file = "LICENSE.txt"}
description = "Fundamental algorithms for scientific computing in Python"
maintainers = [
@ -65,7 +74,7 @@ requires-python = ">=3.8"
dependencies = [
# TODO: update to "pin-compatible" once possible, see
# https://github.com/FFY00/meson-python/issues/29
"numpy>=1.18.5",
"numpy>=1.18.5,<1.26.0",
]
readme = "README.rst"
classifiers = [
@ -101,8 +110,8 @@ test = [
"scikit-umfpack",
]
doc = [
"sphinx!=3.1.0, !=4.1.0",
"pydata-sphinx-theme>=0.8.1",
"sphinx!=4.1.0",
"pydata-sphinx-theme==0.9.0",
"sphinx-panels>=0.5.2",
"matplotlib>2",
"numpydoc",
@ -122,7 +131,44 @@ source = "https://github.com/scipy/scipy"
download = "https://github.com/scipy/scipy/releases"
tracker = "https://github.com/scipy/scipy/issues"
[tool.doit]
dodoFile = "do.py"
[tool.cibuildwheel]
skip = "cp36-* cp37-* pp* *_ppc64le *_i686 *_s390x *-musllinux*"
build-verbosity = "3"
# gmpy2 and scikit-umfpack are usually added for testing. However, there are
# currently wheels missing that make the test script fail.
test-requires = ["pytest", "pytest-cov", "pytest-xdist", "asv", "mpmath", "threadpoolctl", "pooch"]
test-command = "bash {project}/tools/wheels/cibw_test_command.sh {project}"
[tool.cibuildwheel.linux]
manylinux-x86_64-image = "manylinux2014"
manylinux-aarch64-image = "manylinux2014"
before-build = "bash {project}/tools/wheels/cibw_before_build_linux.sh {project}"
[tool.cibuildwheel.macos]
before-build = "bash {project}/tools/wheels/cibw_before_build_macos.sh {project}"
test-skip = "*_arm64 *_universal2:arm64"
[tool.cibuildwheel.windows]
before-build = "bash {project}/tools/wheels/cibw_before_build_win.sh {project}"
repair-wheel-command = "bash ./tools/wheels/repair_windows.sh {wheel} {dest_dir}"
[[tool.cibuildwheel.overrides]]
select = "*-win32"
[[tool.cibuildwheel.overrides]]
select = "*-win_amd64"
# can use pkg-config detection for win_amd64 because the installed rtools
# provide a working pkg-config.
# An alternative is to set CMAKE_PREFIX_PATH="c:/opt/openblas/if_32/32"
# Don't use double backslash for path separators, they don't get passed
# to the build correctly
environment = { PKG_CONFIG_PATH="c:/opt/openblas/if_32/64/lib/pkgconfig" }
[[tool.cibuildwheel.overrides]]
select = "*-manylinux_aarch64"
before-test = ""
test-requires = ["pytest", "threadpoolctl"]
test-command = "bash {project}/tools/wheels/cibw_test_command_manylinux_aarch64.sh {project}"

View File

@ -57,6 +57,19 @@ Utility tools
"""
# Note: this patch is specific to SciPy 1.9.0; other SciPy versions will
# have a correct upper bound in `python_requires` in pyproject.toml
# (or in setup.py for SciPy 1.7.x-1.8.x).
import sys
if sys.version_info >= (3, 12):
_msg = ("Your Python version is too new. SciPy 1.9 supports "
"Python 3.8-3.11; if you are trying to build from source for the "
"most recent SciPy version you may hit this error as well. Please "
"build from the `main` branch on GitHub instead.")
raise RuntimeError(_msg)
del sys
from numpy import show_config as show_numpy_config
if show_numpy_config is None:
raise ImportError(
@ -135,7 +148,7 @@ else:
# In maintenance branch, change to np_maxversion N+3 if numpy is at N
# See setup.py for more details
np_minversion = '1.18.5'
np_maxversion = '9.9.99'
np_maxversion = '1.26.0'
if (_pep440.parse(__numpy_version__) < _pep440.Version(np_minversion) or
_pep440.parse(__numpy_version__) >= _pep440.Version(np_maxversion)):
import warnings

View File

@ -1,4 +1,4 @@
#!python3
#!/usr/bin/env python3
""" Scipy variant of Cython command
Cython, as applied to single pyx file.

View File

@ -1,12 +1,7 @@
# TODO: add_data_files('license')
# TODO: this used -std=c++14 if available, add c++11 otherwise
# can we now rely on c++14 unconditionally?
py3.extension_module('_uarray',
['_uarray_dispatch.cxx', 'vectorcall.cxx'],
cpp_args: ['-Wno-terminate', '-Wno-unused-function'],
dependencies: py3_dep,
cpp_args: [_cpp_Wno_terminate, _cpp_Wno_unused_function],
install: true,
subdir: 'scipy/_lib/_uarray'
)
@ -15,6 +10,7 @@ py3.extension_module('_uarray',
python_sources = [
'__init__.py',
'_backend.py',
'LICENSE'
]
py3.install_sources(

@ -1 +1 @@
Subproject commit d8626c9d2d937abf6a38a844522714ad72e63281
Subproject commit 2a1a7e920f39c44440d6908a080810abe9510f42

@ -1 +1 @@
Subproject commit 885c5de95a2b73269b0f885ea27234bb0c29c2a3
Subproject commit 4a122958a82e67e725d08153e099efe4dad099a2

View File

@ -20,10 +20,9 @@ lib_cython_gen = generator(cython_cli,
output : '@BASENAME@.c',
depends : [_cython_tree, _lib_pxd])
py3.extension_module('_ccallback_c',
lib_cython_gen.process('_ccallback_c.pyx'),
c_args: ['-Wno-discarded-qualifiers', cython_c_args],
c_args: [cython_c_args, Wno_discarded_qualifiers],
include_directories: 'src',
dependencies: py3_dep,
install: true,

View File

@ -3,7 +3,6 @@ from libc cimport stdio, stdlib
from cpython cimport PyBytes_FromStringAndSize
import os
import sys
import tempfile
cdef extern from "messagestream.h":
@ -27,18 +26,21 @@ cdef class MessageStream:
return
# Fall back to temporary files
fd, filename = tempfile.mkstemp(prefix='scipy-')
os.close(fd)
self._filename = filename.encode(sys.getfilesystemencoding())
self.handle = stdio.fopen(self._filename, "wb+")
if self.handle == NULL:
stdio.remove(self._filename)
raise OSError(f"Failed to open file {self._filename}")
self._removed = 0
fd, self._filename = tempfile.mkstemp(prefix=b'scipy-')
# Use a posix-style deleted file, if possible
if stdio.remove(self._filename) == 0:
try:
os.remove(self._filename)
self._removed = 1
except PermissionError:
self._removed = 0
self.handle = stdio.fdopen(fd, 'wb+')
if self.handle == NULL:
os.close(fd)
if not self._removed:
os.remove(self._filename)
raise OSError(f"Failed to open file {self._filename}")
def __dealloc__(self):
self.close()
@ -86,5 +88,5 @@ cdef class MessageStream:
self._memstream_ptr = NULL
if not self._removed:
stdio.remove(self._filename)
os.remove(self._filename)
self._removed = 1

View File

@ -1,22 +1,29 @@
thread_dep = dependency('threads', required: false)
# mingw-w64 does not implement pthread_pfork, needed by pocket_fft
win_gcc = is_windows and meson.get_compiler('cpp').get_id() == 'gcc'
pocketfft_threads = []
fft_deps = [py3_dep]
if not win_gcc
if thread_dep.found()
pocketfft_threads += ['-DPOCKETFFT_PTHREADS']
fft_deps += [thread_dep]
if is_windows
if is_mingw
# mingw-w64 does not implement pthread_pfork, needed by pocket_fft
# Disable threading completely, because of freezes using threading for
# mingw-w64 gcc: https://github.com/mreineck/pocketfft/issues/1
pocketfft_threads += ['-DPOCKETFFT_NO_MULTITHREADING']
else
if thread_dep.found()
# Use native Windows threading for MSVC/Clang. `pthreads` is probably not
# installed, and native threading is always available. It is not easy to
# distinguish this better, Meson builtin functionality for that is in
# progress (see comment on gh-16957). The code in `pocketfft_hdronly.h`
# will include `<threads>` anyway.
fft_deps += [thread_dep]
pocketfft_threads += []
endif
endif
else
# Freezes using threading for mingw-w64 gcc:
# https://github.com/mreineck/pocketfft/issues/1
pocketfft_threads += ['-DPOCKETFFT_NO_MULTITHREADING']
if thread_dep.found()
fft_deps += [thread_dep]
pocketfft_threads += ['-DPOCKETFFT_PTHREADS']
endif
endif
#TODO: add the equivalent of set_cxx_flags_hook
py3.extension_module('pypocketfft',
'pypocketfft.cxx',
cpp_args: pocketfft_threads,
@ -32,6 +39,7 @@ python_sources = [
'__init__.py',
'basic.py',
'helper.py',
'LICENSE.md',
'realtransforms.py'
]

View File

@ -1,10 +1,3 @@
fortran_ignore_warnings = [
'-Wno-tabs', '-Wno-conversion',
'-Wno-argument-mismatch', '-Wno-unused-dummy-argument',
'-Wno-maybe-uninitialized', '-Wno-unused-label',
'-Wno-unused-variable'
]
mach_src = [
'mach/d1mach.f',
'mach/xerror.f'
@ -92,19 +85,16 @@ quadpack_lib = static_library('quadpack_lib',
lsoda_lib = static_library('lsoda_lib',
lsoda_src,
c_args: '-Wno-unused-variable',
fortran_args: fortran_ignore_warnings
)
vode_lib = static_library('vode_lib',
vode_src,
c_args: '-Wno-unused-variable',
fortran_args: fortran_ignore_warnings
)
dop_lib = static_library('dop_lib',
dop_src,
c_args: '-Wno-unused-variable',
fortran_args: fortran_ignore_warnings
)
@ -141,7 +131,7 @@ vode_module = custom_target('vode_module',
py3.extension_module('_vode',
[vode_module, fortranobject_c],
link_with: [vode_lib],
c_args: [numpy_nodepr_api, '-Wno-unused-variable'],
c_args: [numpy_nodepr_api, Wno_unused_variable],
include_directories: [inc_np, inc_f2py],
dependencies: [py3_dep, lapack],
install: true,
@ -158,7 +148,7 @@ lsoda_module = custom_target('lsoda_module',
py3.extension_module('_lsoda',
[lsoda_module, fortranobject_c],
link_with: [lsoda_lib, mach_lib],
c_args: [numpy_nodepr_api, '-Wno-unused-variable'],
c_args: [numpy_nodepr_api, Wno_unused_variable],
dependencies: [py3_dep, lapack],
include_directories: [inc_np, inc_f2py],
install: true,
@ -175,7 +165,7 @@ _dop_module = custom_target('_dop_module',
py3.extension_module('_dop',
[_dop_module, fortranobject_c],
link_with: [dop_lib],
c_args: [numpy_nodepr_api, '-Wno-unused-variable'],
c_args: [numpy_nodepr_api, Wno_unused_variable],
dependencies: [py3_dep],
include_directories: [inc_np, inc_f2py],
install: true,
@ -190,8 +180,6 @@ py3.extension_module('_test_multivariate',
subdir: 'scipy/integrate'
)
# FIXME: something is wrong with the signature file, subroutines are not used
# _test_odeint_banded
_test_odeint_banded_module = custom_target('_test_odeint_banded_module',
output: ['_test_odeint_bandedmodule.c', '_test_odeint_banded-f2pywrappers.f'],
input: 'tests/banded5x5.pyf',
@ -202,7 +190,7 @@ py3.extension_module('_test_odeint_banded',
['tests/banded5x5.f', fortranobject_c, _test_odeint_banded_module],
c_args: numpy_nodepr_api,
link_with: [lsoda_lib, mach_lib],
fortran_args: '-Wno-unused-dummy-argument',
fortran_args: _fflag_Wno_unused_dummy_argument,
include_directories: [inc_np, inc_f2py],
dependencies: [py3_dep, lapack],
install: true,

View File

@ -1241,9 +1241,17 @@ def make_interp_spline(x, y, k=3, t=None, bc_type=None, axis=0,
y = np.moveaxis(y, axis, 0) # now internally interp axis is zero
# sanity check the input
if bc_type == 'periodic' and not np.allclose(y[0], y[-1], atol=1e-15):
raise ValueError("First and last points does not match while "
"periodic case expected")
if x.size != y.shape[0]:
raise ValueError('Shapes of x {} and y {} are incompatible'
.format(x.shape, y.shape))
if np.any(x[1:] == x[:-1]):
raise ValueError("Expect x to not have duplicates")
if x.ndim != 1 or np.any(x[1:] < x[:-1]):
raise ValueError("Expect x to be a 1D strictly increasing sequence.")
# special-case k=0 right away
if k == 0:
@ -1289,17 +1297,10 @@ def make_interp_spline(x, y, k=3, t=None, bc_type=None, axis=0,
t = _as_float_array(t, check_finite)
if x.ndim != 1 or np.any(x[1:] < x[:-1]):
raise ValueError("Expect x to be a 1-D sorted array_like.")
if np.any(x[1:] == x[:-1]):
raise ValueError("Expect x to not have duplicates")
if k < 0:
raise ValueError("Expect non-negative k.")
if t.ndim != 1 or np.any(t[1:] < t[:-1]):
raise ValueError("Expect t to be a 1-D sorted array_like.")
if x.size != y.shape[0]:
raise ValueError('Shapes of x {} and y {} are incompatible'
.format(x.shape, y.shape))
if t.size < x.size + k + 1:
raise ValueError('Got %d knots, need at least %d.' %
(t.size, x.size + k + 1))

View File

@ -519,7 +519,8 @@ class interp1d(_Interpolator1D):
self._call = self.__class__._call_previousnext
if _do_extrapolate(fill_value):
self._check_and_update_bounds_error_for_extrapolation()
fill_value = (np.nan, self.y.max(axis=axis))
# assume y is sorted by x ascending order here.
fill_value = (np.nan, np.take(self.y, -1, axis))
elif kind == 'next':
self._side = 'right'
self._ind = 1
@ -528,7 +529,8 @@ class interp1d(_Interpolator1D):
self._call = self.__class__._call_previousnext
if _do_extrapolate(fill_value):
self._check_and_update_bounds_error_for_extrapolation()
fill_value = (self.y.min(axis=axis), np.nan)
# assume y is sorted by x ascending order here.
fill_value = (np.take(self.y, 0, axis), np.nan)
else:
# Check if we can delegate to numpy.interp (2x-10x faster).
np_types = (np.float_, np.int_)

View File

@ -576,7 +576,7 @@ def interpn(points, values, xi, method="linear", bounds_error=True,
if xi.shape[-1] != len(grid):
raise ValueError("The requested sample points xi have dimension "
"%d, but this RegularGridInterpolator has "
"dimension %d" % (xi.shape[1], len(grid)))
"dimension %d" % (xi.shape[-1], len(grid)))
if bounds_error:
for i, p in enumerate(xi.T):

View File

@ -21,7 +21,11 @@ c ..local scalars..
real*8 an,am,fpmax
integer ihalf,j,jbegin,jj,jk,jpoint,k,maxbeg,maxpt,
* next,nrx,number
c ..
c note: do not initialize on the same line to avoid saving between calls
logical iserr
iserr = .TRUE.
k = (n-nrint-1)/2
c search for knot interval t(number+k) <= x <= t(number+k+1) where
c fpint(number) is maximal on the condition that nrdata(number)
@ -31,12 +35,15 @@ c not equals zero.
do 20 j=1,nrint
jpoint = nrdata(j)
if(fpmax.ge.fpint(j) .or. jpoint.eq.0) go to 10
iserr = .FALSE.
fpmax = fpint(j)
number = j
maxpt = jpoint
maxbeg = jbegin
10 jbegin = jbegin+jpoint+1
20 continue
c error condition detected, go to exit
if(iserr) go to 50
c let coincide the new knot t(number+k+1) with a data point x(nrx)
c inside the old knot interval t(number+k) <= x <= t(number+k+1).
ihalf = maxpt/2+1
@ -60,7 +67,7 @@ c adjust the different parameters.
fpint(next) = fpmax*an/am
jk = next+k
t(jk) = x(nrx)
n = n+1
50 n = n+1
nrint = nrint+1
return
end

View File

@ -90,12 +90,12 @@ fitpack_src = [
# TODO: Add flags for 64 bit ints
fitpack_lib = static_library('fitpack_lib',
fitpack_src,
fortran_args: '-Wno-maybe-uninitialized'
fortran_args: _fflag_Wno_maybe_uninitialized
)
interpnd = py3.extension_module('interpnd',
spt_cython_gen.process('interpnd.pyx'),
c_args: ['-Wno-discarded-qualifiers', cython_c_args],
c_args: [Wno_discarded_qualifiers, cython_c_args],
include_directories: [incdir_numpy],
dependencies: [py3_dep],
install: true,
@ -141,7 +141,7 @@ dfitpack_module = custom_target('dfitpack_module',
# TODO: Add flags for 64 bit ints
dfitpack = py3.extension_module('dfitpack',
[dfitpack_module, fortranobject_c],
c_args: [numpy_nodepr_api, '-Wno-unused-variable'],
c_args: [numpy_nodepr_api, Wno_unused_variable],
include_directories: [incdir_numpy, incdir_f2py],
dependencies: [py3_dep, lapack],
link_with: [fitpack_lib],
@ -151,11 +151,6 @@ dfitpack = py3.extension_module('dfitpack',
)
if use_pythran
if cc.has_argument('-Wno-unused-but-set-variable')
Wno_unused_but_set = ['-Wno-unused-but-set-variable']
else
Wno_unused_but_set = []
endif
_rbfinterp_pythran = custom_target('_rbfinterp_pythran',
output: ['_rbfinterp_pythran.cpp'],
input: '_rbfinterp_pythran.py',
@ -163,13 +158,8 @@ if use_pythran
)
_rbfinterp_pythran = py3.extension_module('_rbfinterp_pythran',
[_rbfinterp_pythran],
cpp_args: [
'-Wno-unused-function', '-Wno-unused-variable',
'-Wno-deprecated-declarations',
'-Wno-cpp', '-Wno-int-in-bool-context',
Wno_unused_but_set
] + cpp_args_pythran,
_rbfinterp_pythran,
cpp_args: cpp_args_pythran,
include_directories: [incdir_pythran, incdir_numpy],
dependencies: [py3_dep],
install: true,

View File

@ -1,8 +1,3 @@
/*
Multipack project.
This file is generated by setmodules.py. Do not modify it.
*/
#include <Python.h>
#include "numpy/arrayobject.h"
@ -15,6 +10,7 @@ static PyObject *fitpack_error;
#define F_INT npy_int64
#define F_INT_NPY NPY_INT64
#define F_INT_MAX NPY_MAX_INT64
#if NPY_BITSOF_SHORT == 64
#define F_INT_PYFMT "h"
@ -32,9 +28,20 @@ static PyObject *fitpack_error;
#else
#define F_INT int
#define F_INT_NPY NPY_INT
#define F_INT npy_int32
#define F_INT_NPY NPY_INT32
#define F_INT_MAX NPY_MAX_INT32
#if NPY_BITSOF_SHORT == 32
#define F_INT_PYFMT "h"
#elif NPY_BITSOF_INT == 32
#define F_INT_PYFMT "i"
#elif NPY_BITSOF_LONG == 32
#define F_INT_PYFMT "l"
#else
#error No compatible 32-bit integer size. \
Please contact NumPy maintainers and give detailed information about your \
compiler and platform
#endif
#endif
@ -160,7 +167,7 @@ static PyObject *
fitpack_bispev(PyObject *dummy, PyObject *args)
{
F_INT nx, ny, kx, ky, mx, my, lwrk, *iwrk, kwrk, ier, lwa, nux, nuy;
npy_intp mxy;
npy_intp int_max, mxy;
double *tx, *ty, *c, *x, *y, *z, *wrk, *wa = NULL;
PyArrayObject *ap_x = NULL, *ap_y = NULL, *ap_z = NULL, *ap_tx = NULL;
PyArrayObject *ap_ty = NULL, *ap_c = NULL;
@ -191,14 +198,19 @@ fitpack_bispev(PyObject *dummy, PyObject *args)
ny = PyArray_DIMS(ap_ty)[0];
mx = PyArray_DIMS(ap_x)[0];
my = PyArray_DIMS(ap_y)[0];
mxy = mx*my;
if (my != 0 && mxy/my != mx) {
/* Limit is min of (largest array size, max of Fortran int) */
int_max = (F_INT_MAX < NPY_MAX_INTP) ? F_INT_MAX : NPY_MAX_INTP;
/* v = int_max/my is largest integer multiple of `my` such that
v * my <= int_max
*/
if (my != 0 && int_max/my < mx) {
/* Integer overflow */
PyErr_Format(PyExc_RuntimeError,
"Cannot produce output of size %dx%d (size too large)",
mx, my);
goto fail;
}
mxy = (npy_intp)mx * (npy_intp)my;
ap_z = (PyArrayObject *)PyArray_SimpleNew(1,&mxy,NPY_DOUBLE);
if (ap_z == NULL) {
goto fail;

View File

@ -685,7 +685,7 @@ static F_INT calc_regrid_lwrk(F_INT mx, F_INT my, F_INT kx, F_INT ky,
real*8 optional :: r1
real*8 optional,check(0.0<=s) :: s = 0.0
integer intent(hide),depend(mu),check(nuest>=8) &
:: nuest = mu+6
:: nuest = mu+6+2
integer intent(hide),depend(mv),check(nvest>=8) &
:: nvest = mv+7
integer intent(out) :: nu

View File

@ -943,6 +943,29 @@ class TestInterp:
b = make_interp_spline(self.xx, self.yy, k=1, axis=-1)
assert_allclose(b(self.xx), self.yy, atol=1e-14, rtol=1e-14)
@pytest.mark.parametrize('k', [0, 1, 2, 3])
def test_incompatible_x_y(self, k):
x = [0, 1, 2, 3, 4, 5]
y = [0, 1, 2, 3, 4, 5, 6, 7]
with assert_raises(ValueError, match="Shapes of x"):
make_interp_spline(x, y, k=k)
@pytest.mark.parametrize('k', [0, 1, 2, 3])
def test_broken_x(self, k):
x = [0, 1, 1, 2, 3, 4] # duplicates
y = [0, 1, 2, 3, 4, 5]
with assert_raises(ValueError, match="x to not have duplicates"):
make_interp_spline(x, y, k=k)
x = [0, 2, 1, 3, 4, 5] # unsorted
with assert_raises(ValueError, match="Expect x to be a 1D strictly"):
make_interp_spline(x, y, k=k)
x = [0, 1, 2, 3, 4, 5]
x = np.asarray(x).reshape((1, -1)) # 1D
with assert_raises(ValueError, match="Expect x to be a 1D strictly"):
make_interp_spline(x, y, k=k)
def test_not_a_knot(self):
for k in [3, 5]:
b = make_interp_spline(self.xx, self.yy, k)

View File

@ -325,6 +325,33 @@ class TestUnivariateSpline:
assert_allclose(spl1([0.1, 0.5, 0.9, 0.99]),
spl2([0.1, 0.5, 0.9, 0.99]))
def test_fpknot_oob_crash(self):
# https://github.com/scipy/scipy/issues/3691
x = range(109)
y = [0., 0., 0., 0., 0., 10.9, 0., 11., 0.,
0., 0., 10.9, 0., 0., 0., 0., 0., 0.,
10.9, 0., 0., 0., 11., 0., 0., 0., 10.9,
0., 0., 0., 10.5, 0., 0., 0., 10.7, 0.,
0., 0., 11., 0., 0., 0., 0., 0., 0.,
10.9, 0., 0., 10.7, 0., 0., 0., 10.6, 0.,
0., 0., 10.5, 0., 0., 10.7, 0., 0., 10.5,
0., 0., 11.5, 0., 0., 0., 10.7, 0., 0.,
10.7, 0., 0., 10.9, 0., 0., 10.8, 0., 0.,
0., 10.7, 0., 0., 10.6, 0., 0., 0., 10.4,
0., 0., 10.6, 0., 0., 10.5, 0., 0., 0.,
10.7, 0., 0., 0., 10.4, 0., 0., 0., 10.8, 0.]
with suppress_warnings() as sup:
r = sup.record(
UserWarning,
r"""
The maximal number of iterations maxit \(set to 20 by the program\)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs\(fp-s\)/s < tol.""")
UnivariateSpline(x, y, k=1)
assert_equal(len(r), 1)
class TestLSQBivariateSpline:
# NOTE: The systems in this test class are rank-deficient
@ -1209,6 +1236,20 @@ class TestRectSphereBivariateSpline:
[-49.0625, -46.54315]])
assert_array_almost_equal(data_interp, ans)
def test_pole_continuity_gh_14591(self):
# regression test for https://github.com/scipy/scipy/issues/14591
# with pole_continuty=(True, True), the internal work array size
# was too small, leading to a FITPACK data validation error.
# The reproducer in gh-14591 was using a NetCDF4 file with
# 361x507 arrays, so here we trivialize array sizes to a minimum
# which still demonstrates the issue.
u = np.arange(1, 10) * np.pi / 10
v = np.arange(1, 10) * np.pi / 10
r = np.zeros((9, 9))
for p in [(True, True), (True, False), (False, False)]:
RectSphereBivariateSpline(u, v, r, s=0, pole_continuity=p)
def _numdiff_2d(func, x, y, dx=0, dy=0, eps=1e-8):
if dx == 0 and dy == 0:

View File

@ -122,6 +122,28 @@ class TestInterp1D:
self.y235 = np.arange(30.).reshape((2, 3, 5))
self.y325 = np.arange(30.).reshape((3, 2, 5))
# Edge updated test matrix 1
# array([[ 30, 1, 2, 3, 4, 5, 6, 7, 8, -30],
# [ 30, 11, 12, 13, 14, 15, 16, 17, 18, -30]])
self.y210_edge_updated = np.arange(20.).reshape((2, 10))
self.y210_edge_updated[:, 0] = 30
self.y210_edge_updated[:, -1] = -30
# Edge updated test matrix 2
# array([[ 30, 30],
# [ 2, 3],
# [ 4, 5],
# [ 6, 7],
# [ 8, 9],
# [ 10, 11],
# [ 12, 13],
# [ 14, 15],
# [ 16, 17],
# [-30, -30]])
self.y102_edge_updated = np.arange(20.).reshape((10, 2))
self.y102_edge_updated[0, :] = 30
self.y102_edge_updated[-1, :] = -30
self.fill_value = -100.0
def test_validation(self):
@ -386,6 +408,36 @@ class TestInterp1D:
bounds_error=True)
assert_raises(ValueError, interp1d, self.x10, self.y10, **opts)
# Tests for gh-16813
interpolator1D = interp1d([0, 1, 2],
[0, 1, -1], kind="previous",
fill_value='extrapolate',
assume_sorted=True)
assert_allclose(interpolator1D([-2, -1, 0, 1, 2, 3, 5]),
[np.nan, np.nan, 0, 1, -1, -1, -1])
interpolator1D = interp1d([2, 0, 1], # x is not ascending
[-1, 0, 1], kind="previous",
fill_value='extrapolate',
assume_sorted=False)
assert_allclose(interpolator1D([-2, -1, 0, 1, 2, 3, 5]),
[np.nan, np.nan, 0, 1, -1, -1, -1])
interpolator2D = interp1d(self.x10, self.y210_edge_updated,
kind="previous",
fill_value='extrapolate')
assert_allclose(interpolator2D([-1, -2, 5, 8, 12, 25]),
[[np.nan, np.nan, 5, 8, -30, -30],
[np.nan, np.nan, 15, 18, -30, -30]])
interpolator2DAxis0 = interp1d(self.x10, self.y102_edge_updated,
kind="previous",
axis=0, fill_value='extrapolate')
assert_allclose(interpolator2DAxis0([-2, 5, 12]),
[[np.nan, np.nan],
[10, 11],
[-30, -30]])
def test_next(self):
# Check the actual implementation of next interpolation.
interp10 = interp1d(self.x10, self.y10, kind='next')
@ -425,6 +477,36 @@ class TestInterp1D:
bounds_error=True)
assert_raises(ValueError, interp1d, self.x10, self.y10, **opts)
# Tests for gh-16813
interpolator1D = interp1d([0, 1, 2],
[0, 1, -1], kind="next",
fill_value='extrapolate',
assume_sorted=True)
assert_allclose(interpolator1D([-2, -1, 0, 1, 2, 3, 5]),
[0, 0, 0, 1, -1, np.nan, np.nan])
interpolator1D = interp1d([2, 0, 1], # x is not ascending
[-1, 0, 1], kind="next",
fill_value='extrapolate',
assume_sorted=False)
assert_allclose(interpolator1D([-2, -1, 0, 1, 2, 3, 5]),
[0, 0, 0, 1, -1, np.nan, np.nan])
interpolator2D = interp1d(self.x10, self.y210_edge_updated,
kind="next",
fill_value='extrapolate')
assert_allclose(interpolator2D([-1, -2, 5, 8, 12, 25]),
[[30, 30, 5, 8, np.nan, np.nan],
[30, 30, 15, 18, np.nan, np.nan]])
interpolator2DAxis0 = interp1d(self.x10, self.y102_edge_updated,
kind="next",
axis=0, fill_value='extrapolate')
assert_allclose(interpolator2DAxis0([-2, 5, 12]),
[[30, 30],
[10, 11],
[np.nan, np.nan]])
def test_zero(self):
# Check the actual implementation of zero-order spline interpolation.
interp10 = interp1d(self.x10, self.y10, kind='zero')

View File

@ -801,3 +801,13 @@ class TestInterpN:
match = "must be strictly ascending or descending"
with pytest.raises(ValueError, match=match):
interpn((x, y), z, xi)
def test_invalid_xi_dimensions(self):
# https://github.com/scipy/scipy/issues/16519
points = [(0, 1)]
values = [0, 1]
xi = np.ones((1, 1, 3))
msg = ("The requested sample points xi have dimension 3, but this "
"RegularGridInterpolator has dimension 1")
with assert_raises(ValueError, match=msg):
interpn(points, values, xi)

View File

@ -13,6 +13,7 @@
import os
import sys
import numpy as np
from numpy import (asarray, real, imag, conj, zeros, ndarray, concatenate,
ones, can_cast)
@ -382,8 +383,10 @@ class MMFile:
else:
if issymm and aij != aji:
issymm = False
if isskew and aij != -aji:
isskew = False
with np.errstate(over="ignore"):
# This can give a warning for uint dtypes, so silence that
if isskew and aij != -aji:
isskew = False
if isherm and aij != conj(aji):
isherm = False
if not (issymm or isskew or isherm):

View File

@ -421,7 +421,7 @@ def arr_to_chars(arr):
arr = np.ndarray(shape=dims,
dtype=arr_dtype_number(arr, 1),
buffer=arr)
empties = [arr == '']
empties = [arr == np.array('', dtype=arr.dtype)]
if not np.any(empties):
return arr
arr = arr.copy()

View File

@ -1,10 +1,3 @@
fortran_ignore_warnings = [
'-Wno-tabs', '-Wno-conversion',
'-Wno-argument-mismatch', '-Wno-unused-dummy-argument',
'-Wno-maybe-uninitialized', '-Wno-unused-label',
'-Wno-unused-variable'
]
_test_fortran_module = custom_target('_test_fortran_module',
output: ['_test_fortranmodule.c'],
input: '_test_fortran.pyf',
@ -17,7 +10,7 @@ _test_fortran = py3.extension_module('_test_fortran',
fortranobject_c,
'_test_fortran.f'
],
c_args: [numpy_nodepr_api, '-Wno-unused-variable'],
c_args: [numpy_nodepr_api, Wno_unused_variable],
fortran_args: fortran_ignore_warnings,
include_directories: [incdir_numpy, incdir_f2py],
dependencies: [py3_dep, lapack],

View File

@ -772,10 +772,10 @@ subroutine <prefix2>syevr(compute_v,range,lower,n,a,lda,vl,vu,il,iu,abstol,w,z,m
integer intent(hide),dimension(liwork),depend(liwork) :: iwork
<ftype2> intent(out),dimension(n),depend(n) :: w
<ftype2> intent(out),dimension((compute_v?MAX(0,n):0),(compute_v?(*range=='I'?iu-il+1:MAX(1,n)):0)),depend(n,compute_v,range,iu,il) :: z
<ftype2> intent(out),dimension((compute_v?MAX(0,n):0),(compute_v?((*range=='I')?(iu-il+1):MAX(1,n)):0)),depend(n,compute_v,range,iu,il) :: z
integer intent(out) :: m
! Only returned if range=='A' or range=='I' and il, iu = 1, n
integer intent(out),dimension((compute_v?(2*(*range=='A'||(*range=='I' && iu-il+1==n)?n:0)):0)),depend(n,iu,il,compute_v,range) :: isuppz
integer intent(out),dimension((compute_v?(2*((*range=='A')||((*range=='I') && (iu-il+1==n))?n:0)):0)),depend(n,iu,il,compute_v,range) :: isuppz
integer intent(out) :: info
end subroutine <prefix2>syevr
@ -844,7 +844,7 @@ subroutine <prefix2c>heevr(compute_v,range,lower,n,a,lda,vl,vu,il,iu,abstol,w,z,
integer intent(hide),dimension(liwork),depend(liwork) :: iwork
<ftype2> intent(out),dimension(n),depend(n) :: w
<ftype2c> intent(out),dimension((compute_v?MAX(0,n):0),(compute_v?(*range=='I'?iu-il+1:MAX(1,n)):0)),depend(n,compute_v,range,iu,il) :: z
<ftype2c> intent(out),dimension((compute_v?MAX(0,n):0),(compute_v?((*range=='I')?(iu-il+1):MAX(1,n)):0)),depend(n,compute_v,range,iu,il) :: z
integer intent(out) :: m
! MKL implementation has a bug that still accesses isuppz array even if
! range=='A' or range=='I' and il, iu = 1, n which is not the case for
@ -852,7 +852,7 @@ subroutine <prefix2c>heevr(compute_v,range,lower,n,a,lda,vl,vu,il,iu,abstol,w,z,
! of the settings. It is wasteful but necessary. The bug is fixed in
! mkl 2020 update 2 and when time comes change this line with
!
! integer intent(out),dimension((compute_v?(2*(*range=='A'||(*range=='I' && iu-il+1==n)?n:0)):0)),depend(n,iu,il,range,compute_v) :: isuppz
! integer intent(out),dimension((compute_v?(2*(*range=='A'||((*range=='I') && (iu-il+1==n))?n:0)):0)),depend(n,iu,il,range,compute_v) :: isuppz
!
integer intent(out),dimension(2*max(1,n)),depend(n) :: isuppz
integer intent(out) :: info
@ -919,7 +919,7 @@ subroutine <prefix2>syevx(compute_v,range,lower,n,a,lda,vl,vu,il,iu,abstol,w,z,m
integer intent(hide),dimension(5*n),depend(n) :: iwork
<ftype2> intent(out),dimension(n),depend(n) :: w
<ftype2> intent(out),dimension((compute_v?MAX(0,n):0),(compute_v?(*range=='I'?iu-il+1:MAX(1,n)):0)),depend(n,compute_v,range,iu,il) :: z
<ftype2> intent(out),dimension((compute_v?MAX(0,n):0),(compute_v?((*range=='I')?(iu-il+1):MAX(1,n)):0)),depend(n,compute_v,range,iu,il) :: z
integer intent(out) :: m
integer intent(out),dimension((compute_v?n:0)),depend(compute_v,n):: ifail
integer intent(out) :: info
@ -984,7 +984,7 @@ subroutine <prefix2c>heevx(compute_v,range,lower,n,a,lda,vl,vu,il,iu,abstol,w,z,
<ftype2> intent(hide),dimension(7*n),depend(n) :: rwork
<ftype2> intent(out),dimension(n),depend(n) :: w
<ftype2c> intent(out),dimension((compute_v*n),(compute_v?(*range=='I'?iu-il+1:MAX(1,n)):0)),depend(compute_v,range,n,iu,il) :: z
<ftype2c> intent(out),dimension((compute_v*n),(compute_v?((*range=='I')?(iu-il+1):MAX(1,n)):0)),depend(compute_v,range,n,iu,il) :: z
integer intent(out) :: m
integer intent(out),dimension(compute_v*n),depend(compute_v,n):: ifail
integer intent(out) :: info
@ -1222,7 +1222,7 @@ subroutine <prefix2>sygvx(itype,jobz,range,uplo,n,a,lda,b,ldb,vl,vu,il,iu,abstol
integer intent(hide),dimension(5*n),depend(n) :: iwork
<ftype2> intent(out),dimension(n),depend(n) :: w
<ftype2> intent(out),dimension((jobz[0]=='V'?MAX(0,n):0),(jobz[0]=='V'?(range[0]=='I'?iu-il+1:MAX(1,n)):0)),depend(n,jobz,range,iu,il) :: z
<ftype2> intent(out),dimension((jobz[0]=='V'?MAX(0,n):0),(jobz[0]=='V'?((range[0]=='I')?(iu-il+1):MAX(1,n)):0)),depend(n,jobz,range,iu,il) :: z
integer intent(out) :: m
integer intent(out),dimension((jobz[0]=='N'?0:n)),depend(jobz,n):: ifail
integer intent(out) :: info
@ -1293,7 +1293,7 @@ subroutine <prefix2c>hegvx(itype,jobz,range,uplo,n,a,lda,b,ldb,vl,vu,il,iu,absto
<ftype2> intent(hide),dimension(7*n),depend(n) :: rwork
<ftype2> intent(out),dimension(n),depend(n) :: w
<ftype2c> intent(out),dimension((jobz[0]=='V'?MAX(0,n):0),(jobz[0]=='V'?(range[0]=='I'?iu-il+1:MAX(1,n)):0)),depend(n,jobz,range,iu,il) :: z
<ftype2c> intent(out),dimension((jobz[0]=='V'?MAX(0,n):0),(jobz[0]=='V'?((range[0]=='I')?(iu-il+1):MAX(1,n)):0)),depend(n,jobz,range,iu,il) :: z
integer intent(out) :: m
integer intent(out),dimension((jobz[0]=='N'?0:n)),depend(jobz,n):: ifail
integer intent(out) :: info

View File

@ -25,10 +25,10 @@ cython_linalg = custom_target('cython_linalg',
],
input: '_generate_pyx.py',
command: [py3, '@INPUT@', '-o', '@OUTDIR@'],
# FIXME - we only want to install the .pxd files! See comments for
# `pxd_files` further down.
# TODO - we only want to install the .pxd files! See comments for
# `pxd_files` further down.
install: true,
install_dir: py3.get_install_dir() + 'scipy/linalg'
install_dir: py3.get_install_dir(pure: false) / 'scipy/linalg'
)
# pyx -> c, pyx -> cpp generators, depending on __init__.py here.
@ -77,16 +77,15 @@ flapack_module = custom_target('flapack_module',
command: [py3, generate_f2pymod, '@INPUT@', '-o', '@OUTDIR@']
)
# Note that -Wno-empty-body is Clang-specific and comes from `callstatement`s
# in flapack_other.pyf.src
py3.extension_module('_flapack',
[
flapack_module,
fortranobject_c,
g77_abi_wrappers,
],
c_args: [
numpy_nodepr_api,
'-Wno-empty-body', # comes from `callstatement`s in flapack_other.pyf.src
],
c_args: [numpy_nodepr_api, Wno_empty_body],
include_directories: [inc_np, inc_f2py],
dependencies: [py3_dep, lapack],
install: true,
@ -162,11 +161,7 @@ py3.extension_module('_interpolative',
fortranobject_c
],
c_args: numpy_nodepr_api,
fortran_args: [
'-Wno-tabs', '-Wno-conversion', '-Wno-argument-mismatch',
'-Wno-unused-dummy-argument', '-Wno-maybe-uninitialized'
],
# TODO: add -fallow-argument-mismatch for gfortran >= 10, see gh-11842
fortran_args: fortran_ignore_warnings,
include_directories: [inc_np, inc_f2py],
dependencies: [py3_dep, lapack],
install: true,
@ -267,7 +262,7 @@ py3.extension_module('_matfuncs_expm',
_cythonized_array_utils = py3.extension_module('_cythonized_array_utils',
linalg_init_utils_cython_gen.process('_cythonized_array_utils.pyx'),
c_args: [cython_c_args, c_undefined_ok],
c_args: [cython_c_args, Wno_maybe_uninitialized],
dependencies: [py3_dep],
include_directories: [inc_np],
install: true,
@ -332,7 +327,7 @@ py3.install_sources(
# https://mesonbuild.com/Installing.html says is for build targets to
# use:
# `custom_target(..., install: true, install_dir: ...)
# # should use `py3.get_install_dir() + 'scipy/linalg'` ?
# # should use `py3.get_install_dir(pure: false) / 'scipy/linalg'` ?
# see https://github.com/mesonbuild/meson/issues/3206
#
# For the below code to work, the script generating the files should use
@ -350,7 +345,7 @@ py3.install_sources(
# output : ['cython_blas2.pxd', 'cython_lapack2.pxd'],
# command : ['cp', '@INPUT0@', '@OUTPUT0@', '&&', 'cp', '@INPUT1@', '@OUTPUT1@'],
# install : true,
# install_dir: py3.get_install_dir() + 'scipy/linalg'
# install_dir: py3.get_install_dir(pure: false) / 'scipy/linalg'
#)
subdir('tests')

View File

@ -10,6 +10,7 @@ Run tests if scipy is installed:
import itertools
import platform
import sys
import numpy as np
from numpy.testing import (assert_equal, assert_almost_equal,
assert_array_almost_equal, assert_array_equal,
@ -1899,84 +1900,43 @@ class TestRQ:
class TestSchur:
def check_schur(self, a, t, u, rtol, atol):
# Check that the Schur decomposition is correct.
assert_allclose(u @ t @ u.conj().T, a, rtol=rtol, atol=atol,
err_msg="Schur decomposition does not match 'a'")
# The expected value of u @ u.H - I is all zeros, so test
# with absolute tolerance only.
assert_allclose(u @ u.conj().T - np.eye(len(u)), 0, rtol=0, atol=atol,
err_msg="u is not unitary")
def test_simple(self):
a = [[8, 12, 3], [2, 9, 3], [10, 3, 6]]
t, z = schur(a)
assert_array_almost_equal(z @ t @ z.conj().T, a)
self.check_schur(a, t, z, rtol=1e-14, atol=5e-15)
tc, zc = schur(a, 'complex')
assert_(np.any(ravel(iscomplex(zc))) and np.any(ravel(iscomplex(tc))))
assert_array_almost_equal(zc @ tc @ zc.conj().T, a)
self.check_schur(a, tc, zc, rtol=1e-14, atol=5e-15)
tc2, zc2 = rsf2csf(tc, zc)
assert_array_almost_equal(zc2 @ tc2 @ zc2.conj().T, a)
self.check_schur(a, tc2, zc2, rtol=1e-14, atol=5e-15)
def test_sort(self):
@pytest.mark.parametrize(
'sort, expected_diag',
[('lhp', [-np.sqrt(2), -0.5, np.sqrt(2), 0.5]),
('rhp', [np.sqrt(2), 0.5, -np.sqrt(2), -0.5]),
('iuc', [-0.5, 0.5, np.sqrt(2), -np.sqrt(2)]),
('ouc', [np.sqrt(2), -np.sqrt(2), -0.5, 0.5]),
(lambda x: x >= 0.0, [np.sqrt(2), 0.5, -np.sqrt(2), -0.5])]
)
def test_sort(self, sort, expected_diag):
# The exact eigenvalues of this matrix are
# -sqrt(2), sqrt(2), -1/2, 1/2.
a = [[4., 3., 1., -1.],
[-4.5, -3.5, -1., 1.],
[9., 6., -4., 4.5],
[6., 4., -3., 3.5]]
s, u, sdim = schur(a, sort='lhp')
assert_array_almost_equal([[0.1134, 0.5436, 0.8316, 0.],
[-0.1134, -0.8245, 0.5544, 0.],
[-0.8213, 0.1308, 0.0265, -0.5547],
[-0.5475, 0.0872, 0.0177, 0.8321]],
u, 3)
assert_array_almost_equal([[-1.4142, 0.1456, -11.5816, -7.7174],
[0., -0.5000, 9.4472, -0.7184],
[0., 0., 1.4142, -0.1456],
[0., 0., 0., 0.5]],
s, 3)
assert_equal(2, sdim)
s, u, sdim = schur(a, sort='rhp')
assert_array_almost_equal([[0.4862, -0.4930, 0.1434, -0.7071],
[-0.4862, 0.4930, -0.1434, -0.7071],
[0.6042, 0.3944, -0.6924, 0.],
[0.4028, 0.5986, 0.6924, 0.]],
u, 3)
assert_array_almost_equal([[1.4142, -0.9270, 4.5368, -14.4130],
[0., 0.5, 6.5809, -3.1870],
[0., 0., -1.4142, 0.9270],
[0., 0., 0., -0.5]],
s, 3)
assert_equal(2, sdim)
s, u, sdim = schur(a, sort='iuc')
assert_array_almost_equal([[0.5547, 0., -0.5721, -0.6042],
[-0.8321, 0., -0.3814, -0.4028],
[0., 0.7071, -0.5134, 0.4862],
[0., 0.7071, 0.5134, -0.4862]],
u, 3)
assert_array_almost_equal([[-0.5000, 0.0000, -6.5809, -4.0974],
[0., 0.5000, -3.3191, -14.4130],
[0., 0., 1.4142, 2.1573],
[0., 0., 0., -1.4142]],
s, 3)
assert_equal(2, sdim)
s, u, sdim = schur(a, sort='ouc')
assert_array_almost_equal([[0.4862, -0.5134, 0.7071, 0.],
[-0.4862, 0.5134, 0.7071, 0.],
[0.6042, 0.5721, 0., -0.5547],
[0.4028, 0.3814, 0., 0.8321]],
u, 3)
assert_array_almost_equal([[1.4142, -2.1573, 14.4130, 4.0974],
[0., -1.4142, 3.3191, 6.5809],
[0., 0., -0.5000, 0.],
[0., 0., 0., 0.5000]],
s, 3)
assert_equal(2, sdim)
s, u, sdim = schur(a, sort=lambda x: x >= 0.0)
assert_array_almost_equal([[0.4862, -0.4930, 0.1434, -0.7071],
[-0.4862, 0.4930, -0.1434, -0.7071],
[0.6042, 0.3944, -0.6924, 0.],
[0.4028, 0.5986, 0.6924, 0.]],
u, 3)
assert_array_almost_equal([[1.4142, -0.9270, 4.5368, -14.4130],
[0., 0.5, 6.5809, -3.1870],
[0., 0., -1.4142, 0.9270],
[0., 0., 0., -0.5]],
s, 3)
t, u, sdim = schur(a, sort=sort)
self.check_schur(a, t, u, rtol=1e-14, atol=5e-15)
assert_allclose(np.diag(t), expected_diag, rtol=1e-12)
assert_equal(2, sdim)
def test_sort_errors(self):
@ -2072,6 +2032,8 @@ class TestQZ:
def setup_method(self):
seed(12345)
@pytest.mark.xfail(sys.platform == 'darwin',
reason="gges[float32] broken for OpenBLAS on macOS, see gh-16949")
def test_qz_single(self):
n = 5
A = random([n, n]).astype(float32)

View File

@ -3,8 +3,6 @@
#
import sys
import subprocess
import time
from functools import reduce
from numpy.testing import (assert_equal, assert_array_almost_equal, assert_,
@ -746,39 +744,32 @@ def test_larfg_larf():
assert_allclose(a[0, :], expected, atol=1e-5)
@pytest.mark.xslow
def test_sgesdd_lwork_bug_workaround():
# Test that SGESDD lwork is sufficiently large for LAPACK.
#
# This checks that workaround around an apparent LAPACK bug
# actually works. cf. gh-5401
#
# xslow: requires 1GB+ of memory
# This checks that _compute_lwork() correctly works around a bug in
# LAPACK versions older than 3.10.1.
p = subprocess.Popen([sys.executable, '-c',
'import numpy as np; '
'from scipy.linalg import svd; '
'a = np.zeros([9537, 9537], dtype=np.float32); '
'svd(a)'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
# Check if it an error occurred within 5 sec; the computation can
# take substantially longer, and we will not wait for it to finish
for j in range(50):
time.sleep(0.1)
if p.poll() is not None:
returncode = p.returncode
break
else:
# Didn't exit in time -- probably entered computation. The
# error is raised before entering computation, so things are
# probably OK.
returncode = 0
p.terminate()
assert_equal(returncode, 0,
"Code apparently failed: " + p.stdout.read().decode())
sgesdd_lwork = get_lapack_funcs('gesdd_lwork', dtype=np.float32,
ilp64='preferred')
n = 9537
lwork = _compute_lwork(sgesdd_lwork, n, n,
compute_uv=True, full_matrices=True)
# If we called the Fortran function SGESDD directly with IWORK=-1, the
# LAPACK bug would result in lwork being 272929856, which was too small.
# (The result was returned in a single precision float, which does not
# have sufficient precision to represent the exact integer value that it
# computed internally.) The work-around implemented in _compute_lwork()
# will convert that to 272929888. If we are using LAPACK 3.10.1 or later
# (such as in OpenBLAS 0.3.21 or later), the work-around will return
# 272929920, because it does not know which version of LAPACK is being
# used, so it always applies the correction to whatever it is given. We
# will accept either 272929888 or 272929920.
# Note that the acceptable values are a LAPACK implementation detail.
# If a future version of LAPACK changes how SGESDD works, and therefore
# changes the required LWORK size, the acceptable values might have to
# be updated.
assert lwork == 272929888 or lwork == 272929920
class TestSytrd:
@ -2832,6 +2823,7 @@ def test_ptsvx(dtype, realtype, fact, df_de_lambda):
assert_(berr.shape == (2,), "berr.shape is {} but shoud be ({},)"
.format(berr.shape, x_soln.shape[1]))
@pytest.mark.parametrize("dtype,realtype", zip(DTYPES, REAL_DTYPES
+ REAL_DTYPES))
@pytest.mark.parametrize("fact,df_de_lambda",
@ -2983,6 +2975,9 @@ def test_pptrs_pptri_pptrf_ppsv_ppcon(dtype, lower):
@pytest.mark.parametrize('dtype', DTYPES)
def test_gges_tgexc(dtype):
if dtype == np.float32 and sys.platform == 'darwin':
pytest.xfail("gges[float32] broken for OpenBLAS on macOS, see gh-16949")
seed(1234)
atol = np.finfo(dtype).eps*100

View File

@ -482,7 +482,7 @@ def test_solve_discrete_are():
np.eye(3),
1e6 * np.eye(3),
1e6 * np.eye(3),
None),
"Issue with OpenBLAS, see gh-16926"),
# TEST CASE 17 : darex #14
(np.array([[1 - 1/1e8, 0, 0, 0],
[1, 0, 0, 0],

View File

@ -1,5 +1,4 @@
# Platform detection
is_windows = host_machine.system() == 'windows'
is_mingw = is_windows and cc.get_id() == 'gcc'
cython_c_args = []
@ -7,17 +6,17 @@ if is_windows
# For mingw-w64, link statically against the UCRT.
gcc_link_args = ['-lucrt', '-static']
if is_mingw
add_global_link_arguments(gcc_link_args, language: ['c', 'cpp'])
add_project_link_arguments(gcc_link_args, language: ['c', 'cpp'])
# Force gcc to float64 long doubles for compatibility with MSVC
# builds, for C only.
add_global_arguments('-mlong-double-64', language: 'c')
add_project_arguments('-mlong-double-64', language: 'c')
# Make fprintf("%zd") work (see https://github.com/rgommers/scipy/issues/118)
add_global_arguments('-D__USE_MINGW_ANSI_STDIO=1', language: ['c', 'cpp'])
add_project_arguments('-D__USE_MINGW_ANSI_STDIO=1', language: ['c', 'cpp'])
# Manual add of MS_WIN64 macro when not using MSVC.
# https://bugs.python.org/issue28267
bitness = run_command('_build_utils/gcc_build_bitness.py').stdout().strip()
if bitness == '64'
add_global_arguments('-DMS_WIN64', language: ['c', 'cpp', 'fortran'])
add_project_arguments('-DMS_WIN64', language: ['c', 'cpp', 'fortran'])
endif
# Silence warnings emitted by PyOS_snprintf for (%zd), see
# https://github.com/rgommers/scipy/issues/118.
@ -25,17 +24,18 @@ if is_windows
cython_c_args += ['-Wno-format-extra-args', '-Wno-format']
endif
if meson.get_compiler('fortran').get_id() == 'gcc'
add_global_link_arguments(gcc_link_args, language: ['fortran'])
add_project_link_arguments(gcc_link_args, language: ['fortran'])
# Flag needed to work around BLAS and LAPACK Gfortran dependence on
# undocumented C feature when passing single character string
# arguments.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90329
# https://github.com/wch/r-source/blob/838f9d5a7be08f2a8c08e47bcd28756f5d0aac90/src/gnuwin32/MkRules.rules#L121
add_global_arguments('-fno-optimize-sibling-calls',
language: ['fortran'])
add_project_arguments('-fno-optimize-sibling-calls', language: ['fortran'])
endif
endif
thread_dep = dependency('threads', required: false)
# NumPy include directory - needed in all submodules
incdir_numpy = run_command(py3,
[
@ -91,6 +91,7 @@ else
inc_pythran = []
endif
# Note: warning flags are added to this further down
cpp_args_pythran = [
'-DENABLE_PYTHON_MODULE',
'-D__PYTHRAN__=3',
@ -117,10 +118,25 @@ numpy_nodepr_api = '-DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION'
# For MKL and for auto-detecting one of multiple libs, we'll need a custom
# dependency in Meson (like is done for scalapack) - see
# https://github.com/mesonbuild/meson/issues/2835
blas = dependency(get_option('blas'))
lapack = dependency(get_option('lapack'))
blas_name = get_option('blas')
lapack_name = get_option('lapack')
# pkg-config uses a lower-case name while CMake uses a capitalized name, so try
# that too to make the fallback detection with CMake work
if blas_name == 'openblas'
blas_name = ['openblas', 'OpenBLAS']
endif
if lapack_name == 'openblas'
lapack_name = ['openblas', 'OpenBLAS']
endif
blas = dependency(blas_name)
lapack = dependency(lapack_name)
if blas.name() == 'mkl' or lapack.name() == 'mkl' or get_option('use-g77-abi')
# FIXME: conda-forge sets MKL_INTERFACE_LAYER=LP64,GNU, see gh-11812.
# This needs work on gh-16200 to make MKL robust. We should be
# requesting `mkl-dynamic-lp64-seq` here. And then there's work needed
# in general to enable the ILP64 interface (also for OpenBLAS).
uses_mkl = blas.name().to_lower().startswith('mkl') or lapack.name().to_lower().startswith('mkl')
if uses_mkl or get_option('use-g77-abi')
g77_abi_wrappers = files([
'_build_utils/src/wrap_g77_abi_f.f',
'_build_utils/src/wrap_g77_abi_c.c'
@ -137,11 +153,9 @@ generate_config = custom_target(
output: '__config__.py',
input: '../tools/config_utils.py',
command: [py3, '@INPUT@', '@OUTPUT@'],
install_dir: py3.get_install_dir() + '/scipy'
install_dir: py3.get_install_dir(pure: false) / 'scipy'
)
#FIXME: the git revision is Unknown; script works when invoked directly, but
# not when it's run by Ninja. See https://github.com/rgommers/scipy/pull/57
generate_version = custom_target(
'generate-version',
install: true,
@ -150,13 +164,16 @@ generate_version = custom_target(
output: 'version.py',
input: '../tools/version_utils.py',
command: [py3, '@INPUT@', '--source-root', '@SOURCE_ROOT@'],
install_dir: py3.get_install_dir() + '/scipy'
install_dir: py3.get_install_dir(pure: false) / 'scipy'
)
python_sources = [
'__init__.py',
'_distributor_init.py',
'conftest.py'
'conftest.py',
'linalg.pxd',
'optimize.pxd',
'special.pxd'
]
py3.install_sources(
@ -176,14 +193,16 @@ _cython_tree = custom_target('_cython_tree',
output: [
'__init__.py',
'linalg.pxd',
'optimize.pxd',
'special.pxd'
],
input: [
'__init__.py',
'linalg.pxd',
'optimize.pxd',
'special.pxd'
],
command: [copier, '@INPUT@', '@OUTDIR@']
command: [copier, '@INPUT@', '@OUTDIR@'],
)
cython_tree = declare_dependency(sources: _cython_tree)
@ -199,12 +218,89 @@ cython_gen_cpp = generator(cython_cli,
output : '@BASENAME@.cpp',
depends : [_cython_tree])
c_undefined_ok = ['-Wno-maybe-uninitialized']
# Check if compiler flags are supported. This is necessary to ensure that SciPy
# can be built with any supported compiler. We need so many warning flags
# because we want to be able to build with `-Werror` in CI; that ensures that
# for new code we add, there are no unexpected new issues introduced.
#
# Cleaning up code so we no longer need some of these warning flags is useful,
# but not a priority.
#
# The standard convention used here is:
# - for C, drop the leading dash and turn remaining dashes into underscores
# - for C++, prepend `_cpp` and turn remaining dashes into underscores
# - for Fortran, prepend `_fflags` and turn remaining dashes into underscores
# C warning flags
Wno_maybe_uninitialized = cc.get_supported_arguments('-Wno-maybe-uninitialized')
Wno_discarded_qualifiers = cc.get_supported_arguments('-Wno-discarded-qualifiers')
Wno_empty_body = cc.get_supported_arguments('-Wno-empty-body')
Wno_implicit_function_declaration = cc.get_supported_arguments('-Wno-implicit-function-declaration')
Wno_parentheses = cc.get_supported_arguments('-Wno-parentheses')
Wno_switch = cc.get_supported_arguments('-Wno-switch')
Wno_unused_label = cc.get_supported_arguments('-Wno-unused-label')
Wno_unused_variable = cc.get_supported_arguments('-Wno-unused-variable')
# C++ warning flags
_cpp_Wno_cpp = cpp.get_supported_arguments('-Wno-cpp')
_cpp_Wno_deprecated_declarations = cpp.get_supported_arguments('-Wno-deprecated-declarations')
_cpp_Wno_class_memaccess = cpp.get_supported_arguments('-Wno-class-memaccess')
_cpp_Wno_format_truncation = cpp.get_supported_arguments('-Wno-format-truncation')
_cpp_Wno_non_virtual_dtor = cpp.get_supported_arguments('-Wno-non-virtual-dtor')
_cpp_Wno_sign_compare = cpp.get_supported_arguments('-Wno-sign-compare')
_cpp_Wno_switch = cpp.get_supported_arguments('-Wno-switch')
_cpp_Wno_terminate = cpp.get_supported_arguments('-Wno-terminate')
_cpp_Wno_unused_but_set_variable = cpp.get_supported_arguments('-Wno-unused-but-set-variable')
_cpp_Wno_unused_function = cpp.get_supported_arguments('-Wno-unused-function')
_cpp_Wno_unused_local_typedefs = cpp.get_supported_arguments('-Wno-unused-local-typedefs')
_cpp_Wno_unused_variable = cpp.get_supported_arguments('-Wno-unused-variable')
_cpp_Wno_int_in_bool_context = cpp.get_supported_arguments('-Wno-int-in-bool-context')
cpp_args_pythran += [
_cpp_Wno_cpp,
_cpp_Wno_deprecated_declarations,
_cpp_Wno_unused_but_set_variable,
_cpp_Wno_unused_function,
_cpp_Wno_unused_variable,
_cpp_Wno_int_in_bool_context,
]
# Fortran warning flags
_fflag_Wno_argument_mismatch = ff.get_supported_arguments('-Wno-argument-mismatch')
_fflag_Wno_conversion = ff.get_supported_arguments('-Wno-conversion')
_fflag_Wno_intrinsic_shadow = ff.get_supported_arguments('-Wno-intrinsic-shadow')
_fflag_Wno_maybe_uninitialized = ff.get_supported_arguments('-Wno-maybe-uninitialized')
_fflag_Wno_uninitialized = ff.get_supported_arguments('-Wno-uninitialized')
_fflag_Wno_unused_dummy_argument = ff.get_supported_arguments('-Wno-unused-dummy-argument')
_fflag_Wno_unused_label = ff.get_supported_arguments('-Wno-unused-label')
_fflag_Wno_unused_variable = ff.get_supported_arguments('-Wno-unused-variable')
_fflag_Wno_tabs = ff.get_supported_arguments('-Wno-tabs')
# The default list of warnings to ignore from Fortran code. There is a lot of
# old, vendored code that is very bad and we want to compile it silently (at
# least with GCC and Clang)
fortran_ignore_warnings = ff.get_supported_arguments(
_fflag_Wno_argument_mismatch,
_fflag_Wno_conversion,
_fflag_Wno_maybe_uninitialized,
_fflag_Wno_unused_dummy_argument,
_fflag_Wno_unused_label,
_fflag_Wno_unused_variable,
_fflag_Wno_tabs,
)
# Deal with M_PI & friends; add `use_math_defines` to c_args or cpp_args
# Cython doesn't always get this right itself (see, e.g., gh-16800), so
# explicitly add the define as a compiler flag for Cython-generated code.
if is_windows
use_math_defines = ['-D_USE_MATH_DEFINES']
else
use_math_defines = []
endif
# Suppress warning for deprecated Numpy API.
# (Suppress warning messages emitted by #warning directives).
# Replace with numpy_nodepr_api after Cython 3.0 is out
cython_c_args += ['-Wno-cpp']
cython_c_args += ['-Wno-cpp', use_math_defines]
cython_cpp_args = cython_c_args
# Ordering of subdirs: special and linalg come first, because other submodules

View File

@ -874,7 +874,7 @@ def rotate(input, angle, axes=(1, 0), reshape=True, output=None, order=3,
>>> ax2.set_axis_off()
>>> ax3.imshow(full_img_45, cmap='gray')
>>> ax3.set_axis_off()
>>> fig.set_tight_layout(True)
>>> fig.set_layout_engine('tight')
>>> plt.show()
>>> print(img.shape)
(512, 512)

View File

@ -257,7 +257,7 @@ class Data:
"""
def __init__(self, x, y=None, we=None, wd=None, fix=None, meta={}):
def __init__(self, x, y=None, we=None, wd=None, fix=None, meta=None):
self.x = _conv(x)
if not isinstance(self.x, numpy.ndarray):
@ -269,7 +269,7 @@ class Data:
self.we = _conv(we)
self.wd = _conv(wd)
self.fix = _conv(fix)
self.meta = meta
self.meta = {} if meta is None else meta
def set_meta(self, **kwds):
""" Update the metadata dictionary with the keywords and data provided
@ -355,7 +355,7 @@ class RealData(Data):
"""
def __init__(self, x, y=None, sx=None, sy=None, covx=None, covy=None,
fix=None, meta={}):
fix=None, meta=None):
if (sx is not None) and (covx is not None):
raise ValueError("cannot set both sx and covx")
if (sy is not None) and (covy is not None):
@ -385,7 +385,7 @@ class RealData(Data):
self.covx = _conv(covx)
self.covy = _conv(covy)
self.fix = _conv(fix)
self.meta = meta
self.meta = {} if meta is None else meta
def _sd2wt(self, sd):
""" Convert standard deviation to weights.
@ -506,7 +506,7 @@ class Model:
"""
def __init__(self, fcn, fjacb=None, fjacd=None,
extra_args=None, estimate=None, implicit=0, meta=None):
extra_args=None, estimate=None, implicit=0, meta=None):
self.fcn = fcn
self.fjacb = fjacb
@ -518,7 +518,7 @@ class Model:
self.extra_args = extra_args
self.estimate = estimate
self.implicit = implicit
self.meta = meta
self.meta = meta if meta is not None else {}
def set_meta(self, **kwds):
""" Update the metadata dictionary with the keywords and data provided

View File

@ -5,7 +5,7 @@ odrpack = static_library('odrpack',
'odrpack/d_odr.f',
'odrpack/dlunoc.f'
],
fortran_args: '-Wno-conversion', # silence "conversion from REAL(8) to INTEGER(4)"
fortran_args: _fflag_Wno_conversion, # silence "conversion from REAL(8) to INTEGER(4)"
)
py3.extension_module('__odrpack',

View File

@ -524,3 +524,10 @@ class TestODR:
# remove output files for clean up
shutil.rmtree(tmp_dir)
def test_odr_model_default_meta(self):
def func(b, x):
return b[0] + b[1] * x
p = Model(func)
p.set_meta(name='Sample Model Meta', ref='ODRPACK')
assert_equal(p.meta, {'name': 'Sample Model Meta', 'ref': 'ODRPACK'})

View File

@ -5,14 +5,14 @@
double
bisect(callback_type f, double xa, double xb, double xtol, double rtol,
int iter, void *func_data, scipy_zeros_info *solver_stats)
int iter, void *func_data_param, scipy_zeros_info *solver_stats)
{
int i;
double dm,xm,fm,fa,fb;
solver_stats->error_num = INPROGRESS;
fa = (*f)(xa, func_data);
fb = (*f)(xb, func_data);
fa = (*f)(xa, func_data_param);
fb = (*f)(xb, func_data_param);
solver_stats->funcalls = 2;
if (fa*fb > 0) {
solver_stats->error_num = SIGNERR;
@ -32,7 +32,7 @@ bisect(callback_type f, double xa, double xb, double xtol, double rtol,
solver_stats->iterations++;
dm *= .5;
xm = xa + dm;
fm = (*f)(xm, func_data);
fm = (*f)(xm, func_data_param);
solver_stats->funcalls++;
if (fm*fa >= 0) {
xa = xm;

View File

@ -36,7 +36,7 @@
double
brenth(callback_type f, double xa, double xb, double xtol, double rtol,
int iter, void *func_data, scipy_zeros_info *solver_stats)
int iter, void *func_data_param, scipy_zeros_info *solver_stats)
{
double xpre = xa, xcur = xb;
double xblk = 0., fpre, fcur, fblk = 0., spre = 0., scur = 0., sbis;
@ -46,8 +46,8 @@ brenth(callback_type f, double xa, double xb, double xtol, double rtol,
int i;
solver_stats->error_num = INPROGRESS;
fpre = (*f)(xpre,func_data);
fcur = (*f)(xcur,func_data);
fpre = (*f)(xpre,func_data_param);
fcur = (*f)(xcur,func_data_param);
solver_stats->funcalls = 2;
if (fpre*fcur > 0) {
solver_stats->error_num = SIGNERR;
@ -125,7 +125,7 @@ brenth(callback_type f, double xa, double xb, double xtol, double rtol,
xcur += (sbis > 0 ? delta : -delta);
}
fcur = (*f)(xcur, func_data);
fcur = (*f)(xcur, func_data_param);
solver_stats->funcalls++;
}
solver_stats->error_num = CONVERR;

View File

@ -35,7 +35,7 @@
double
brentq(callback_type f, double xa, double xb, double xtol, double rtol,
int iter, void *func_data, scipy_zeros_info *solver_stats)
int iter, void *func_data_param, scipy_zeros_info *solver_stats)
{
double xpre = xa, xcur = xb;
double xblk = 0., fpre, fcur, fblk = 0., spre = 0., scur = 0., sbis;
@ -45,8 +45,8 @@ brentq(callback_type f, double xa, double xb, double xtol, double rtol,
int i;
solver_stats->error_num = INPROGRESS;
fpre = (*f)(xpre, func_data);
fcur = (*f)(xcur, func_data);
fpre = (*f)(xpre, func_data_param);
fcur = (*f)(xcur, func_data_param);
solver_stats->funcalls = 2;
if (fpre*fcur > 0) {
solver_stats->error_num = SIGNERR;
@ -123,7 +123,7 @@ brentq(callback_type f, double xa, double xb, double xtol, double rtol,
xcur += (sbis > 0 ? delta : -delta);
}
fcur = (*f)(xcur, func_data);
fcur = (*f)(xcur, func_data_param);
solver_stats->funcalls++;
}
solver_stats->error_num = CONVERR;

View File

@ -16,15 +16,15 @@
double
ridder(callback_type f, double xa, double xb, double xtol, double rtol,
int iter, void *func_data, scipy_zeros_info *solver_stats)
int iter, void *func_data_param, scipy_zeros_info *solver_stats)
{
int i;
double dm,dn,xm,xn=0.0,fn,fm,fa,fb,tol;
solver_stats->error_num = INPROGRESS;
tol = xtol + rtol*MIN(fabs(xa), fabs(xb));
fa = (*f)(xa, func_data);
fb = (*f)(xb, func_data);
fa = (*f)(xa, func_data_param);
fb = (*f)(xb, func_data_param);
solver_stats->funcalls = 2;
if (fa*fb > 0) {
solver_stats->error_num = SIGNERR;
@ -44,10 +44,10 @@ ridder(callback_type f, double xa, double xb, double xtol, double rtol,
solver_stats->iterations++;
dm = 0.5*(xb - xa);
xm = xa + dm;
fm = (*f)(xm, func_data);
fm = (*f)(xm, func_data_param);
dn = SIGN(fb - fa)*dm*fm/sqrt(fm*fm - fa*fb);
xn = xm - SIGN(dn) * MIN(fabs(dn), fabs(dm) - .5*tol);
fn = (*f)(xn, func_data);
fn = (*f)(xn, func_data_param);
solver_stats->funcalls += 2;
if (fn*fm < 0.0) {
xa = xn; fa = fn; xb = xm; fb = fm;

View File

@ -25,16 +25,16 @@ typedef double (*solver_type)(callback_type, double, double, double, double,
int, void *, scipy_zeros_info*);
extern double bisect(callback_type f, double xa, double xb, double xtol,
double rtol, int iter, void *func_data,
double rtol, int iter, void *func_data_param,
scipy_zeros_info *solver_stats);
extern double ridder(callback_type f, double xa, double xb, double xtol,
double rtol, int iter, void *func_data,
double rtol, int iter, void *func_data_param,
scipy_zeros_info *solver_stats);
extern double brenth(callback_type f, double xa, double xb, double xtol,
double rtol, int iter, void *func_data,
double rtol, int iter, void *func_data_param,
scipy_zeros_info *solver_stats);
extern double brentq(callback_type f, double xa, double xb, double xtol,
double rtol, int iter, void *func_data,
double rtol, int iter, void *func_data_param,
scipy_zeros_info *solver_stats);
#endif

View File

@ -4,7 +4,7 @@ from ._hessian_update_strategy import BFGS
from ._differentiable_functions import (
VectorFunction, LinearVectorFunction, IdentityVectorFunction)
from ._optimize import OptimizeWarning
from warnings import warn
from warnings import warn, catch_warnings, simplefilter
from numpy.testing import suppress_warnings
from scipy.sparse import issparse
@ -165,11 +165,18 @@ class LinearConstraint:
def __init__(self, A, lb=-np.inf, ub=np.inf, keep_feasible=False):
if not issparse(A):
self.A = np.atleast_2d(A)
# In some cases, if the constraint is not valid, this emits a
# VisibleDeprecationWarning about ragged nested sequences
# before eventually causing an error. `scipy.optimize.milp` would
# prefer that this just error out immediately so it can handle it
# rather than concerning the user.
with catch_warnings():
simplefilter("error")
self.A = np.atleast_2d(A).astype(np.float64)
else:
self.A = A
self.lb = np.atleast_1d(lb)
self.ub = np.atleast_1d(ub)
self.lb = np.atleast_1d(lb).astype(np.float64)
self.ub = np.atleast_1d(ub).astype(np.float64)
self.keep_feasible = np.atleast_1d(keep_feasible).astype(bool)
self._input_validation()

View File

@ -1081,8 +1081,8 @@ class DifferentialEvolutionSolver:
if DE_result.maxcv > 0:
# if the result is infeasible then success must be False
DE_result.success = False
DE_result.message = ("The solution does not satisfy the"
" constraints, MAXCV = " % DE_result.maxcv)
DE_result.message = ("The solution does not satisfy the "
f"constraints, MAXCV = {DE_result.maxcv}")
return DE_result

View File

@ -30,7 +30,6 @@ cdef extern from "Highs.h":
# split up for cython below
#const HighsModelStatus& getModelStatus(const bool scaled_model = False) const
const HighsModelStatus & getModelStatus() const
const HighsModelStatus & getModelStatus(const bool scaled_model) const
const HighsInfo& getHighsInfo "getInfo" () const
string modelStatusToString(const HighsModelStatus model_status) const

View File

@ -10,4 +10,4 @@ cdef extern from "HighsStatus.h" nogil:
HighsStatusWarning "HighsStatus::kWarning" = 1
string HighsStatusToString(HighsStatus status)
string highsStatusToString(HighsStatus status)

View File

@ -35,21 +35,14 @@ cdef extern from "SimplexConst.h" nogil:
SIMPLEX_CRASH_STRATEGY_TEST_SING "SimplexCrashStrategy::kSimplexCrashStrategyTestSing"
SIMPLEX_CRASH_STRATEGY_MAX "SimplexCrashStrategy::kSimplexCrashStrategyMax" = SIMPLEX_CRASH_STRATEGY_TEST_SING
cdef enum SimplexDualEdgeWeightStrategy:
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_MIN "SimplexDualEdgeWeightStrategy::kSimplexDualEdgeWeightStrategyMin" = -1
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_CHOOSE "SimplexDualEdgeWeightStrategy::kSimplexDualEdgeWeightStrategyChoose" = SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_MIN
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DANTZIG "SimplexDualEdgeWeightStrategy::kSimplexDualEdgeWeightStrategyDantzig"
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DEVEX "SimplexDualEdgeWeightStrategy::kSimplexDualEdgeWeightStrategyDevex"
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE "SimplexDualEdgeWeightStrategy::kSimplexDualEdgeWeightStrategySteepestEdge"
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL "SimplexDualEdgeWeightStrategy::kSimplexDualEdgeWeightStrategySteepestEdgeUnitInitial"
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_MAX "SimplexDualEdgeWeightStrategy::kSimplexDualEdgeWeightStrategyMax" = SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL
cdef enum SimplexPrimalEdgeWeightStrategy:
SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_MIN "SimplexPrimalEdgeWeightStrategy::kSimplexPrimalEdgeWeightStrategyMin" = -1
SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_CHOOSE "SimplexPrimalEdgeWeightStrategy::kSimplexPrimalEdgeWeightStrategyChoose" = SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_MIN
SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DANTZIG "SimplexPrimalEdgeWeightStrategy::kSimplexPrimalEdgeWeightStrategyDantzig"
SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DEVEX "SimplexPrimalEdgeWeightStrategy::kSimplexPrimalEdgeWeightStrategyDevex"
SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_MAX "SimplexPrimalEdgeWeightStrategy::kSimplexPrimalEdgeWeightStrategyMax" = SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DEVEX
cdef enum SimplexEdgeWeightStrategy:
SIMPLEX_EDGE_WEIGHT_STRATEGY_MIN "SimplexEdgeWeightStrategy::kSimplexEdgeWeightStrategyMin" = -1
SIMPLEX_EDGE_WEIGHT_STRATEGY_CHOOSE "SimplexEdgeWeightStrategy::kSimplexEdgeWeightStrategyChoose" = SIMPLEX_EDGE_WEIGHT_STRATEGY_MIN
SIMPLEX_EDGE_WEIGHT_STRATEGY_DANTZIG "SimplexEdgeWeightStrategy::kSimplexEdgeWeightStrategyDantzig"
SIMPLEX_EDGE_WEIGHT_STRATEGY_DEVEX "SimplexEdgeWeightStrategy::kSimplexEdgeWeightStrategyDevex"
SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE "SimplexEdgeWeightStrategy::kSimplexEdgeWeightStrategySteepestEdge"
SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL "SimplexEdgeWeightStrategy::kSimplexEdgeWeightStrategySteepestEdgeUnitInitial"
SIMPLEX_EDGE_WEIGHT_STRATEGY_MAX "SimplexEdgeWeightStrategy::kSimplexEdgeWeightStrategyMax" = SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL
cdef enum SimplexPriceStrategy:
SIMPLEX_PRICE_STRATEGY_MIN = 0

View File

@ -51,17 +51,12 @@ from .SimplexConst cimport (
SIMPLEX_CRASH_STRATEGY_BIXBY,
SIMPLEX_CRASH_STRATEGY_LTSF,
# Dual edge weight strategy
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_CHOOSE,
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DANTZIG,
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DEVEX,
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE,
SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL,
# Primal edge weight strategy
SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DANTZIG,
SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_CHOOSE,
SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DEVEX,
# Edge weight strategy
SIMPLEX_EDGE_WEIGHT_STRATEGY_CHOOSE,
SIMPLEX_EDGE_WEIGHT_STRATEGY_DANTZIG,
SIMPLEX_EDGE_WEIGHT_STRATEGY_DEVEX,
SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE,
SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL,
)
# HConst
@ -106,17 +101,12 @@ HIGHS_SIMPLEX_CRASH_STRATEGY_OFF = <int> SIMPLEX_CRASH_STRATEGY_OFF
HIGHS_SIMPLEX_CRASH_STRATEGY_BIXBY = <int> SIMPLEX_CRASH_STRATEGY_BIXBY
HIGHS_SIMPLEX_CRASH_STRATEGY_LTSF = <int> SIMPLEX_CRASH_STRATEGY_LTSF
# Dual edge weight strategy
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_CHOOSE = <int> SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_CHOOSE
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DANTZIG = <int> SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DANTZIG
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DEVEX = <int> SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DEVEX
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE = <int> SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE
# HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL = <int> SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL
# Primal edge weight strategy
HIGHS_SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_CHOOSE = <int> SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_CHOOSE
HIGHS_SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DANTZIG = <int> SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DANTZIG
HIGHS_SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DEVEX = <int> SIMPLEX_PRIMAL_EDGE_WEIGHT_STRATEGY_DEVEX
# Edge weight strategy
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_CHOOSE = <int> SIMPLEX_EDGE_WEIGHT_STRATEGY_CHOOSE
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_DANTZIG = <int> SIMPLEX_EDGE_WEIGHT_STRATEGY_DANTZIG
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_DEVEX = <int> SIMPLEX_EDGE_WEIGHT_STRATEGY_DEVEX
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE = <int> SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE
# HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL = <int> SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE_UNIT_INITIAL
# Objective sense
HIGHS_OBJECTIVE_SENSE_MINIMIZE = <int> ObjSenseMINIMIZE

View File

@ -17,6 +17,7 @@ from .HighsIO cimport (
kWarning,
)
from .HConst cimport (
HIGHS_CONST_INF,
HighsModelStatus,
HighsModelStatusNOTSET,
HighsModelStatusLOAD_ERROR,
@ -48,7 +49,7 @@ from .HConst cimport (
from .Highs cimport Highs
from .HighsStatus cimport (
HighsStatus,
HighsStatusToString,
highsStatusToString,
HighsStatusError,
HighsStatusWarning,
HighsStatusOK,
@ -139,6 +140,7 @@ cdef apply_options(dict options, Highs & highs):
'ipm_iteration_limit',
'keep_n_rows',
'max_threads',
'mip_max_nodes',
'highs_debug_level',
'min_threads',
'simplex_crash_strategy',
@ -664,13 +666,11 @@ def _highs_wrapper(
if run_status == HighsStatusError:
return {
'status': <int> highs.getModelStatus(),
'message': HighsStatusToString(run_status).decode(),
'message': highsStatusToString(run_status).decode(),
}
# Extract what we need from the solution
cdef HighsModelStatus model_status = highs.getModelStatus()
cdef HighsModelStatus scaled_model_status = highs.getModelStatus(True)
cdef HighsModelStatus unscaled_model_status = model_status
# We might need an info object if we can look up the solution and a place to put solution
cdef HighsInfo info = highs.getHighsInfo() # it should always be safe to get the info object
@ -678,12 +678,29 @@ def _highs_wrapper(
cdef HighsBasis basis
cdef double[:, ::1] marg_bnds = np.zeros((2, numcol)) # marg_bnds[0, :]: lower
# If the status is bad, don't look up the solution
if model_status != HighsModelStatusOPTIMAL:
# Failure modes:
# LP: if we have anything other than an Optimal status, it
# is unsafe (and unhelpful) to read any results
# MIP: has a non-Optimal status or has timed out/reached max iterations
# 1) If not Optimal/TimedOut/MaxIter status, there is no solution
# 2) If TimedOut/MaxIter status, there may be a feasible solution.
# if the objective function value is not Infinity, then the
# current solution is feasible and can be returned. Else, there
# is no solution.
mipFailCondition = model_status not in {
HighsModelStatusOPTIMAL,
HighsModelStatusREACHED_TIME_LIMIT,
HighsModelStatusREACHED_ITERATION_LIMIT,
} or (model_status in {
HighsModelStatusREACHED_TIME_LIMIT,
HighsModelStatusREACHED_ITERATION_LIMIT,
} and (info.objective_function_value == HIGHS_CONST_INF))
lpFailCondition = model_status != HighsModelStatusOPTIMAL
if (highs.getLp().isMip() and mipFailCondition) or (not highs.getLp().isMip() and lpFailCondition):
return {
'status': <int> model_status,
'message': f'model_status is {highs.modelStatusToString(model_status).decode()}; '
f'primal_status is {utilBasisStatusToString(<HighsBasisStatus> info.primal_solution_status)}',
f'primal_status is {utilBasisStatusToString(<HighsBasisStatus> info.primal_solution_status).decode()}',
'simplex_nit': info.simplex_iteration_count,
'ipm_nit': info.ipm_iteration_count,
'fun': None,
@ -705,7 +722,6 @@ def _highs_wrapper(
res = {
'status': <int> model_status,
'message': highs.modelStatusToString(model_status).decode(),
'unscaled_status': <int> unscaled_model_status,
# Primal solution
'x': [solution.col_value[ii] for ii in range(numcol)],

View File

@ -1,11 +1,10 @@
highs_define_macros = [
'-DCMAKE_BUILD_TYPE="RELEASE"',
'-DHiGHSRELEASE',
'-DIPX_ON="ON"',
'-DFAST_BUILD=ON',
'-DHIGHS_GITHASH="n/a"',
'-DHIGHS_COMPILATION_DATE="2021-07-09"', # cannot generate dynamically
'-DHIGHS_VERSION_MAJOR=1', # don't care about this, look at CMakelists.txt
'-DHIGHS_VERSION_MINOR=0',
'-DHIGHS_VERSION_MINOR=2',
'-DHIGHS_VERSION_PATCH=0',
'-DHIGHS_DIR=' + meson.current_source_dir() / '..' / '..' / '_lib' / 'highs',
'-UOPENMP',
@ -51,29 +50,18 @@ basiclu_lib = static_library('basiclu',
'../../_lib/highs/src',
'../../_lib/highs/src/ipm/basiclu/include'
],
c_args: [
'-Wno-unused-variable', highs_define_macros
]
c_args: [Wno_unused_variable, highs_define_macros]
)
# Deal with non-portable (or GCC-specific) compiler flags
if cc.has_argument('-Wno-unused-but-set-variable')
Wno_unused_but_set = ['-Wno-unused-but-set-variable']
else
Wno_unused_but_set = []
endif
highs_flags = [
'-Wno-sign-compare',
'-Wno-switch',
'-Wno-non-virtual-dtor',
_cpp_Wno_class_memaccess,
_cpp_Wno_format_truncation,
_cpp_Wno_non_virtual_dtor,
_cpp_Wno_sign_compare,
_cpp_Wno_switch,
_cpp_Wno_unused_but_set_variable,
_cpp_Wno_unused_variable,
]
if cpp.has_argument('-Wno-format-truncation')
highs_flags += '-Wno-format-truncation'
endif
if cpp.has_argument('-Wno-class-memaccess') # added in GCC 8
highs_flags += '-Wno-class-memaccess'
endif
ipx_lib = static_library('ipx',
[
@ -116,11 +104,8 @@ ipx_lib = static_library('ipx',
'../../_lib/highs/extern/',
'cython/src/'
],
cpp_args: [
'-Wno-unused-variable',
highs_flags,
highs_define_macros
]
dependencies: thread_dep,
cpp_args: [highs_flags, highs_define_macros]
)
highs_lib = static_library('highs',
@ -174,24 +159,23 @@ highs_lib = static_library('highs',
'../../_lib/highs/src/mip/HighsPseudocost.cpp',
'../../_lib/highs/src/mip/HighsRedcostFixing.cpp',
'../../_lib/highs/src/mip/HighsNodeQueue.cpp',
'../../_lib/highs/src/mip/HighsObjectiveFunction.cpp',
'../../_lib/highs/src/model/HighsHessian.cpp',
'../../_lib/highs/src/model/HighsHessianUtils.cpp',
'../../_lib/highs/src/model/HighsModel.cpp',
'../../_lib/highs/src/parallel/HighsTaskExecutor.cpp',
'../../_lib/highs/src/presolve/ICrash.cpp',
'../../_lib/highs/src/presolve/ICrashUtil.cpp',
'../../_lib/highs/src/presolve/ICrashX.cpp',
'../../_lib/highs/src/presolve/HAggregator.cpp',
'../../_lib/highs/src/presolve/HighsLpPropagator.cpp',
'../../_lib/highs/src/presolve/HighsPostsolveStack.cpp',
'../../_lib/highs/src/presolve/HighsSymmetry.cpp',
'../../_lib/highs/src/presolve/HPreData.cpp',
'../../_lib/highs/src/presolve/HPresolve.cpp',
'../../_lib/highs/src/presolve/PresolveAnalysis.cpp',
'../../_lib/highs/src/presolve/PresolveComponent.cpp',
'../../_lib/highs/src/presolve/Presolve.cpp',
'../../_lib/highs/src/presolve/PresolveUtils.cpp',
'../../_lib/highs/src/qpsolver/basis.cpp',
'../../_lib/highs/src/qpsolver/solver.cpp',
'../../_lib/highs/src/qpsolver/quass.cpp',
'../../_lib/highs/src/qpsolver/ratiotest.cpp',
'../../_lib/highs/src/qpsolver/scaling.cpp',
'../../_lib/highs/src/qpsolver/perturbation.cpp',
'../../_lib/highs/src/simplex/HEkk.cpp',
'../../_lib/highs/src/simplex/HEkkControl.cpp',
'../../_lib/highs/src/simplex/HEkkDebug.cpp',
@ -237,11 +221,8 @@ highs_lib = static_library('highs',
'../../_lib/highs/src/lp_data/',
'../../_lib/highs/src/util/',
],
cpp_args: [
'-Wno-unused-variable',
highs_flags,
highs_define_macros
]
dependencies: thread_dep,
cpp_args: [highs_flags, highs_define_macros]
)
_highs_wrapper = py3.extension_module('_highs_wrapper',
@ -255,22 +236,10 @@ _highs_wrapper = py3.extension_module('_highs_wrapper',
'../../_lib/highs/src/lp_data/',
'../../_lib/highs/src/util/'
],
dependencies: thread_dep,
link_with: [highs_lib, ipx_lib, basiclu_lib],
dependencies: [py3_dep],
cpp_args: [
'-Wno-unused-variable',
'-Wno-sign-compare',
'-Wno-switch',
'-Wno-format-truncation',
'-Wno-non-virtual-dtor',
'-Wno-class-memaccess',
# Pass despite __STDC_FORMAT_MACROS redefinition warning.
# Remove after merge of https://github.com/ERGO-Code/HiGHS/pull/674
'-Wp,-w',
Wno_unused_but_set,
highs_define_macros,
cython_c_args,
],
cpp_args: [highs_flags, highs_define_macros, cython_c_args],
install: true,
subdir: 'scipy/optimize/_highs'
)
@ -286,7 +255,7 @@ _highs_constants = py3.extension_module('_highs_constants',
'../../_lib/highs/src/lp_data/',
'../../_lib/highs/src/simplex/'
],
dependencies: [py3_dep],
dependencies: [py3_dep, thread_dep],
install: true,
subdir: 'scipy/optimize/_highs'
)

View File

@ -73,9 +73,7 @@ def configuration(parent_package='', top_path=None):
# here:
TODAY_DATE = datetime.today().strftime('%Y-%m-%d')
DEFINE_MACROS = [
('CMAKE_BUILD_TYPE', '"Release"'),
('HiGHSRELEASE', None),
('IPX_ON', 'ON'),
('CMAKE_BUILD_TYPE', '"RELEASE"'),
('HIGHS_GITHASH', '"%s"' % GITHASH),
('HIGHS_COMPILATION_DATE', '"' + TODAY_DATE + '"'),
('HIGHS_VERSION_MAJOR', HIGHS_VERSION_MAJOR),

View File

@ -183,8 +183,6 @@ def fmin_l_bfgs_b(func, x0, fprime=None, args=(),
jac = fprime
# build options
if disp is None:
disp = iprint
opts = {'disp': disp,
'iprint': iprint,
'maxcor': m,

View File

@ -228,10 +228,11 @@ def linprog(c, A_ub=None, b_ub=None, A_eq=None, b_eq=None,
:ref:`'highs' <optimize.linprog-highs>` (default),
:ref:`'highs-ds' <optimize.linprog-highs-ds>`,
:ref:`'highs-ipm' <optimize.linprog-highs-ipm>`,
:ref:`'interior-point' <optimize.linprog-interior-point>`,
:ref:`'revised simplex' <optimize.linprog-revised_simplex>`, and
:ref:`'simplex' <optimize.linprog-simplex>` (legacy)
are supported.
:ref:`'interior-point' <optimize.linprog-interior-point>` (legacy),
:ref:`'revised simplex' <optimize.linprog-revised_simplex>` (legacy),
and
:ref:`'simplex' <optimize.linprog-simplex>` (legacy) are supported.
The legacy methods are deprecated and will be removed in SciPy 1.11.0.
callback : callable, optional
If a callback function is provided, it will be called at least once per
iteration of the algorithm. The callback function must accept a single
@ -356,7 +357,10 @@ def linprog(c, A_ub=None, b_ub=None, A_eq=None, b_eq=None,
Returns
-------
res : OptimizeResult
A :class:`scipy.optimize.OptimizeResult` consisting of the fields:
A :class:`scipy.optimize.OptimizeResult` consisting of the fields
below. Note that the return types of the fields may depend on whether
the optimization was successful, therefore it is recommended to check
`OptimizeResult.status` before relying on the other fields:
x : 1-D array
The values of the decision variables that minimizes the
@ -577,7 +581,7 @@ def linprog(c, A_ub=None, b_ub=None, A_eq=None, b_eq=None,
warning_message = "x0 is used only when method is 'revised simplex'. "
warn(warning_message, OptimizeWarning)
if integrality and not meth == "highs":
if np.any(integrality) and not meth == "highs":
integrality = None
warning_message = ("Only `method='highs'` supports integer "
"constraints. Ignoring `integrality`.")

View File

@ -46,10 +46,10 @@ from ._highs._highs_constants import (
HIGHS_SIMPLEX_CRASH_STRATEGY_OFF,
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_CHOOSE,
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DANTZIG,
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DEVEX,
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE,
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_CHOOSE,
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_DANTZIG,
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_DEVEX,
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE,
HIGHS_VAR_TYPE_CONTINUOUS,
)
@ -115,6 +115,7 @@ def _linprog_highs(lp, solver, time_limit=None, presolve=True,
primal_feasibility_tolerance=None,
ipm_optimality_tolerance=None,
simplex_dual_edge_weight_strategy=None,
mip_max_nodes=None,
**unknown_options):
r"""
Solve the following linear programming problem using one of the HiGHS
@ -179,6 +180,10 @@ def _linprog_highs(lp, solver, time_limit=None, presolve=True,
Curently, using ``None`` always selects ``'steepest-devex'``, but this
may change as new options become available.
mip_max_nodes : int
The maximum number of nodes allotted to solve the problem; default is
the largest possible value for a ``HighsInt`` on the platform.
Ignored if not using the MIP solver.
unknown_options : dict
Optional arguments not used by this particular solver. If
``unknown_options`` is non-empty, a warning is issued listing all
@ -306,11 +311,11 @@ def _linprog_highs(lp, solver, time_limit=None, presolve=True,
simplex_dual_edge_weight_strategy_enum = _convert_to_highs_enum(
simplex_dual_edge_weight_strategy,
'simplex_dual_edge_weight_strategy',
choices={'dantzig': HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DANTZIG,
'devex': HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_DEVEX,
'steepest-devex': HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_CHOOSE,
choices={'dantzig': HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_DANTZIG,
'devex': HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_DEVEX,
'steepest-devex': HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_CHOOSE,
'steepest':
HIGHS_SIMPLEX_DUAL_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE,
HIGHS_SIMPLEX_EDGE_WEIGHT_STRATEGY_STEEPEST_EDGE,
None: None})
c, A_ub, b_ub, A_eq, b_eq, bounds, x0, integrality = lp
@ -339,6 +344,7 @@ def _linprog_highs(lp, solver, time_limit=None, presolve=True,
'dual_feasibility_tolerance': dual_feasibility_tolerance,
'ipm_optimality_tolerance': ipm_optimality_tolerance,
'log_to_console': disp,
'mip_max_nodes': mip_max_nodes,
'output_flag': disp,
'primal_feasibility_tolerance': primal_feasibility_tolerance,
'simplex_dual_edge_weight_strategy':

View File

@ -103,7 +103,7 @@ cleanup:
static PyMethodDef lsap_methods[] = {
{ "linear_sum_assignment",
linear_sum_assignment,
(PyCFunction)linear_sum_assignment,
METH_VARARGS | METH_KEYWORDS,
"Solve the linear sum assignment problem.\n"
"\n"
@ -189,7 +189,7 @@ static struct PyModuleDef moduledef = {
NULL,
};
PyObject*
PyMODINIT_FUNC
PyInit__lsap(void)
{
import_array();

View File

@ -43,7 +43,7 @@ def _constraints_to_components(constraints):
# argument could be a single tuple representing a LinearConstraint
try:
constraints = [LinearConstraint(*constraints)]
except TypeError:
except (TypeError, ValueError, np.VisibleDeprecationWarning):
# argument was not a tuple representing a LinearConstraint
pass
@ -130,13 +130,14 @@ def _milp_iv(c, integrality, bounds, constraints, options):
# options IV
options = options or {}
supported_options = {'disp', 'presolve', 'time_limit'}
supported_options = {'disp', 'presolve', 'time_limit', 'node_limit'}
unsupported_options = set(options).difference(supported_options)
if unsupported_options:
message = (f"Unrecognized options detected: {unsupported_options}. "
"These will be passed to HiGHS verbatim.")
warnings.warn(message, RuntimeWarning, stacklevel=3)
options_iv = {'log_to_console': options.get("disp", False)}
options_iv = {'log_to_console': options.pop("disp", False),
'mip_max_nodes': options.pop("node_limit", None)}
options_iv.update(options)
return c, integrality, lb, ub, indptr, indices, data, b_l, b_u, options_iv
@ -225,6 +226,9 @@ def milp(c, *, integrality=None, bounds=None, constraints=None, options=None):
disp : bool (default: ``False``)
Set to ``True`` if indicators of optimization status are to be
printed to the console during optimization.
node_limit : int, optional
The maximum number of nodes (linear program relaxations) to solve
before stopping. Default is no maximum number of nodes.
presolve : bool (default: ``True``)
Presolve attempts to identify trivial infeasibilities,
identify trivial unboundedness, and simplify the problem before

View File

@ -520,7 +520,7 @@ def minimize(fun, x0, args=(), method=None, jac=None, hess=None,
'Currently, singleton dimensions will be removed from '
'`x0`, but an error will be raised in SciPy 1.11.0.')
warn(message, DeprecationWarning, stacklevel=2)
x0 = np.squeeze(x0)
x0 = np.atleast_1d(np.squeeze(x0))
if x0.dtype.kind in np.typecodes["AllInteger"]:
x0 = np.asarray(x0, dtype=float)

View File

@ -3170,13 +3170,12 @@ def _minimize_powell(func, x0, args=(), callback=None, bounds=None,
fval = squeeze(func(x))
x1 = x.copy()
iter = 0
ilist = list(range(N))
while True:
try:
fx = fval
bigind = 0
delta = 0.0
for i in ilist:
for i in range(N):
direc1 = direc[i]
fx2 = fval
fval, x, direc1 = _linesearch_powell(func, x, direc1,
@ -3205,8 +3204,13 @@ def _minimize_powell(func, x0, args=(), callback=None, bounds=None,
# Construct the extrapolated point
direc1 = x - x1
x2 = 2*x - x1
x1 = x.copy()
# make sure that we don't go outside the bounds when extrapolating
if lower_bound is None and upper_bound is None:
lmax = 1
else:
_, lmax = _line_for_search(x, direc1, lower_bound, upper_bound)
x2 = x + min(lmax, 1) * direc1
fx2 = squeeze(func(x2))
if (fx > fx2):

View File

@ -463,6 +463,7 @@ class SHGO:
" Valid methods: {}").format(', '.join(methods)))
# Initiate class
self._raw_func = func # some methods pass args in (e.g. Complex)
_, self.func = _wrap_scalar_function(func, args)
self.bounds = bounds
self.args = args
@ -896,8 +897,11 @@ class SHGO:
"""
# Iterate the complex
if self.n_sampled == 0:
# Initial triangulation of the hyper-rectangle
self.HC = Complex(self.dim, self.func, self.args,
# Initial triangulation of the hyper-rectangle. Note that
# we use `self.raw_func` as `self.func` is a *wrapped* function
# that already takes the original function arguments into
# account.
self.HC = Complex(self.dim, self._raw_func, self.args,
self.symmetry, self.bounds, self.g_cons,
self.g_args)
else:

View File

@ -7,20 +7,20 @@ cdef extern from "../Zeros/zeros.h":
cdef extern from "../Zeros/bisect.c" nogil:
double bisect(callback_type f, double xa, double xb, double xtol,
double rtol, int iter, void *func_data,
double rtol, int iter, void *func_data_param,
scipy_zeros_info *solver_stats)
cdef extern from "../Zeros/ridder.c" nogil:
double ridder(callback_type f, double xa, double xb, double xtol,
double rtol, int iter, void *func_data,
double rtol, int iter, void *func_data_param,
scipy_zeros_info *solver_stats)
cdef extern from "../Zeros/brenth.c" nogil:
double brenth(callback_type f, double xa, double xb, double xtol,
double rtol, int iter, void *func_data,
double rtol, int iter, void *func_data_param,
scipy_zeros_info *solver_stats)
cdef extern from "../Zeros/brentq.c" nogil:
double brentq(callback_type f, double xa, double xb, double xtol,
double rtol, int iter, void *func_data,
double rtol, int iter, void *func_data_param,
scipy_zeros_info *solver_stats)

View File

@ -1,4 +1,5 @@
# Needed to trick Cython, it won't do a relative import outside a package
# (see https://github.com/mesonbuild/meson/issues/8961)
_dummy_init_cyoptimize = custom_target('_dummy_init_cyoptimize',
output: [
'__init__.py',
@ -13,8 +14,6 @@ _dummy_init_cyoptimize = custom_target('_dummy_init_cyoptimize',
command: [copier, '@INPUT@', '@OUTDIR@']
)
# FIXME: generated .pyx which has relative cimport in it doesn't work yet (see
# https://github.com/mesonbuild/meson/issues/8961)
_zeros_pyx = custom_target('_zeros_pyx',
output: '_zeros.pyx',
input: '_zeros.pyx.in',

View File

@ -1,10 +1,4 @@
include_dirs = [inc_np, '../_lib/src']
fortran_ignore_warnings = [
'-Wno-tabs', '-Wno-conversion',
'-Wno-argument-mismatch', '-Wno-unused-dummy-argument',
'-Wno-maybe-uninitialized', '-Wno-unused-label',
'-Wno-unused-variable'
]
_direct = py3.extension_module('_direct',
['_direct/direct_wrap.c',
@ -140,7 +134,7 @@ cobyla_module = custom_target('cobyla_module',
_cobyla = py3.extension_module('_cobyla',
[cobyla_module, fortranobject_c, 'cobyla/cobyla2.f', 'cobyla/trstlp.f'],
c_args: [numpy_nodepr_api, '-Wno-unused-variable'],
c_args: [numpy_nodepr_api, Wno_unused_variable],
fortran_args: fortran_ignore_warnings,
include_directories: [inc_np, inc_f2py],
dependencies: [py3_dep],
@ -215,11 +209,7 @@ if use_pythran
_group_columns = py3.extension_module('_group_columns',
[_group_columns],
cpp_args: [
'-Wno-unused-function', '-Wno-unused-variable',
'-Wno-deprecated-declarations',
'-Wno-cpp', '-Wno-int-in-bool-context'
] + cpp_args_pythran,
cpp_args: cpp_args_pythran,
include_directories: [incdir_pythran, incdir_numpy],
dependencies: [py3_dep],
install: true,
@ -316,6 +306,7 @@ py3.install_sources([
'_tstutils.py',
'_zeros_py.py',
'cobyla.py',
'cython_optimize.pxd',
'lbfgsb.py',
'linesearch.py',
'minpack.py',

View File

@ -15,8 +15,7 @@ from scipy import stats
from scipy._lib._pep440 import Version
import numpy as np
from numpy.testing import (assert_equal, assert_allclose,
assert_almost_equal, assert_array_equal,
from numpy.testing import (assert_equal, assert_allclose, assert_almost_equal,
assert_string_equal, assert_, suppress_warnings)
from pytest import raises as assert_raises, warns
import pytest
@ -1463,3 +1462,26 @@ class TestDifferentialEvolutionSolver:
polish=False)
# the two minimisation runs should be functionally equivalent
assert_allclose(res1.x, res2.x)
def test_constraint_violation_error_message(self):
def func(x):
return np.cos(x[0]) + np.sin(x[1])
# Intentionally infeasible constraints.
c0 = NonlinearConstraint(lambda x: x[1] - (x[0]-1)**2, 0, np.inf)
c1 = NonlinearConstraint(lambda x: x[1] + x[0]**2, -np.inf, 0)
result = differential_evolution(func,
bounds=[(-1, 2), (-1, 1)],
constraints=[c0, c1],
maxiter=10,
polish=False,
seed=864197532)
assert result.success is False
# The numerical value in the error message might be sensitive to
# changes in the implementation. It can be updated if the code is
# changed. The essential part of the test is that there is a number
# after the '=', so if necessary, the text could be reduced to, say,
# "MAXCV = 0.".
assert "MAXCV = 0.404" in result.message

View File

@ -1,5 +1,6 @@
import logging
import numpy
from numpy.testing import assert_allclose
import pytest
from pytest import raises as assert_raises, warns
from scipy.optimize import shgo, Bounds
@ -469,6 +470,13 @@ class TestShgoArguments:
shgo(test.f, test.bounds, n=1, sampling_method='simplicial',
callback=callback_func, options={'disp': True})
def test_args_gh14589(self):
# Using `args` used to cause `shgo` to fail; see #14589, #15986, #16506
res = shgo(func=lambda x, y, z: x*z + y, bounds=[(0, 3)], args=(1, 2))
ref = shgo(func=lambda x: 2*x + 1, bounds=[(0, 3)])
assert_allclose(res.fun, ref.fun)
assert_allclose(res.x, ref.x)
@pytest.mark.slow
def test_4_1_known_f_min(self):
"""Test known function minima stopping criteria"""

View File

@ -2,6 +2,7 @@
Unit test for Linear Programming
"""
import sys
import platform
import numpy as np
from numpy.testing import (assert_, assert_allclose, assert_equal,
@ -2199,6 +2200,10 @@ class TestLinprogHiGHSMIP():
method = "highs"
options = {}
@pytest.mark.xfail(condition=(sys.maxsize < 2 ** 32 and
platform.system() == "Linux"),
run=False,
reason="gh-16347")
def test_mip1(self):
# solve non-relaxed magic square problem (finally!)
# also check that values are all integers - they don't always
@ -2225,12 +2230,13 @@ class TestLinprogHiGHSMIP():
# source: slide 5,
# https://www.cs.upc.edu/~erodri/webpage/cps/theory/lp/milp/slides.pdf
# use all array inputs to test gh-16681 (integrality couldn't be array)
A_ub = np.array([[2, -2], [-8, 10]])
b_ub = np.array([-1, 13])
c = -np.array([1, 1])
bounds = [(0, np.inf)] * len(c)
integrality = [1] * len(c)
bounds = np.array([(0, np.inf)] * len(c))
integrality = np.ones_like(c)
res = linprog(c=c, A_ub=A_ub, b_ub=b_ub, bounds=bounds,
method=self.method, integrality=integrality)
@ -2251,8 +2257,9 @@ class TestLinprogHiGHSMIP():
res = linprog(c=c, A_ub=A_ub, b_ub=b_ub, bounds=bounds,
method=self.method, integrality=integrality)
np.testing.assert_allclose(res.x, [1, 2])
np.testing.assert_allclose(res.fun, -2)
# two optimal solutions possible, just need one of them
assert np.allclose(res.x, [1, 2]) or np.allclose(res.x, [2, 2])
def test_mip4(self):
# solve MIP with inequality constraints and only one integer constraint

View File

@ -57,8 +57,10 @@ def test_milp_iv():
milp([1, 2, 3], bounds=([1, 2, 3], [set(), 4, 5]))
@pytest.mark.xfail(strict=True, reason="Needs to be fixed in `_highs_wrapper`")
@pytest.mark.xfail(run=False,
reason="Needs to be fixed in `_highs_wrapper`")
def test_milp_options(capsys):
# run=False now because of gh-16347
message = "Unrecognized options detected: {'ekki'}..."
options = {'ekki': True}
with pytest.warns(RuntimeWarning, match=message):
@ -181,7 +183,7 @@ def test_milp_3():
c = [0, -1]
A = [[-1, 1], [3, 2], [2, 3]]
b_u = [1, 12, 12]
b_l = np.full_like(b_u, -np.inf)
b_l = np.full_like(b_u, -np.inf, dtype=np.float64)
constraints = LinearConstraint(A, b_l, b_u)
integrality = np.ones_like(c)
@ -189,7 +191,8 @@ def test_milp_3():
# solve original problem
res = milp(c=c, constraints=constraints, integrality=integrality)
assert_allclose(res.fun, -2)
assert_allclose(res.x, [1, 2])
# two optimal solutions possible, just need one of them
assert np.allclose(res.x, [1, 2]) or np.allclose(res.x, [2, 2])
# solve relaxed problem
res = milp(c=c, constraints=constraints)
@ -248,3 +251,47 @@ def test_milp_6():
res = milp(c=c, constraints=(A_eq, b_eq, b_eq), integrality=integrality)
np.testing.assert_allclose(res.fun, 1854)
def test_infeasible_prob_16609():
# Ensure presolve does not mark trivially infeasible problems
# as Optimal -- see gh-16609
c = [1.0, 0.0]
integrality = [0, 1]
lb = [0, -np.inf]
ub = [np.inf, np.inf]
bounds = Bounds(lb, ub)
A_eq = [[0.0, 1.0]]
b_eq = [0.5]
constraints = LinearConstraint(A_eq, b_eq, b_eq)
res = milp(c, integrality=integrality, bounds=bounds,
constraints=constraints)
np.testing.assert_equal(res.status, 2)
def test_three_constraints_16878():
# `milp` failed when exactly three constraints were passed
# Ensure that this is no longer the case.
rng = np.random.default_rng(5123833489170494244)
A = rng.integers(0, 5, size=(6, 6))
bl = np.full(6, fill_value=-np.inf)
bu = np.full(6, fill_value=10)
constraints = [LinearConstraint(A[:2], bl[:2], bu[:2]),
LinearConstraint(A[2:4], bl[2:4], bu[2:4]),
LinearConstraint(A[4:], bl[4:], bu[4:])]
constraints2 = [(A[:2], bl[:2], bu[:2]),
(A[2:4], bl[2:4], bu[2:4]),
(A[4:], bl[4:], bu[4:])]
lb = np.zeros(6)
ub = np.ones(6)
variable_bounds = Bounds(lb, ub)
c = -np.ones(6)
res1 = milp(c, bounds=variable_bounds, constraints=constraints)
res2 = milp(c, bounds=variable_bounds, constraints=constraints2)
ref = milp(c, bounds=variable_bounds, constraints=(A, bl, bu))
assert res1.success and res2.success
assert_allclose(res1.x, ref.x)
assert_allclose(res2.x, ref.x)

View File

@ -308,17 +308,15 @@ class CheckOptimizeParameterized(CheckOptimize):
assert func_calls == self.funccalls
assert_allclose(self.func(params), self.func(self.solution),
atol=1e-6)
atol=1e-6, rtol=1e-5)
# Ensure that function call counts are 'known good'.
# Generally, this takes 131 function calls. However, on some CI
# checks it finds 138 funccalls. This 20 call leeway was also
# included in the test_powell function.
# The exact evaluation count is sensitive to numerical error, and
# floating-point computations are not bit-for-bit reproducible
# across machines, and when using e.g. MKL, data alignment etc.
# affect the rounding error.
assert self.funccalls <= 131 + 20
# It takes 155 calls on my machine, but we can add the same +20
# margin as is used in `test_powell`
assert self.funccalls <= 155 + 20
assert self.gradcalls == 0
def test_neldermead(self):
@ -1065,6 +1063,40 @@ class TestOptimizeSimple(CheckOptimize):
options=dict(stepsize=0.05))
assert_allclose(res.x, 1.0, rtol=1e-4, atol=1e-4)
@pytest.mark.xfail(reason="output not reliable on all platforms")
def test_gh13321(self, capfd):
# gh-13321 reported issues with console output in fmin_l_bfgs_b;
# check that iprint=0 works.
kwargs = {'func': optimize.rosen, 'x0': [4, 3],
'fprime': optimize.rosen_der, 'bounds': ((3, 5), (3, 5))}
# "L-BFGS-B" is always in output; should show when iprint >= 0
# "At iterate" is iterate info; should show when iprint >= 1
optimize.fmin_l_bfgs_b(**kwargs, iprint=-1)
out, _ = capfd.readouterr()
assert "L-BFGS-B" not in out and "At iterate" not in out
optimize.fmin_l_bfgs_b(**kwargs, iprint=0)
out, _ = capfd.readouterr()
assert "L-BFGS-B" in out and "At iterate" not in out
optimize.fmin_l_bfgs_b(**kwargs, iprint=1)
out, _ = capfd.readouterr()
assert "L-BFGS-B" in out and "At iterate" in out
# `disp is not None` overrides `iprint` behavior
# `disp=0` should suppress all output
# `disp=1` should be the same as `iprint = 1`
optimize.fmin_l_bfgs_b(**kwargs, iprint=1, disp=False)
out, _ = capfd.readouterr()
assert "L-BFGS-B" not in out and "At iterate" not in out
optimize.fmin_l_bfgs_b(**kwargs, iprint=-1, disp=True)
out, _ = capfd.readouterr()
assert "L-BFGS-B" in out and "At iterate" in out
def test_gh10771(self):
# check that minimize passes bounds and constraints to a custom
# minimizer without altering them.
@ -2003,6 +2035,18 @@ def test_linesearch_powell_bounded():
assert_allclose(direction, l * xi, atol=1e-6)
def test_powell_limits():
# gh15342 - powell was going outside bounds for some function evaluations.
bounds = optimize.Bounds([0, 0], [0.6, 20])
def fun(x):
a, b = x
assert (x >= bounds.lb).all() and (x <= bounds.ub).all()
return a ** 2 + b ** 2
optimize.minimize(fun, x0=[0.6, 20], method='Powell', bounds=bounds)
class TestRosen:
def test_hess(self):

View File

@ -5,6 +5,8 @@
#include <string.h>
#include <stdio.h>
#include "_splinemodule.h"
#define NO_IMPORT_ARRAY
#include "numpy/arrayobject.h"
@ -43,11 +45,12 @@ compute_root_from_lambda(lambda, r, omega)
CNAME = ['C', 'Z']
CTYPE = ['__complex__ float', '__complex__ double']
RNAME = ['D', 'S']
RTYPE = ['double', 'float']
RNAME = ['S', 'D']
RTYPE = ['float', 'double']
NAMES = CNAME + RNAME
TYPES = CTYPE + RTYPE
RTYPES = RTYPE + RTYPE
}}
@ -174,17 +177,17 @@ void {{SUB}}_IIR_order2_cascade({{TYP}} cs, {{TYP}} z1, {{TYP}} z2,
*/
{{for SUB, TYP in zip(NAMES, TYPES)}}
{{for SUB, TYP, RTYP in zip(NAMES, TYPES, RTYPES)}}
{{if SUB in CNAME}}
#ifdef __GNUC__
{{endif}}
int {{SUB}}_IIR_forback1({{TYP}} c0, {{TYP}} z1, {{TYP}} *x, {{TYP}} *y,
int N, int stridex, int stridey, float precision)
int N, int stridex, int stridey, {{RTYP}} precision)
{
{{TYP}} *yp = NULL;
{{TYP}} *xptr = x;
{{TYP}} yp0, powz1, diff;
float err;
{{RTYP}} err;
int k;
if (ABSQ(z1) >= 1.0) return -2; /* z1 not less than 1 */
@ -430,7 +433,7 @@ static {{TYP}} {{SUB}}_hs(int, {{TYP}}, double, double);
{{for SUB, TYP in zip(RNAME, RTYPE)}}
int {{SUB}}_IIR_forback2 (double r, double omega, {{TYP}} *x, {{TYP}} *y,
int N, int stridex, int stridey, float precision) {
int N, int stridex, int stridey, {{TYP}} precision) {
{{TYP}} cs;
{{TYP}} *yp = NULL;
{{TYP}} *yptr;

View File

@ -134,9 +134,9 @@ def lombscargle(x,
>>> plt.show()
"""
x = np.asarray(x, dtype=np.float64)
y = np.asarray(y, dtype=np.float64)
freqs = np.asarray(freqs, dtype=np.float64)
x = np.ascontiguousarray(x, dtype=np.float64)
y = np.ascontiguousarray(y, dtype=np.float64)
freqs = np.ascontiguousarray(freqs, dtype=np.float64)
assert x.ndim == 1
assert y.ndim == 1

View File

@ -1,30 +1,4 @@
#include "Python.h"
#include "numpy/arrayobject.h"
#include <math.h>
#define PYERR(message) do {PyErr_SetString(PyExc_ValueError, message); goto fail;} while(0)
static void convert_strides(npy_intp*,npy_intp*,int,int);
extern int S_cubic_spline2D(float*,float*,int,int,double,npy_intp*,npy_intp*,float);
extern int S_quadratic_spline2D(float*,float*,int,int,double,npy_intp*,npy_intp*,float);
extern int S_IIR_forback1(float,float,float*,float*,int,int,int,float);
extern int S_IIR_forback2(double,double,float*,float*,int,int,int,float);
extern int S_separable_2Dconvolve_mirror(float*,float*,int,int,float*,float*,int,int,npy_intp*,npy_intp*);
extern int D_cubic_spline2D(double*,double*,int,int,double,npy_intp*,npy_intp*,double);
extern int D_quadratic_spline2D(double*,double*,int,int,double,npy_intp*,npy_intp*,double);
extern int D_IIR_forback1(double,double,double*,double*,int,int,int,double);
extern int D_IIR_forback2(double,double,double*,double*,int,int,int,double);
extern int D_separable_2Dconvolve_mirror(double*,double*,int,int,double*,double*,int,int,npy_intp*,npy_intp*);
#ifdef __GNUC__
extern int C_IIR_forback1(__complex__ float,__complex__ float,__complex__ float*,__complex__ float*,int,int,int,float);
extern int C_separable_2Dconvolve_mirror(__complex__ float*,__complex__ float*,int,int,__complex__ float*,__complex__ float*,int,int,npy_intp*,npy_intp*);
extern int Z_IIR_forback1(__complex__ double,__complex__ double,__complex__ double*,__complex__ double*,int,int,int,double);
extern int Z_separable_2Dconvolve_mirror(__complex__ double*,__complex__ double*,int,int,__complex__ double*,__complex__ double*,int,int,npy_intp*,npy_intp*);
#endif
#include "_splinemodule.h"
static void
convert_strides(npy_intp* instrides,npy_intp* convstrides,int size,int N)

View File

@ -0,0 +1,27 @@
#include "Python.h"
#include "numpy/arrayobject.h"
#include <math.h>
#define PYERR(message) do {PyErr_SetString(PyExc_ValueError, message); goto fail;} while(0)
static void convert_strides(npy_intp*,npy_intp*,int,int);
extern int S_cubic_spline2D(float*,float*,int,int,double,npy_intp*,npy_intp*,float);
extern int S_quadratic_spline2D(float*,float*,int,int,double,npy_intp*,npy_intp*,float);
extern int S_IIR_forback1(float,float,float*,float*,int,int,int,float);
extern int S_IIR_forback2(double,double,float*,float*,int,int,int,float);
extern int S_separable_2Dconvolve_mirror(float*,float*,int,int,float*,float*,int,int,npy_intp*,npy_intp*);
extern int D_cubic_spline2D(double*,double*,int,int,double,npy_intp*,npy_intp*,double);
extern int D_quadratic_spline2D(double*,double*,int,int,double,npy_intp*,npy_intp*,double);
extern int D_IIR_forback1(double,double,double*,double*,int,int,int,double);
extern int D_IIR_forback2(double,double,double*,double*,int,int,int,double);
extern int D_separable_2Dconvolve_mirror(double*,double*,int,int,double*,double*,int,int,npy_intp*,npy_intp*);
#ifdef __GNUC__
extern int C_IIR_forback1(__complex__ float,__complex__ float,__complex__ float*,__complex__ float*,int,int,int,float);
extern int C_separable_2Dconvolve_mirror(__complex__ float*,__complex__ float*,int,int,__complex__ float*,__complex__ float*,int,int,npy_intp*,npy_intp*);
extern int Z_IIR_forback1(__complex__ double,__complex__ double,__complex__ double*,__complex__ double*,int,int,int,double);
extern int Z_separable_2Dconvolve_mirror(__complex__ double*,__complex__ double*,int,int,__complex__ double*,__complex__ double*,int,int,npy_intp*,npy_intp*);
#endif

View File

@ -35,11 +35,7 @@ if use_pythran
_max_len_seq_inner = py3.extension_module('_max_len_seq_inner',
[_max_len_seq_inner],
cpp_args: [
'-Wno-unused-function', '-Wno-unused-variable',
'-Wno-deprecated-declarations', '-Wno-unused-local-typedefs',
'-Wno-cpp', '-Wno-int-in-bool-context'
] + cpp_args_pythran,
cpp_args: [cpp_args_pythran, _cpp_Wno_unused_local_typedefs],
include_directories: [incdir_pythran, incdir_numpy],
dependencies: [py3_dep],
install: true,
@ -54,11 +50,7 @@ if use_pythran
_spectral = py3.extension_module('_spectral',
[_spectral],
cpp_args: [
'-Wno-unused-function', '-Wno-unused-variable',
'-Wno-deprecated-declarations',
'-Wno-cpp', '-Wno-int-in-bool-context'
] + cpp_args_pythran,
cpp_args: cpp_args_pythran,
include_directories: [incdir_pythran, incdir_numpy],
dependencies: [py3_dep],
install: true,

Some files were not shown because too many files have changed in this diff Show More