On Feb 13, 2008 1:02 PM, John Cremona <[EMAIL PROTECTED]> wrote: > > OK, I'll rewrite it as suggested by WIlliam. Now, isn't there a > better place to put it than sage.rings.arith? Somewhere in (finite) > (abelian) groups?
Make a new file, e.g., sage/groups/abelian_gps/dlog.py You might also wnat to make a Cython version that you pass in C function points to; I don't know. -- William > > There may also need to be parameters allowed the creation of the > identity, and inverses (my implementation certainly subtracts > elements). > > John > > > On 13/02/2008, William Stein <[EMAIL PROTECTED]> wrote: > > > > On Feb 13, 2008 9:57 AM, Nick Alexander <[EMAIL PROTECTED]> wrote: > > > > > > > > > On 13-Feb-08, at 6:06 AM, John Cremona wrote: > > > > > > > > > > > I just discovered sage.rings.arith.discrete_log_generic(), not until > > > > after implementing a similar function for elliptic curves over finite > > > > fields (patch to be submitted before too long). I thought it was a > > > > pity that we cannot apparently use the same code for dlogs in an > > > > additive group (as in what I just wrote) and a multiplcative one (as > > > > in discrete_log_generic()). Could we? > > > > > > At this time, not easily. > > > > I think it would be trivial. Just pass in a function of two arguments > > called > > "mul" instead of using "*". It's the same way Python's sort works. > > (One should probably also pass in a pow function.) > > > > > Some of the categorical work initiated at > > > SD7 could help with this. The relevant instigator is Nicholas Thiery > > > and the implementors are, at this time, Robert Bradshaw, David Roe, > > > and Mike Hansen. (Apologies if I added/dropped anyone.) > > > > That sort of complicated stuff would only be necessary maybe for > > efficiency reasons -- but then you shouldn't be using a generic > > algorithm. > > > > > > > > > Also, in the code for sage.rings.arith.discrete_log_generic(), which I > > > > see was written by WIlliam and David Joyner in prehistoric times > > > > (2005-01-05 must be before the first ever reease of Sage!) there is > > > > an inefficiency in using an array for g instead of a dict. Shall I > > > > write a patch for that? > > > > > > Please do. > > > > Yes, please. That was before I knew about some tricks like that.... > > > > > > > > > > > > > > > > > > > > -- > > William Stein > > Associate Professor of Mathematics > > University of Washington > > http://wstein.org > > > > > > > > > > -- > John Cremona > > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---