Skip to content

Conversation

mohammedouahman
Copy link
Contributor

@mohammedouahman mohammedouahman commented Jul 17, 2023

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.

  • functions
    • Updated pow function in the Quaternion class for improved efficiency and handling of negative powers.

@sympy-bot
Copy link

sympy-bot commented Jul 17, 2023

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:

  • functions

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 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.

<!-- BEGIN RELEASE NOTES -->
* functions
  * Updated pow function in the Quaternion class for improved efficiency and handling of negative powers.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@mohammedouahman mohammedouahman changed the title Update pow function for improved efficiency and handling of negative … Update pow function for improved efficiency and handling of negative powers Jul 17, 2023
@github-actions
Copy link

github-actions bot commented Jul 17, 2023

Benchmark results from GitHub Actions

Lower numbers are good, higher numbers are bad. A ratio less than 1
means a speed up and greater than 1 means a slowdown. Green lines
beginning with + are slowdowns (the PR is slower then master or
master is slower than the previous release). Red lines beginning
with - are speedups.

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
(click on checks at the top of the PR).

@smichr smichr enabled auto-merge July 19, 2023 14:52

if not p.is_Integer:
return NotImplemented
q, p = self, as_int(p)
Copy link
Collaborator

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.

@smichr smichr enabled auto-merge September 12, 2023 12:42
@smichr smichr merged commit 908215f into sympy:master Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants