-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
add generic has_order() function #36806
add generic has_order() function #36806
Conversation
src/sage/groups/generic.py
Outdated
n = n.factor() | ||
|
||
G = P.parent() | ||
if operation == '+': |
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.
I think it would be better to use operator.add
and operator.mul
than string comparisons. Although strings seem to be used elsewhere...
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.
On the long run, all of these ad-hoc interfaces should be replaced by a proper wrapper class (which is work in progress). For now, I'd stick to doing it the same way as the existing functions in this file...
ebaa89c
to
be14d9f
Compare
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.
Okay, fair enough. Then just a few more little things.
Documentation preview for this PR (built with commit 3e61e7d; changes) is ready! 🎉 |
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.
Thank you. LGTM now.
Thank you! |
sagemathgh-36806: add generic has_order() function Currently there is `order_from_multiple()` for generic groups, but sometimes we really only want to know if the order equals a particular value (e.g., when sampling random elements to find a generating set of a group with known structure). This means the computation can be aborted earlier than when finding the exact order is required. In this patch we add such an optimized `has_order()` function as well as a convenience wrapper for elliptic-curve points. An example of the speedup can be found in one of the new doctests. URL: sagemath#36806 Reported by: Lorenz Panny Reviewer(s): Lorenz Panny, Travis Scrimshaw
Currently there is
order_from_multiple()
for generic groups, but sometimes we really only want to know if the order equals a particular value (e.g., when sampling random elements to find a generating set of a group with known structure). This means the computation can be aborted earlier than when finding the exact order is required.In this patch we add such an optimized
has_order()
function as well as a convenience wrapper for elliptic-curve points. An example of the speedup can be found in one of the new doctests.