a function to get multiplication threshold?

Kevin Ryde user42@zip.com.au
Wed, 18 Dec 2002 10:05:30 +1000


Serge Winitzki <serge@cosmos.phy.tufts.edu> writes:
>
> I was trying to see at what precision GMP is starting to use
> subquadratic multiplication and realized that this is currently an
> implementation detail that is not exposed to the users.

True.

> However I think it's a useful piece of information to have.

Alas I don't think should be done, it's highly implementation
dependent.

> I have been writing
> arbitrary-precision algorithms for various special functions and there
> is frequently a choice between algorithms that depends on the speed of
> the multiple-precision multiplication.

You'll be best off doing some measuring of the alternatives, and
making a tuned threshold for your algorithm, like the thresholds
within gmp.

You could try using some of the stuff in tune/libspeed.la.
speed_measure is the best, but it's a bit tricky.  speed_starttime and
speed_endtime are easy, and still give the benefit of the various
measuring methods we know for different systems.

> SQR_KARATSUBA_THRESHOLD and MUL_KARATSUBA_THRESHOLD (the
> former is probably always larger than the latter),

Yes, generally.  But we treat the two independently and let them fall
out from the measurments.