2**HUGENUMBER Why not optimise it?

jepler at unpythonic.net jepler at unpythonic.net
Fri May 24 08:33:12 EDT 2002


On Fri, May 24, 2002 at 10:06:12AM +0000, Michael Hudson wrote:
> Christian Tismer <tismer at tismer.com> writes:
> 
> > Michael Hudson wrote:
> > > Do you feel like implementing Karatsuba multiplication in
> > > longobject.c?  That might actually be some use...
> > 
> > Although this was on the table two or three years ago,
> 
> I know.  I remember.  That thread was probably the first place I heard
> of Karatsuba multiplication...

The message you're looking for may be in a thread from July 1999:
http://groups.google.com/groups?hl=en&lr=&threadm=37922175.FEEBE203%40appliedbiometrics.com&rnum=4&prev=/groups%3Fq%3Dgroup:comp.lang.python%2Bkaratsuba%26hl%3Den%26lr%3D%26selm%3D37922175.FEEBE203%2540appliedbiometrics.com%26rnum%3D4

It'd be a bit nicer now that the builtin "long" class can be subclassed.
Too bad you can't write
    long.__mul__ = karatsuba_mul
or
    long = karatsuba_long
and have it "work" (longs constructed in the easy way, 'x=1L', would have
karatsuba multiplication behavior by default)

Jeff





More information about the Python-list mailing list