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

DEP: linalg: deprecate kron #21633

Merged
merged 4 commits into from
Sep 28, 2024
Merged

DEP: linalg: deprecate kron #21633

merged 4 commits into from
Sep 28, 2024

Conversation

j-bowhay
Copy link
Member

Reference issue

closes #20077
closes #20072

What does this implement/fix?

This was previously blocked by array-api discussions however now with data-apis/array-api-extra#7 I think we can now proceed.

Additional information

@github-actions github-actions bot added scipy.linalg deprecated Items related to behavior that has been deprecated labels Sep 27, 2024
Copy link
Member

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

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

thanks! just one comment

scipy/linalg/_special_matrices.py Outdated Show resolved Hide resolved
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
@j-bowhay j-bowhay added the needs-release-note a maintainer should add a release note written by a reviewer/author to the wiki label Sep 27, 2024
@lucascolley lucascolley added this to the 1.15.0 milestone Sep 27, 2024
@lucascolley
Copy link
Member

doctest failure is real

Copy link
Contributor

@tylerjereddy tylerjereddy left a comment

Choose a reason for hiding this comment

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

For the doctest failure, this seems to do the trick locally (a bit silly, though I suppose it makes the deprecation even harder to miss...). Maybe Evgeni has a slicker way to suppress the failure.

--- a/scipy/linalg/_special_matrices.py
+++ b/scipy/linalg/_special_matrices.py
@@ -337,9 +337,12 @@ def kron(a, b):
 
     Examples
     --------
+    >>> import warnings
     >>> from numpy import array
     >>> from scipy.linalg import kron
-    >>> kron(array([[1,2],[3,4]]), array([[1,1,1]]))
+    >>> with warnings.catch_warnings():
+    ...     warnings.simplefilter("ignore", DeprecationWarning)
+    ...     kron(array([[1,2],[3,4]]), array([[1,1,1]]))
     array([[1, 1, 1, 2, 2, 2],
            [3, 3, 3, 4, 4, 4]])

@ev-br
Copy link
Member

ev-br commented Sep 28, 2024

There's a DeprecationWarning filter for doctests in https://github.com/scipy/scipy/blob/main/scipy/conftest.py#L382-L389, if you want to use that.

@lucascolley lucascolley merged commit 7da4a39 into scipy:main Sep 28, 2024
@lucascolley
Copy link
Member

thanks Jake!

@j-bowhay j-bowhay mentioned this pull request Sep 29, 2024
41 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated Items related to behavior that has been deprecated needs-release-note a maintainer should add a release note written by a reviewer/author to the wiki scipy.linalg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEP: linalg: deprecate kron ENH:linalg: kron does not support nd arrays with n>2
4 participants