Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PrimeNumbers] Modular Arithmetic Squaring vs. Multiplication

Expand Messages
  • Phil Carmody
    ... It depends on what you can re-use. With D standing for digits = size of input: Raw squaring is FFT + Convolution + IFFT ~= (2*log(D) + 1) * D ~= 2 Raw
    Message 1 of 2 , Jan 26, 2012
      --- On Thu, 1/26/12, paulunderwooduk <paulunderwood@...> wrote:
      > I am guilty of bandying around the term "selfridge" as a
      > measure, first given by Oliver Atkin in:
      > My question is about FFT. I remember Chris Nash saying that
      > general modular reduction in Primeform costs about 3
      > multiplications (or squarings?). What is the time ratio
      > between a FFT multiplication and a FFT squaring (before
      > reduction)?

      It depends on what you can re-use.

      With D standing for "digits" = size of input:
      Raw squaring is FFT + Convolution + IFFT ~= (2*log(D) + 1) * D ~= "2"
      Raw multiply is 2*FFT + Convolution + IFFT ~= (3*log(D) + 1) * D ~= "3"
      So the simple answer is 3/2.

      However, a lot of the time when you're doing multiplies, you're multiplying by the same value, and therefore the FFT of it can be cached.
      So multiply also costs 2. Your memory footprint is still a little larger, but that's a "cost of memory access" effect which you've not even started to introduce, so there's no point introducing it now. (In the real world, cost of memory access is not O(1), it's O(f(D)) for some f(D) in omega(1).)

      Phil
    Your message has been successfully submitted and would be delivered to recipients shortly.