-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
Implement modular exponentiation for all polynomial rings #15867
Comments
Stopgaps: wrongAnswerMarker |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
Commit: |
comment:8
Thanks! Please add your full name in the "Authors" field. |
comment:9
Now that the modulus argument is no longer ignored, you should rename it from |
Author: Shashwat Singh |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:12
Replying to @slel:
Yeah, done! :) |
comment:13
Replying to @yyyyx4:
renamed to |
comment:14
To compare to - if modulus != None:
+ if modulus is not None: |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:16
Replying to @slel:
Done (and rewrote history) :) |
comment:17
This patch makes things better in that it renders the implementation of The other issue is that the patch only affects modular exponentation for one particular univariate polynomial class in Sage, but there are tons of other polynomial implementations that still don't implement this correctly. Presumably, the best way to go would be to implement a generic modular-exponentiation function (do we have that already?) and simply call it in each of the polynomial classes when the |
comment:18
Replying to @yyyyx4:
I am going to begin work on a modular exponentiation function that is more efficient. But before I begin, I had a few doubts:
I started a mailing list thread here if that's more appropriate to respond to https://groups.google.com/g/sage-devel/c/5A8CDkj9jKo |
comment:19
If you're going to implement this on the level of Also note that "efficient" powering of polynomials modulo other polynomials over QQ is less useful than you might initially think: it helps a LOT to not carry the higher order terms around, but the coefficient swell will still be significant, bounding the feasible powers to a relatively small range. For polynomials over finite fields, where coefficient swell is not an issue, this is an entirely different story. You probably also want to document what exactly the modulo operation that you're doing, since As an example:
|
comment:20
Replying to @nbruin:
I think this is outside the scope here: The notion of reduction is simply whatever |
comment:21
Replying to @shashwat1002:
Yes. In fact, I discovered that we already have such a function in Sage: This means all we really need to do for this ticket is adding code along the lines of
to all the |
comment:22
Replying to @yyyyx4:
Hi, I had already written binary exponentiation (modular) using FLINT C functions directly. I'll replace my work with this. However, I am wondering, would there be a significant efficiency advantage writing it in cython (and making calls to FLINT functions as opposed to python as in power_mod) |
comment:23
There certainly are circumstances where saving on Python overhead is worth it, but my guess is that it won't give a noticeable speedup here. In this algorithm (except for toy-sized inputs), virtually all of the time will be spent on polynomial arithmetic, which is already implemented in low-level code even if you call it from Python. Out of curiousity: Do you have an application in mind where you need this operation to be really fast? |
comment:25
Replying to @yyyyx4:
Not at the moment, no. I couldn't find a I am honestly struggling trying to find where to put appropriate code. Is there a detailed dev documentation somewhere? |
CC: @roed314 @jdemeyer @pjbruin @sagetrac-jakobkroeker
Component: algebra
Stopgaps: wrongAnswerMarker
Author: Shashwat Singh
Branch/Commit: u/gh-shashwat1002/mod_exponentation_polynom @
c37ccc8
Issue created by migration from https://trac.sagemath.org/ticket/15867
The text was updated successfully, but these errors were encountered: