Irrational base discrete weighted transform

From HandWiki
Short description: Variant of fast Fourier transform

In mathematics, the irrational base discrete weighted transform (IBDWT) is a variant of the fast Fourier transform using an irrational base; it was developed by Richard Crandall (Reed College), Barry Fagin (Dartmouth College) and Joshua Doenias (NeXT Software)[1] in the early 1990s using Mathematica.[2]

The IBDWT is used in the Great Internet Mersenne Prime Search's client Prime95 to perform FFT multiplication, as well as in other programs implementing Lucas–Lehmer test, such as CUDALucas and Glucas.[3]

Algorithm

The IBDWT method, as applied to the Lucas-Lehmer test for Mersenne primes (which requires repeated squaring modulo a Mersenne number Mp=2p1), is based on four key elements developed by Crandall and Fagin:[3]

  • Balanced-radix representations: Allows digits to be signed (e.g., in the range W/2xj<W/2), which reduces error bounds.[3]
  • Variable-base digit representations: Allows each digit xj to have its own base Wj.[3]
  • Weighted cyclic convolutions: The multiplication is performed using a Discrete Weighted Transform (DWT).[3]
  • Irrational numeric bases: The base used for the transform is irrational.[3]

This approach avoids the need for zero-padding the arrays and performs the multiplication modulo Mp directly.[3] The algorithm to compute the product xy(modMp) is as follows:[3]

  1. Choose a run length (signal-length) N<p.[3]
  2. Establish a variable base representation for the numbers. For example, x=j=0N1xj2pj/N.[3] Each term is usually between 16 and 20 bits if using double-precision terms.
  3. Define a weight-signal a where each component aj=2pj/Npj/N, approximated by floats in the interval [1, 2).[3]
  4. Compute the forward DWT for both numbers: 𝒳DWT(N,a)x and 𝒴DWT(N,a)y. This is practically computed using a standard DFT (like an FFT) as DWT(N,a)xDFT(N)(ax).[3]
  5. Perform a component-wise product of the transformed arrays: 𝒵𝒳𝒴.[3]
  6. Compute the inverse DWT: zDWT(N,a)1𝒵. This is computed as z=a1DFT(N)1(𝒵).[3]
  7. Round the resulting components to the nearest integer: zround(z), optionally checking the roundoff error is no greater than 0.4 (greater indicates too many integer bits stuffed into each term).[3]
  8. Adjust the resulting digits {zn} to restore the variable-base radix representation. This step handles carries and borrows. Single-step partial carrying is sufficient.[3]

References

  • Richard Crandall, Barry Fagin: Discrete weighted transforms and large-integer arithmetic, Mathematics of Computation 62, 205, 305-324, January 1994 (PDF file)
  • Richard Crandall: Topics in Advanced Scientific Computation, TELOS/Springer-Verlag