Skip to content

Conversation

@jorenham
Copy link
Member

Because ode works in both real and complex cases, an additional type parameter has been added.

Note that this generic type signature change is technically backwards incompatible. But since using it at runtime isn't supported yet by scipy, I don't expect that this will cause many issues in practice. Otherwise, it's easy to work around, seeing as the type parameters are all optional.

Copy link
Contributor

Copilot AI left a 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 improves the type annotations for the ode class in scipy.integrate by adding a new type parameter to handle both real and complex number cases more precisely. The main change involves adding a generic type parameter _Inexact64T_co to represent the scalar type (either np.float64 or np.complex128) while maintaining backward compatibility with the existing *_Ts parameter for function arguments.

  • Added a new type parameter _Inexact64T_co to distinguish between real and complex ODE cases
  • Enhanced method signatures with overloads to provide more precise type information for different integrator types
  • Updated return types and parameter types throughout the class hierarchy to be more specific

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
scipy-stubs/integrate/_ode.pyi Enhanced ode class with new generic type parameter and improved method signatures with overloads
README.md Updated documentation table to reflect the new generic signature and version compatibility

@jorenham jorenham merged commit 0126122 into master Jul 21, 2025
19 checks passed
@jorenham jorenham deleted the integrate.ode branch July 21, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants