Torbjorn Granlund tg at
Thu Mar 4 00:09:08 CET 2004

Karl Hasselström came up with a clever idea of how to make use of
mpn_addmul_(k), k > 2, in mpn_sqr_basecase.  His idea is to include
the up[i]*up[i] limbs products in the product-sums that are to be
multiplied by 2, and then subtract (instead of add) the
mpn_sqr_diagonal stuff.

My idea was to add new entrypoints to mpn_addmul_(k) with special
feed-in code to accomodate mpn_sqr_basecase's special need.  Such
entrypoints would suppress initial self-multiplies (i.e. up[i]*up[i]).

My idea will give the best speed, but also takes a non-trivial
implementation effort.  Karl's proposal allows us to use a structure
of mpn_sqr_basecase very similar to the current mpn_mul_basecase.

I am therefore implementing Karl's idea.


More information about the gmp-devel mailing list