Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spalde error with scipy 1.10: 0-th dimension must be fixed #19002

Closed
mercury1492 opened this issue Aug 2, 2023 · 2 comments · Fixed by #19004
Closed

Spalde error with scipy 1.10: 0-th dimension must be fixed #19002

mercury1492 opened this issue Aug 2, 2023 · 2 comments · Fixed by #19004
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.interpolate
Milestone

Comments

@mercury1492
Copy link

Describe your issue.

I encounter an issue with spalde with scipy 1.10.1 and 1.11.1 (it worked fine with earlier version, like 1.9.3). See repro below. Thanks.

Reproducing Code Example

import numpy as np
from scipy.interpolate import spalde


x = np.asarray([-10., - 9., - 8., - 7., - 6., - 5., - 4., - 3., - 2.5, - 2., - 1.5, - 1., -0.5, 0., 0.5, 1., 1.5, 2., 2.5, 3., 4., 5., 6.], dtype="float")

knots = [-10.0, -10.0, -10.0, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.5, -2.0, -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 6.0, 6.0, 6.0]
b_spline_coefficients = np.asarray([1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
k = 3

print(spalde(x, (knots, b_spline_coefficients, k)))

Error message

ValueError: 0-th dimension must be fixed to 29 but got 25


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\abc\PycharmProjects\demo.py", line 15, in <module>
    print(spalde(x, (knots, b_spline_coefficients, k)))
  File "C:\Users\abc\miniconda3\lib\site-packages\scipy\interpolate\_fitpack_py.py", line 574, in spalde
    return _impl.spalde(x, tck)
  File "C:\Users\abc\miniconda3\lib\site-packages\scipy\interpolate\_fitpack_impl.py", line 778, in spalde
    return list(map(lambda x, tck=tck: spalde(x, tck), x))
  File "C:\Users\abc\miniconda3\lib\site-packages\scipy\interpolate\_fitpack_impl.py", line 778, in <lambda>
    return list(map(lambda x, tck=tck: spalde(x, tck), x))
  File "C:\Users\abc\miniconda3\lib\site-packages\scipy\interpolate\_fitpack_impl.py", line 779, in spalde
    d, ier = dfitpack.spalde(t, c, k+1, x[0])
ValueError: failed in converting 2nd argument `c' of dfitpack.spalde to C/Fortran array

SciPy/NumPy/Python version and system information

1.10.1 1.25.0 sys.version_info(major=3, minor=10, micro=12, releaselevel='final', serial=0)
lapack_mkl_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Users/abc/miniconda3\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Users/fdesc/miniconda3\\Library\\include']
lapack_opt_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Users/abc/miniconda3\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Users/fdesc/miniconda3\\Library\\include']
blas_mkl_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Users/abc/miniconda3\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Users/fdesc/miniconda3\\Library\\include']
blas_opt_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Users/abc/miniconda3\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Users/fdesc/miniconda3\\Library\\include']
Supported SIMD extensions in this NumPy install:
    baseline = SSE,SSE2,SSE3
    found = SSSE3,SSE41,POPCNT,SSE42,AVX,F16C,FMA3,AVX2
    not found = AVX512F,AVX512CD,AVX512_SKX,AVX512_CLX,AVX512_CNL,AVX512_ICL
@mercury1492 mercury1492 added the defect A clear bug or issue that prevents SciPy from being installed or used as expected label Aug 2, 2023
@ev-br
Copy link
Member

ev-br commented Aug 2, 2023

Confirmed. Indeed spalde needs to allow for len(c)>=len(t)-k-1, similar to #18195

@ev-br
Copy link
Member

ev-br commented Aug 2, 2023

Thanks for the report @mercury1492! See #19004 for a fix.

@j-bowhay j-bowhay added this to the 1.12.0 milestone Aug 11, 2023
@tylerjereddy tylerjereddy modified the milestones: 1.12.0, 1.11.2 Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.interpolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants