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

Polynomial division #52

Merged
merged 53 commits into from
Mar 18, 2016
Merged

Polynomial division #52

merged 53 commits into from
Mar 18, 2016

Conversation

bluescarni
Copy link
Owner

Some initial code for polynomial division and GCD. Work in progress.

… the record, it will be rolled back.

[skip ci]
…tted for the record, it will be rolled back."

This reverts commit 681496b.
Includes testing, doc and specialisation of math functors.
build_system: enable the -Wodr flag if supported.
Testing and documentation still to be done.
…c for the algorithm selection.

Tests still to be written.
@bluescarni
Copy link
Owner Author

@certik @isuruf @rwst pinging in case you are interested

So this is Piranha's first foray into poly division and GCD. I implemented both exact multivariate polynomial division and GCD over generic UFDs.

Just to make things clear since the beginning, performance is going to be horrid. This is due to two root causes:

  • as you know, Piranha uses hash tables for representing polynomials. This works well for ring operations, but division and GCD essentially require the terms to be kept in an ordered fashion. I will need to code an alternative data structure into which Piranha's hash tables will have to be converted before entering division and GCD algorithms. I have a fairly precise idea of what to do, but as you can imagine it's rather substantial work and I'd prefer to have something working now rather than delaying merging this PR (which I need in order to implement rational functions);
  • this is the first time that I touch division and GCD operations, so I went for easy algorithms to code and implemented them in a straightforward fashion. Currently, there are two GCD algorithms available: subresultant sequence with pseudo-remainders and heuristic GCD. The heuristic GCD is tried first, if it fails the other algorithm will be used. You can also force the algorithm to be used with a flag. There are other families of algorithms which are theoretically better (at least in some cases), so eventually it makes sense to implement at least some of them.

I consider the first point to have a higher priority than the second. If anything, I think we need to have a good implementation of the primitive data structures before comparing algorithmic performance.

Despite the performance problems, the code is as tested as any new feature I have implemented in Piranha so far and at this point I am not aware of correctness bugs. I made sure to have 2 GCD implementations available so I could compare the results of the two as an additional check.

I'll merge the PR tomorrow when all the checks are run.

bluescarni added a commit that referenced this pull request Mar 18, 2016
@bluescarni bluescarni merged commit 26d8c23 into master Mar 18, 2016
@bluescarni bluescarni deleted the poly_division branch March 18, 2016 11:52
@certik
Copy link
Contributor

certik commented Mar 18, 2016

@bluescarni cool, that's exciting. Thanks for letting us know.

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