Loading [MathJax]/jax/output/HTML-CSS/jax.js

Sunday, 24 June 2012

Baby/giant step strategy

I wrote in my previous post that Cantor and Zassenhaus' algorithm of polynomial factorisation over finite fields can be divided into three stages:
  • squarefree factorisation
  • distinct-degree factorisation
  • equal-degree factorisation
(in the standard Cantor-Zassenhaus algorithm the squarefree factorisation step is merged with the algorithm itself)

According to Modern Computer Algebra, "the second stage consumes the bulk of the computing time". In 1998 Erich Kaltofen and Victor Shoup designed a new approach to distinct-degree factorisation which allows to decrease it's cost. This strategy is called "baby/giant step" and exploits the fact from number theory:

Lemma. For nonnegative integers i and j, the polynomial xqixqjFq[x] is divisible by precisely those irreducible polynomials in Fq[x] whose degree divides ij.
The proof is easy: if ij then  xqixqj=(xqijx)qj. From the Theorem from the previous post we know that the factorisation of xqkx consists of all irreducible factors whose degree is a divisor of k

Now it's possible to formulate the algorithm:

Fast distinct-degree factorisation (DDF)

Input and output
This algorithm takes as input a square-free polynomial fFq[x] of degree n
The output is f[1],...,f[n]Fq[x] such that for 1dn, f[d] is the product of the monic irreducible factors of f of degree d. The algorithm is parameterized by a constant β, with 0β1.

Step 1 (compute baby steps)
Let l=nβ . For 0il, compute hi=xqimodf.
Step 2 (compute giant steps) 
Let m=n2l . For 1jm, compute Hj=xqljmodf
Step 3 (compute interval polynomials) 
For 1jm, compute Ij=0il(Hjhi)modf .
(by Lemma the polynomial Ij is divisible by those irreducible factors of f whose degree divides an integer k with  (j1)l<kjl)
Step 4 (compute coarse DDF) 
In this step, we compute polynomials F1,...,Fm where Fj=f[(j1)l+1]f[(j1)l+2]...f[jl] This is done as follows.
sf;
for j1 to m do
{Fjgcd(s,Ij);ssFj}
Step 5 (compute fine DDF) 
In this step, we compute the output polynomials f[1],...,f[n]
First, initialize f[1],...,f[n] to 1. Then do the following.
for j1 to m do
{
gFj;
for il1 down to 0 do
    {f[lji]gcd(g,Hjhi);ggf[lji]}
}
if s1 then f[deg(s)]s

Some technical remarks
1.  Lemma. For any positive integer r if we are given h=xqrmodfFq[x], then for any gFq[x], we can compute  gqrmodf as g(h)modf.

Now to perform Step 2 we set H1=hl and then compute each Hj as Hj1(H1)modf.

2. Computing f(g)modh is a so-called "modular composition" problem. For solving this problem one can use e.g. Horner scheme or Brent and Kung's algorithm (this also requires fast matrix multiplication).

By now I implemented the simplest version of the fast CZ algorithm: it uses Horner scheme in Step 2.
The next step might be to implement matrix multiplication and Brent and Kung's algorithm.

No comments:

Post a Comment