a question
Timothee Ewart
Timothee.Ewart at unige.ch
Wed Feb 20 23:11:40 CET 2013
thank you very much both of you.
Le 20 févr. 2013 à 18:42, Torbjorn Granlund <tg at gmplib.org> a écrit :
> Your message is a bit vague, but I'll try to rely as well as I can.
>
> So, you're using twos complement bignums. Is the n you mention fixed?
Yes I am using only twos complement method. And I can give you more infos of what I did.
As C++ dev, I am working for physicists who have with fixed size (128 -512 bits) pb.
I designed integer class which is instantiated by the "user" (multiple of 64 bit word), with meta programming I let the compiler
generate specific ASM solver to every operations. (one more time, my pbs are fixed size, I start to work in 256 bit I finish at 256 bit).
For the multiplication, I integrated 3 different one, integer<n bits> *= long, integer <n bits> *= integer <n bits>, and a free function multiply which return integer <2 * nbits>
The sign was really a pb for the last one ... but presently the performance are very good.
> If not, how come you're interested in just n x n -> 2n multiply, it
> seems you would need n x m -> mn multiply.
> If n is just a word, there are some tricks of converting between signed
> n x n -> 2n and unsigned dito. See GMP's longlong.h, somewhere not to
> far from the end.
Great I will have a look
>
> If n is arbitrary, I think it might be best to multiply the absolute
> values.
well what I do more and less presently
> --
> Torbjörn
Best,
Tim
More information about the gmp-discuss
mailing list