-
Notifications
You must be signed in to change notification settings - Fork 275
BUG: numpy 1.16 doesn't support @np.vectorize decorator syntax
#1164
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
Conversation
This reverts commit 149b057.
Replaces usage of _core_dot_2d with a new vectorized _core_dot_nd for mixed-type matrix multiplication in _core_dot. Defines _core_dot_nd as a vectorized wrapper around _core_dot_2d, improving code clarity and consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a compatibility issue with NumPy 1.16 where the @np.vectorize decorator syntax was not supported. The fix refactors the code to use np.vectorize as a function call instead of a decorator, and reverts the minimum NumPy version requirement from 1.19.0 back to 1.16.0.
Changes:
- Refactored
_core_dot_2dto usenp.vectorizeas a function assignment instead of as a decorator - Reverted minimum NumPy version from 1.19.0 to 1.16.0 in
pyproject.toml - Removed the changelog entry about the NumPy version increase
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/pyscipopt/matrix.pxi | Refactored _core_dot_2d from decorator-style to function-call-style np.vectorize, changed function signature to cdef, and updated a parameter documentation |
| pyproject.toml | Reverted minimum NumPy version requirement from 1.19.0 to 1.16.0 |
| CHANGELOG.md | Removed the entry about NumPy version increase that was previously added |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@np.vectorize decorator syntax
Refactored _core_dot_2d to be a Python-accessible function with an explicit return type annotation. This improves clarity and allows the function to be used from Python code.
|
Since PR CI only has one environment, I'm not sure it's okay to master the branch. |
|
Thank you @Zeroto521 , please let me know if it passes in your local env. |
NumPy 1.x doesn't support this
Relocated the _vec_evaluate assignment to precede the _ensure_array function for improved code organization and clarity.
NumPy 1.x doesn't support bool
This PR is fine. Local tests are passed. |
Joao-Dionisio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fingers crossed!
|
Nope, now it breaks something else: https://github.com/scipopt/PySCIPOpt/actions/runs/21245818764/job/61134718269 |
|
It's still a version compatibility problem. Only fails on window 3.8 |
closes #1159
A lower numpy version, like 1.16, doesn't support the
@np.vectorizedecorator.