10000 DOC: `linalg.toeplitz` does not support batching like the `1.16.0rc1` release notes say · Issue #23038 · scipy/scipy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

DOC: linalg.toeplitz does not support batching like the 1.16.0rc1 release notes say #23038

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

Closed
jorenham opened this issue May 22, 2025 · 3 comments
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.linalg
Milestone

Comments

@jorenham
Copy link
Contributor

The 1.16.0rc1 release notes state that

All functions in the scipy.linalg namespace that accept array arguments
now support N-dimensional arrays to be processed as a batch.
See :ref:linalg_batch for details.

But in the scipy.linalg.toeplitz docstring it says:

Beginning in SciPy 1.17, multidimensional input will be treated as a batch,
not ravel\ ed. To preserve the existing behavior, ravel arguments
before passing them to toeplitz.


A related, even nitpicky-er observation, is that other special matrix constructors that accept 0d array arguments also don't support batching:

>>> hilbert(np.array(3))
array([[1.        , 0.5       , 0.33333333],
       [0.5       , 0.33333333, 0.25      ],
       [0.33333333, 0.25      , 0.2       ]])
>>> hilbert(np.array([3, 3]))
Traceback (most recent call last):
  File "<python-input-10>", line 1, in <module>
    hilbert(np.array([3, 3]))
    ~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/joren/.pyenv/versions/3.13.3/lib/python3.13/site-packages/scipy/linalg/_special_matrices.py", line 623, in hilbert
    values = 1.0 / (1.0 + np.arange(2 * n - 1))
                          ~~~~~~~~~^^^^^^^^^^^
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I doubt that anyone would realistically interpret "array arguments" this way, though 🤷🏻

@github-actions github-actions bot added the Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org label May 22, 2025
@mdhaber
Copy link
Contributor
mdhaber commented May 22, 2025

Please suggest a better wording.

IIRC, toeplitz is the only real exception to "All functions in the scipy.linalg namespace..." (because it needed a backward compatible change), so it could be changed to "All functions in the scipy.linalg namespace except toeplitz". Or to be safer,

Nearly all functions in the scipy.linalg namespace....

As for the comment about 0-d arrays, I was going off the documentation. hilbert may accept 0-d arrays, but it is documented to accept ints. I would be happy to ignore that technicality for the sake of the release notes, but you are welcome to complicate them, e.g.:

Nearly all functions in the scipy.linalg namespace that are documented to accept array arguments

@jorenham
Copy link
Contributor Author

Nearly all functions in the scipy.linalg namespace....

This sounds like a good alternative to me 👌🏻

@tylerjereddy
Copy link
Contributor

Forwarding porting release notes after final release is pretty standard, so I think we can close this with the maintenance branch PR merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.linalg
Projects
None yet
Development

No branches or pull requests

3 participants
0