Skip to content
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

Rcpp version of mpoly and mpoly arithmetic #12

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Conversation

Blaza
Copy link
Contributor

@Blaza Blaza commented Jan 10, 2018

No description provided.

@dkahle
Copy link
Owner

dkahle commented Jan 20, 2018

Any idea why ^.mpoly() is so much slower than previously?

@Blaza
Copy link
Contributor Author

Blaza commented Jan 20, 2018

Haven't really done the benchmark or profiling, but when I look at it, it seems that the problem may be that the original R version would just do *.mpoly in a loop, which implies doing mpoly for every multiplication, thus simplifying the polynomial for the next loop iteration, whereas the Cpp version just does the Cpp multiplication in a loop without simplifying the polynomial and the complexity of the mpoly list object increases substantially at each iteration. And it may be the case that the overhead of this complexity beats the overhead of doing the R loop and mpoly each time, as each operation in the loop is pretty fast.

Those are just my thoughts, as the only difference I can see between the implementations is the lack of mpoly after each multiplication in the Cpp version.

Do you have any concrete benchmarks or profiling results for this?

Perhaps sticking with the R version of ^.mpoly is better if the looping doesn't add too much overhead. I don't have the time right now to do a good benchmark of that.

The multiplication *.mpoly works faster than the original version though, right?

This fixes the terrible performance of raising polynomials to a power.
@Blaza
Copy link
Contributor Author

Blaza commented Apr 7, 2018

That really turned out to be the issue, I added poly reducing now in every loop iteration and it works fast now.

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.

2 participants