|
116 | 116 | # **************************************************************************** |
117 | 117 |
|
118 | 118 | from copy import copy |
| 119 | +import operator |
119 | 120 |
|
120 | 121 | from sage.arith.misc import integer_ceil, integer_floor, xlcm |
121 | 122 | from sage.arith.srange import xsrange |
@@ -151,9 +152,10 @@ def _parse_group_def(parent, operation, identity, inverse, op, *, check_missing= |
151 | 152 | - ``operation`` -- a string, one of the standard operations |
152 | 153 | (multiplication or addition) or ``'other'`` |
153 | 154 | - ``identity`` -- the identity element of the group, or ``None`` |
154 | | - - ``inverse`` -- a function of one argument returning the inverse |
155 | | - of its argument, or ``None`` |
156 | | - - ``op`` -- a function of two arguments returning the group |
| 155 | + - ``inverse`` -- if not ``None``, a function taking one argument and |
| 156 | + returning its inverse |
| 157 | + - ``op`` -- if not ``None``, a function taking two arguments and |
| 158 | + computing the group operation on these two arguments |
157 | 159 |
|
158 | 160 | OUTPUT: a tuple ``('other', identity, inverse, op)`` |
159 | 161 |
|
@@ -228,7 +230,6 @@ def _power_func(operation, identity, inverse, op): |
228 | 230 | sage: _power_func('other', 0, operator.neg, operator.add) |
229 | 231 | <built-in function mul> |
230 | 232 | """ |
231 | | - import operator |
232 | 233 | if op is operator.add: |
233 | 234 | return operator.mul |
234 | 235 | if op is operator.mul: |
@@ -256,7 +257,6 @@ def _ord_from_op(x, op): |
256 | 257 | sage: _ord_from_op(mod(2, 5), operator.mul) |
257 | 258 | 4 |
258 | 259 | """ |
259 | | - import operator |
260 | 260 | if op is operator.add: |
261 | 261 | return x.additive_order() |
262 | 262 | if op is operator.mul: |
@@ -721,7 +721,6 @@ def discrete_log_rho(a, base, ord=None, operation='*', identity=None, inverse=No |
721 | 721 | from sage.rings.finite_rings.integer_mod_ring import IntegerModRing |
722 | 722 |
|
723 | 723 | operation, identity, inverse, op = _parse_group_def(parent(a), operation, identity, inverse, op) |
724 | | - import operator |
725 | 724 |
|
726 | 725 | # should be reasonable choices |
727 | 726 | partition_size = 20 |
|
0 commit comments