-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Open
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats
Description
Describe your issue.
There is a huge speed regression (180x slower) in computing the cdf for the multivariate normal since scipy-1.16.0. The numerical precision is also worse and that lets unit tests in the iminuit package fail that used to pass since the Python-3.9 days.
Tested on MacOS, Linux.
Reproducing Code Example
import numpy as np
from scipy import stats
def mvnorm(mux, muy, sx, sy, rho):
C = np.empty((2, 2))
C[0, 0] = sx**2
C[0, 1] = C[1, 0] = sx * sy * rho
C[1, 1] = sy**2
m = [mux, muy]
return stats.multivariate_normal(m, C)
def model(xy, mux, muy, sx, sy, rho):
return mvnorm(mux, muy, sx, sy, rho).cdf(xy.T)
rng = np.random.default_rng(42)
%%timeit
model(rng.normal(size=(2, 1000)), 0, 0, 1, 1, 0)
v1.15.3: 1.63 ms ± 7.17 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
v1.16.0: 286 ms ± 21.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
v1.16.1: 265 ms ± 5.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Error message
None
SciPy/NumPy/Python version and system information
1.15.3 2.2.5 sys.version_info(major=3, minor=12, micro=8, releaselevel='final', serial=0)
C:\Users\hansd.Powercat\AppData\Roaming\Python\Python312\site-packages\scipy\__config__.py:154: UserWarning: Install `pyyaml` for better output
warnings.warn("Install `pyyaml` for better output", stacklevel=1)
{
"Compilers": {
"c": {
"name": "gcc",
"linker": "ld.bfd",
"version": "10.3.0",
"commands": "cc"
},
"cython": {
"name": "cython",
"linker": "cython",
"version": "3.0.12",
"commands": "cython"
},
"c++": {
"name": "gcc",
"linker": "ld.bfd",
"version": "10.3.0",
"commands": "c++"
},
"fortran": {
"name": "gcc",
"linker": "ld.bfd",
"version": "10.3.0",
"commands": "gfortran"
},
"pythran": {
"version": "0.17.0",
"include directory": "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pip-build-env-dihuxz0e\\overlay\\Lib\\site-packages/pythran"
}
},
"Machine Information": {
"host": {
"cpu": "x86_64",
"family": "x86_64",
"endian": "little",
"system": "windows"
},
"build": {
"cpu": "x86_64",
"family": "x86_64",
"endian": "little",
"system": "windows"
},
"cross-compiled": false
},
"Build Dependencies": {
"blas": {
"name": "scipy-openblas",
"found": true,
"version": "0.3.28",
"detection method": "pkgconfig",
"include directory": "C:/Users/runneradmin/AppData/Local/Temp/cibw-run-3dk08vlg/cp312-win_amd64/build/venv/Lib/site-packages/scipy_openblas32/include",
"lib directory": "C:/Users/runneradmin/AppData/Local/Temp/cibw-run-3dk08vlg/cp312-win_amd64/build/venv/Lib/site-packages/scipy_openblas32/lib",
"openblas configuration": "OpenBLAS 0.3.28 DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=24",
"pc file directory": "D:/a/scipy/scipy"
},
"lapack": {
"name": "scipy-openblas",
"found": true,
"version": "0.3.28",
"detection method": "pkgconfig",
"include directory": "C:/Users/runneradmin/AppData/Local/Temp/cibw-run-3dk08vlg/cp312-win_amd64/build/venv/Lib/site-packages/scipy_openblas32/include",
"lib directory": "C:/Users/runneradmin/AppData/Local/Temp/cibw-run-3dk08vlg/cp312-win_amd64/build/venv/Lib/site-packages/scipy_openblas32/lib",
"openblas configuration": "OpenBLAS 0.3.28 DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=24",
"pc file directory": "D:/a/scipy/scipy"
},
"pybind11": {
"name": "pybind11",
"version": "2.13.6",
"detection method": "config-tool",
"include directory": "unknown"
}
},
"Python Information": {
"path": "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-3dk08vlg\\cp312-win_amd64\\build\\venv\\Scripts\\python.exe",
"version": "3.12"
}
}
Metadata
Metadata
Assignees
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats