On 13-Feb-08, at 12:28 PM, William Stein 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.) John also needs identity and inverses, which requires passing in three or functions. Or, more likely a struct, which in an OO language, I call an object. To me, that means you're writing a special purpose "abstract group" wrapper for discrete logs, which is fine. But I believe the heavier categorical stuff is intended to make doing this much more general and pervasive throughout the system. Doing one instance ad-hoc is easy; doing the general case is not easy (imho). Nick --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---