On Mar 11, 2009, at 11:04 AM, Jerry K wrote:
> > Also, I've not looked at any of the math code in clojure contrib, but > expressed as such, I wouldn't expect the idiom "(mod (expt n exp) m)" > to be at all fast for reasons largely independent of the numeric > implementation underneath. > > Computing the entire power and then reducing it modulo m is going to > be gruesome at the number sizes you'll expect in cryptographic or > computational number theory applications. Even if BigInteger were > faster, you're going to be giving that code much less of a workout > using "repeated squaring" or the "binary algorithm." There seems to > be a decent wikipedia writeup on it at > http://en.wikipedia.org/wiki/Modular_exponentiation > and if you want more details and options, Shallit and Bach's > "Algorithmic Number Theory" (http://www.amazon.com/Algorithmic-Number- > Theory-Vol-Foundations/dp/0262024055) is a good place to look. > > I had thought a while back about digging into building some math code > for clojure contrib for applications like algebra and number theory, > since Clojure's Lispyness makes it well suited for that, but wasn't > sure anybody else was especially interested. I was also thinking > about throwing together an interval arithmetic package that would have > been useful to me on a now concluded project, but never got around to > it. Are there Clojurers out there doing math-intensive stuff with > regularity? Yes! +1 on math code in general, and +1 more on an interval arithmetic package ... I was wanting that just earlier today! Cheers, Jason --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---