Jerry K <jerryk...@gmail.com> writes: Hi Jerry,
> 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. Yes, you're right. And after some tests I found out that CL isn't doing better, too. > 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." Yes, Mark suggested that too, and I'll integrate it. > 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. Thanks. > 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, That's my exact feeling, too. > 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? Not me, but implementing those algorithms is good to get started with any language. Bye, Tassilo -- Chuck Norris can set ants on fire with a magnifying glass. At night. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---