-
Notifications
You must be signed in to change notification settings - Fork 517
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
Update Pyomo for NumPy 2 #3292
Update Pyomo for NumPy 2 #3292
Changes from 6 commits
1e7fabd
cb67230
6f86e32
2145a16
e5973d4
c88e0d5
3ea998a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,10 @@ | |
# Boolean | ||
numpy_bool_names = [] | ||
if numpy_available: | ||
numpy_bool_names.append('bool_') | ||
if numpy.__version__[0] == '2': | ||
numpy_bool_names.append('bool') | ||
else: | ||
numpy_bool_names.append('bool_') | ||
Comment on lines
-19
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you check version here, but everywhere else you use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because John added that one... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh but also, I can answer - this is a forwards-compatible one. |
||
# Integers | ||
numpy_int_names = [] | ||
if numpy_available: | ||
|
@@ -34,7 +37,8 @@ | |
# Reals | ||
numpy_float_names = [] | ||
if numpy_available: | ||
numpy_float_names.append('float_') | ||
if hasattr(numpy, 'float_'): | ||
numpy_float_names.append('float_') | ||
numpy_float_names.append('float16') | ||
numpy_float_names.append('float32') | ||
numpy_float_names.append('float64') | ||
|
@@ -46,7 +50,8 @@ | |
# Complex | ||
numpy_complex_names = [] | ||
if numpy_available: | ||
numpy_complex_names.append('complex_') | ||
if hasattr(numpy, 'complex_'): | ||
numpy_complex_names.append('complex_') | ||
numpy_complex_names.append('complex64') | ||
numpy_complex_names.append('complex128') | ||
if hasattr(numpy, 'complex192'): | ||
|
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.
Note that
float_
/complex_
were simple aliases tofloat64
/complex128
, so it is not necessary to handle them for numpy 1.x, just dropping them is fully backwards compatible.