-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Update pow function for improved efficiency and handling of negative powers #25385
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
✅ Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.13. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
Benchmark results from GitHub Actions Lower numbers are good, higher numbers are bad. A ratio less than 1 Significantly changed benchmark results (PR vs master) Significantly changed benchmark results (master vs previous release) | Change | Before [8059df73] <sympy-1.12^0> | After [ceb5664d] | Ratio | Benchmark (Parameter) |
|----------|------------------------------------|---------------------|---------|----------------------------------------------------------------------|
| - | 84.0±0.6ms | 55.8±0.2ms | 0.66 | integrate.TimeIntegrationRisch02.time_doit(10) |
| - | 83.3±0.7ms | 55.2±0.1ms | 0.66 | integrate.TimeIntegrationRisch02.time_doit_risch(10) |
| + | 21.8±0.1μs | 40.0±0.2μs | 1.83 | integrate.TimeIntegrationRisch03.time_doit(1) |
| - | 6.90±0.01ms | 3.69±0.01ms | 0.54 | logic.LogicSuite.time_load_file |
| - | 2.12±0ms | 630±2μs | 0.3 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 10.5±0.03ms | 1.86±0ms | 0.18 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse') |
| - | 359±2μs | 78.7±0.8μs | 0.22 | polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 4.80±0.01ms | 344±0.7μs | 0.07 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 10.7±0.06ms | 1.04±0ms | 0.1 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse') |
| - | 6.26±0.01ms | 3.79±0ms | 0.61 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse') |
| - | 27.6±0.08ms | 11.6±0.03ms | 0.42 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 6.66±0.04ms | 1.11±0ms | 0.17 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 15.8±0.05ms | 8.91±0.04ms | 0.56 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse') |
| - | 206±0.1ms | 68.1±0.09ms | 0.33 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 6.41±0.02ms | 503±0.9μs | 0.08 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse') |
| - | 27.7±0.04ms | 799±4μs | 0.03 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse') |
| - | 589±3μs | 199±0.3μs | 0.34 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse') |
| - | 6.43±0.04ms | 202±1μs | 0.03 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse') |
| - | 16.6±0.04ms | 204±0.3μs | 0.01 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse') |
| - | 162±0.4μs | 91.1±0.1μs | 0.56 | solve.TimeMatrixOperations.time_rref(3, 0) |
| - | 305±0.5μs | 107±0.4μs | 0.35 | solve.TimeMatrixOperations.time_rref(4, 0) |
| - | 30.1±0.09ms | 12.8±0.06ms | 0.42 | solve.TimeSolveLinSys189x49.time_solve_lin_sys |
Full benchmark results can be found as artifacts in GitHub Actions |
sympy/algebras/quaternion.py
Outdated
|
||
if not p.is_Integer: | ||
return NotImplemented | ||
q, p = self, as_int(p) |
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.
The tests failed because p
is not always an integer.
Update pow function for improved efficiency and handling of negative powers
This pull request updates the pow function in the Quaternion class to improve its efficiency and handle negative powers more effectively. The modifications include optimized algorithms and proper handling of negative powers using the inverse function. These changes enhance the overall performance and functionality of the Quaternion class.