SlideShare a Scribd company logo
1 of 33
Download to read offline
Faster Polynomial Multiplication via
    Discrete Fourier Transforms

                   Alexey Pospelov

    Computer Science Department, Saarland University

Cluster of Excellence Multimodal Computing and Interaction




                   June 14th, 2011
Polynomial multiplication
   Given

    a(x) = a0 + a1 x + · · · + an x n , b(x) = b0 + b1 x + · · · + bn x n ,

   Compute

              c(x) = c0 + c1 x + · · · + c2n x 2n = a(x)b(x).
Polynomial multiplication
   Given

     a(x) = a0 + a1 x + · · · + an x n , b(x) = b0 + b1 x + · · · + bn x n ,

   Compute

               c(x) = c0 + c1 x + · · · + c2n x 2n = a(x)b(x).




   For all 0 ≤ i ≤ 2n, compute

               a0 bi + a1 bi−1 + · · · + ai b0 ,           0 ≤ i ≤ n,
       ci =
               ai−n bn + ai−n+1 bn−1 + · · · + an bi−n ,   n < i ≤ 2n.
In what model?



      Arithmetic circuits with binary “+”, “−”, “·”
      Each binary gate has unit cost
      No divisions
      Constants from the field available at no cost
      Inputs are the coefficients of the polynomials to be multiplied
      Outputs are the coefficients of the product polynomial
      Interested in a circuit for degree n polynomial multiplication
      of the minimal size
History and state of the art


   School method: O(n2 )
   Karatsuba 1960: O(nlog2 3 ) = O(n1.585 )
                        √
   Toom 1963: n1+O(1/ log n) = O(n1+ ), for any fixed   >0
                  Over infinite fields
History and state of the art


   School method: O(n2 )
   Karatsuba 1960: O(nlog2 3 ) = O(n1.585 )
                        √
   Toom 1963: n1+O(1/ log n) = O(n1+ ), for any fixed    >0
                  Over infinite fields
   Sch¨nhage-Strassen 1971: O(n log n log log n)
      o
                    Didn’t work for fields of char = 2
History and state of the art


   School method: O(n2 )
   Karatsuba 1960: O(nlog2 3 ) = O(n1.585 )
                        √
   Toom 1963: n1+O(1/ log n) = O(n1+ ), for any fixed     >0
                  Over infinite fields
   Sch¨nhage-Strassen 1971: O(n log n log log n)
      o
                    Didn’t work for fields of char = 2
   Sch¨nhage 1977: O(n log n log log n), over field of char = 2
      o
   Kaminski 1988, Cantor-Kaltofen 1991: O(n log n log log n), over
               arbitrary algebras
   Over C or R: O(n log n)
   All general lower bounds: Ω(n).
Multiplication in O(n log n)


   Given

                  a(x) = a0 + a1 x + · · · + an−1 x n−1 ,
                  b(x) = b0 + b1 x + · · · + bn−1 x n−1 ,

   Compute

     c(x) = c0 + c1 x + · · · + xn−1 x n−1 = a(x)b(x) (mod x n − 1).

   (Can always choose a larger n and pad polynomials with zeroes to
   reduce the ordinary polynomial multiplication to the product in
   k[x]/(x n − 1).)
Multiplication in O(n log n)

          a0   a1           . . . an−1                                         b0           b1       . . . bn−1

                    8          x                                                            8       x
               DFTω
                  n                                                                         DFTω
                                                                                               n

                                                                                      
                                  . . . ˜n−1
                                          a                               ˜ ˜
                                                                          b0 b1 . . .   
               ˜0 ˜1
               a a                                                                    ˜n−1
                                                                                      b
                                       5 {          5 {                        5 {
                                        ·           ·                          ·
                                                                                  
                                       c0
                                       ˜            c1 . . . cn−1
                                                    ˜        ˜
           ω ∈ k is
                                                             8       x
            an nth                                  IDFTω
                                                        n
           primitive
           root of 1                                                           
                                                         
                                       c0           c1               . . . cn−1
Discrete Fourier transform
Discrete Fourier transform
       Maps a degree n − 1 polynomial to its values at n distinct nth
       roots of unity:
                                   n−1
                 ˜i := a(ω i ) =
                 a                       aj ω ij ,   0≤i ≤n−1
                                   j=0

             DFTω : (a0 , a1 , . . . , an−1 ) → (˜0 , ˜1 , . . . , ˜n−1 )
                n                                a a               a

       (ω is a primitive nth root of unity)
       Linear transform: DFTω : k[x] → k n
                               n
       Isomorphism: DFTω : k[x]/(x n − 1) → k n
                           n
       Can be often computed in O(n log n)
       The inverse isomorphism is almost a DFT again:
           1      n−1
             DFTω
                n     : (˜0 , ˜1 , . . . , ˜n−1 ) → (a0 , a1 , . . . , an−1 )
                         a a               a
           n
Discrete Fourier transform

         a0   a1           . . . an−1                                         b0           b1       . . . bn−1

                   8          x                                                            8       x
               DFTω
                  n                                                                        DFTω
                                                                                              n

                                                                                     
                                 . . . ˜n−1
                                         a                               ˜ ˜
                                                                         b0 b1 . . .   
              ˜0 ˜1
              a a                                                                    ˜n−1
                                                                                     b
                                      5 {          5 {                        5 {
                                       ·           ·                          ·
                                                                                 
                                      c0
                                      ˜            c1 . . . cn−1
                                                   ˜        ˜
           ω ∈ k is
                                                            8       x
            an nth                                 IDFTω
                                                       n
           primitive
           root of 1                                                          
                                                        
                                      c0           c1               . . . cn−1
Discrete Fourier transform
       Lk (n): the complexity of degree n polynomial multiplication
       over a field k
       Dk (n): the complexity of computing length n DFT over k
                  Lk (n) ≤ 3Dk (n) + 2n = O(n log n).
   Note: we need roots of unity.
What if roots of unity are not available?
What if roots of unity are not available?


   Attach them!
What if roots of unity are not available?


   Attach them!
       Switch from the field k to its algebraic extension Am where
       roots of unity of sufficiently large order exist.
What if roots of unity are not available?


   Attach them!
       Switch from the field k to its algebraic extension Am where
       roots of unity of sufficiently large order exist.
       More precisely: take a (ring) extension Am of k of degree m
       over k with a 2 th root of unity ω ∈ Am :
           For example,
                                 Am = k[x]/pm (x),
           pm (x) ∈ k[x] is a polynomial of degree m,
           pm (x) vanishes on ω2 ,
           (ω2 is a primitive 2 th root of unity in the algebraic closure of
           the field k.)
What if roots of unity are not available?


   Attach them!
       Switch from the field k to its algebraic extension Am where
       roots of unity of sufficiently large order exist.
       More precisely: take a (ring) extension Am of k of degree m
       over k with a 2 th root of unity ω ∈ Am :
            For example,
                                  Am = k[x]/pm (x),
            pm (x) ∈ k[x] is a polynomial of degree m,
            pm (x) vanishes on ω2 ,
            (ω2 is a primitive 2 th root of unity in the algebraic closure of
            the field k.)
   How can it help?
What if roots of unity are not available?


   Attach them!
       Switch from the field k to its algebraic extension Am where
       roots of unity of sufficiently large order exist.
       More precisely: take a (ring) extension Am of k of degree m
       over k with a 2 th root of unity ω ∈ Am :
            For example,
                                  Am = k[x]/pm (x),
            pm (x) ∈ k[x] is a polynomial of degree m,
            pm (x) vanishes on ω2 ,
            (ω2 is a primitive 2 th root of unity in the algebraic closure of
            the field k.)
   How can it help? See next slide.
Fast polynomial multiplication

            a0 . . . a m −1 . . . an−1
                       2                                               b0 . . . b m −1 . . . bn−1
                                                                                  2
               %   }                              %                        %               }                       % 
             → Am          ...           → Am                              → Am                          ...       → Am

              A0       7         y                  A2   −1                B0                        7         y      B2   −1

                       DFTω
                          2                                                                         DFTω
                                                                                                       2
                                                  ˜
                                                  A2    −1                 ˜
                                                                           B0

                           ˜
                           A0            5          y                           7               { B2
                                                                                                  ˜
                                             ·                   ...                    ·                 −1



         2 ·m =n                         ˜
                                         C0                  7         y                    ˜
                                                                                            C2      −1
      Am = k[x]/pm (x)                                   IDFTω
                                                             2
                                                  C0                       C2           −1
           ω ∈ Am
          is a 2 th                                                                    
          primitive                  ← Am                        ...       ← Am
          root of 1                  Õ                   3                          Ù           
                                 c0 . . . cm−1 . . .                                        cn−1
Fast polynomial multiplication
   In this case

     Lk (n) ≤ 2 Lk (m)
              + 3DAm (n) · complexity of aritrhmetics in Am
                      + cost of embedding and unembedding in Am

   Our contribution #1:
        Formalize this kind of algorithms
        The relation between m and 2 is a barrier for the algorithm’s
        performance
        This relation depends heavily on the field properties
        The cost of the DFT can usually be made O(n log n)
        Embedding and unembedding run usually in linear time, e.g.,
        if pm (x) is sparse
Does it work?



   Yes!!!
   Sch¨nhage-Strassen 1971:
      o                       =m
   Sch¨nhage 1977: 3 = 2m (+ a little trick)
      o
   Kaminski 1988:   = φ(m) (Euler’s totient function)
   Cantor-Kaltofen 1991: = m (and Am is a little more complicated
                than k[x]/pm (x))
Slow fields
Slow fields
   Recall:

     Lk (n) ≤ 2 Lk (m)
              + 3DAm (n) · complexity of arithmetics in Am
                     + cost of embedding and unembedding in Am

   Ideally we want m to be small and   to be large.
Slow fields
   Recall:

     Lk (n) ≤ 2 Lk (m)
               + 3DAm (n) · complexity of arithmetics in Am
                      + cost of embedding and unembedding in Am

   Ideally we want m to be small and      to be large.
   Definition
   For a field k, and n, s.t. char k n, let fk (n) be [k(ωn ) : k], the
   degree function of k.
Slow fields
   Recall:

     Lk (n) ≤ 2 Lk (m)
               + 3DAm (n) · complexity of arithmetics in Am
                      + cost of embedding and unembedding in Am

   Ideally we want m to be small and      to be large.
   Definition
   For a field k, and n, s.t. char k n, let fk (n) be [k(ωn ) : k], the
   degree function of k.
   Our contribution #2:
        If fk (n) = o(log log n) for some not too sparse set of n then k
        is fast and Lk (n) = o(n log n log log n)
        If fk (n) = Ω(n1− ) for any fixed  0, then k is slow and any
        algorithm of that kind runs in Ω(n log n log log n)
More details

      To attach an th root of unity we need an extension of degree
      at least fk ( )
      The degree of the polynomial is then ∼ · fk ( )
                                                     √
      For the least solution i0 of i · fk (i) ≥ n, fk (n) := fk (i0 )
      The number√of recursive steps is at least the number of
        √   √
      fk (fk (· · · fk (n) · · · )), until the value becomes O(1)
                                                       √
      This superposition depth will be denoted (fk )∗ (n)
      The cost of all steps on a single recursion level is determined
      by the complexity of the DFTs, and is Θ(n log n)
More details

      To attach an th root of unity we need an extension of degree
      at least fk ( )
      The degree of the polynomial is then ∼ · fk ( )
                                                     √
      For the least solution i0 of i · fk (i) ≥ n, fk (n) := fk (i0 )
      The number√of recursive steps is at least the number of
        √   √
      fk (fk (· · · fk (n) · · · )), until the value becomes O(1)
                                                       √
      This superposition depth will be denoted (fk )∗ (n)
      The cost of all steps on a single recursion level is determined
      by the complexity of the DFTs, and is Θ(n log n)
      The total cost is estimated as
                                             √
                             Ω(n log n) · (fk )∗ (n)
“Lower bound”


  For the rational field Q, for all n
                                                n
                      fQ (n) = φ(n) ≥ c ·             ,
                                            log log n
  and                     √
                        (fQ )∗ (n) = Ω(log log n).
“Lower bound”


  For the rational field Q, for all n
                                                n
                      fQ (n) = φ(n) ≥ c ·             ,
                                            log log n
  and                     √
                        (fQ )∗ (n) = Ω(log log n).
  Complexity of any DFT-based multiplication algorithm is then

                           Ω(n log n log log n).

  It follows that over Q we need another kind of an algorithm.
Summary
     Uniform treatment of all known asymptotically fastest
     polynomial multiplication algorithms w.r.t. the total
     complexity
     A way to improve the total complexity upper bounds over
     certain fields
     Impossibility to improve Sch¨nhage-Strassen over any fields
                                   o
     (and rings or algebras) of characteristic 0
     In particular, no light at the end of the tunnel for polynomial
     multiplication over Q
Summary
     Uniform treatment of all known asymptotically fastest
     polynomial multiplication algorithms w.r.t. the total
     complexity
     A way to improve the total complexity upper bounds over
     certain fields
     Impossibility to improve Sch¨nhage-Strassen over any fields
                                   o
     (and rings or algebras) of characteristic 0
     In particular, no light at the end of the tunnel for polynomial
     multiplication over Q
     Over fields of positive characteristic,
Thank you for attention!

More Related Content

What's hot

Mhf4 U Trig
Mhf4 U TrigMhf4 U Trig
Mhf4 U Trigmaxchem
 
Computer Science and Information Science 3rd semester (2012-December) Questio...
Computer Science and Information Science 3rd semester (2012-December) Questio...Computer Science and Information Science 3rd semester (2012-December) Questio...
Computer Science and Information Science 3rd semester (2012-December) Questio...B G S Institute of Technolgy
 
Camera calibration
Camera calibrationCamera calibration
Camera calibrationYuji Oyamada
 
Identity Based Encryption
Identity Based EncryptionIdentity Based Encryption
Identity Based EncryptionPratik Poddar
 
Engg. mathematics iii
Engg. mathematics iiiEngg. mathematics iii
Engg. mathematics iiimanoj302009
 
Algorithm for Multi-Path Hop-By-Hop Routing
Algorithm for Multi-Path Hop-By-Hop RoutingAlgorithm for Multi-Path Hop-By-Hop Routing
Algorithm for Multi-Path Hop-By-Hop RoutingJens Oberender
 
Form 5 formulae and note
Form 5 formulae and noteForm 5 formulae and note
Form 5 formulae and notesmktsj2
 
Lesson 14: Exponential Functions
Lesson 14: Exponential FunctionsLesson 14: Exponential Functions
Lesson 14: Exponential FunctionsMatthew Leingang
 
Lesson 14: Exponential Functions
Lesson 14: Exponential FunctionsLesson 14: Exponential Functions
Lesson 14: Exponential FunctionsMatthew Leingang
 
Lesson 24: The Definite Integral (Section 4 version)
Lesson 24: The Definite Integral (Section 4 version)Lesson 24: The Definite Integral (Section 4 version)
Lesson 24: The Definite Integral (Section 4 version)Matthew Leingang
 
CVPR2010: Advanced ITinCVPR in a Nutshell: part 7: Future Trend
CVPR2010: Advanced ITinCVPR in a Nutshell: part 7: Future TrendCVPR2010: Advanced ITinCVPR in a Nutshell: part 7: Future Trend
CVPR2010: Advanced ITinCVPR in a Nutshell: part 7: Future Trendzukun
 
Lesson 24: The Definite Integral (Section 10 version)
Lesson 24: The Definite Integral (Section 10 version)Lesson 24: The Definite Integral (Section 10 version)
Lesson 24: The Definite Integral (Section 10 version)Matthew Leingang
 
G224549
G224549G224549
G224549irjes
 

What's hot (16)

Mhf4 U Trig
Mhf4 U TrigMhf4 U Trig
Mhf4 U Trig
 
Computer Science and Information Science 3rd semester (2012-December) Questio...
Computer Science and Information Science 3rd semester (2012-December) Questio...Computer Science and Information Science 3rd semester (2012-December) Questio...
Computer Science and Information Science 3rd semester (2012-December) Questio...
 
Camera calibration
Camera calibrationCamera calibration
Camera calibration
 
Identity Based Encryption
Identity Based EncryptionIdentity Based Encryption
Identity Based Encryption
 
Engg. mathematics iii
Engg. mathematics iiiEngg. mathematics iii
Engg. mathematics iii
 
Algorithm for Multi-Path Hop-By-Hop Routing
Algorithm for Multi-Path Hop-By-Hop RoutingAlgorithm for Multi-Path Hop-By-Hop Routing
Algorithm for Multi-Path Hop-By-Hop Routing
 
Form 5 formulae and note
Form 5 formulae and noteForm 5 formulae and note
Form 5 formulae and note
 
Seismic
SeismicSeismic
Seismic
 
Lesson 14: Exponential Functions
Lesson 14: Exponential FunctionsLesson 14: Exponential Functions
Lesson 14: Exponential Functions
 
Lesson 14: Exponential Functions
Lesson 14: Exponential FunctionsLesson 14: Exponential Functions
Lesson 14: Exponential Functions
 
Lecture9
Lecture9Lecture9
Lecture9
 
Reflections worksheet1student
Reflections worksheet1studentReflections worksheet1student
Reflections worksheet1student
 
Lesson 24: The Definite Integral (Section 4 version)
Lesson 24: The Definite Integral (Section 4 version)Lesson 24: The Definite Integral (Section 4 version)
Lesson 24: The Definite Integral (Section 4 version)
 
CVPR2010: Advanced ITinCVPR in a Nutshell: part 7: Future Trend
CVPR2010: Advanced ITinCVPR in a Nutshell: part 7: Future TrendCVPR2010: Advanced ITinCVPR in a Nutshell: part 7: Future Trend
CVPR2010: Advanced ITinCVPR in a Nutshell: part 7: Future Trend
 
Lesson 24: The Definite Integral (Section 10 version)
Lesson 24: The Definite Integral (Section 10 version)Lesson 24: The Definite Integral (Section 10 version)
Lesson 24: The Definite Integral (Section 10 version)
 
G224549
G224549G224549
G224549
 

Similar to Csr2011 june14 17_00_pospelov

Dsp U Lec08 Fir Filter Design
Dsp U   Lec08 Fir Filter DesignDsp U   Lec08 Fir Filter Design
Dsp U Lec08 Fir Filter Designtaha25
 
Basics of Analogue Filters
Basics of Analogue FiltersBasics of Analogue Filters
Basics of Analogue Filtersop205
 
Mathematical physics group 16
Mathematical physics group 16Mathematical physics group 16
Mathematical physics group 16derry92
 
2 senarai rumus add maths k2 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 20102 senarai rumus add maths k2 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 2010zabidah awang
 
2 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k1 trial spm sbp 20102 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k1 trial spm sbp 2010zabidah awang
 
2 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k1 trial spm sbp 20102 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k1 trial spm sbp 2010zabidah awang
 
2 senarai rumus add maths k2 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 20102 senarai rumus add maths k2 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 2010zabidah awang
 
Formulario de matematicas
Formulario de matematicasFormulario de matematicas
Formulario de matematicasCarlos
 
Dissertation Defense: The Physics of DNA, RNA, and RNA-like polymers
Dissertation Defense: The Physics of DNA, RNA, and RNA-like polymersDissertation Defense: The Physics of DNA, RNA, and RNA-like polymers
Dissertation Defense: The Physics of DNA, RNA, and RNA-like polymersLi Tai Fang
 
Fast Fourier Transform
Fast Fourier TransformFast Fourier Transform
Fast Fourier Transformop205
 

Similar to Csr2011 june14 17_00_pospelov (20)

Dsp U Lec08 Fir Filter Design
Dsp U   Lec08 Fir Filter DesignDsp U   Lec08 Fir Filter Design
Dsp U Lec08 Fir Filter Design
 
Basics of Analogue Filters
Basics of Analogue FiltersBasics of Analogue Filters
Basics of Analogue Filters
 
Mathematical physics group 16
Mathematical physics group 16Mathematical physics group 16
Mathematical physics group 16
 
2 senarai rumus add maths k2 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 20102 senarai rumus add maths k2 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 2010
 
2 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k1 trial spm sbp 20102 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k1 trial spm sbp 2010
 
2 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k1 trial spm sbp 20102 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k1 trial spm sbp 2010
 
2 senarai rumus add maths k2 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 20102 senarai rumus add maths k2 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 2010
 
16 fft
16 fft16 fft
16 fft
 
Figures
FiguresFigures
Figures
 
Figures
FiguresFigures
Figures
 
Formulario de matematicas
Formulario de matematicasFormulario de matematicas
Formulario de matematicas
 
Cheat Sheet
Cheat SheetCheat Sheet
Cheat Sheet
 
Kinks & Defects
Kinks & DefectsKinks & Defects
Kinks & Defects
 
Fourier series
Fourier seriesFourier series
Fourier series
 
Fourier series
Fourier seriesFourier series
Fourier series
 
Lap lace
Lap laceLap lace
Lap lace
 
CRMS Calculus 2010 May 5, 2010
CRMS Calculus 2010 May 5, 2010CRMS Calculus 2010 May 5, 2010
CRMS Calculus 2010 May 5, 2010
 
Dissertation Defense: The Physics of DNA, RNA, and RNA-like polymers
Dissertation Defense: The Physics of DNA, RNA, and RNA-like polymersDissertation Defense: The Physics of DNA, RNA, and RNA-like polymers
Dissertation Defense: The Physics of DNA, RNA, and RNA-like polymers
 
Chapter 2 (maths 3)
Chapter 2 (maths 3)Chapter 2 (maths 3)
Chapter 2 (maths 3)
 
Fast Fourier Transform
Fast Fourier TransformFast Fourier Transform
Fast Fourier Transform
 

More from CSR2011

Csr2011 june14 09_30_grigoriev
Csr2011 june14 09_30_grigorievCsr2011 june14 09_30_grigoriev
Csr2011 june14 09_30_grigorievCSR2011
 
Csr2011 june18 15_15_bomhoff
Csr2011 june18 15_15_bomhoffCsr2011 june18 15_15_bomhoff
Csr2011 june18 15_15_bomhoffCSR2011
 
Csr2011 june18 15_15_bomhoff
Csr2011 june18 15_15_bomhoffCsr2011 june18 15_15_bomhoff
Csr2011 june18 15_15_bomhoffCSR2011
 
Csr2011 june18 14_00_sudan
Csr2011 june18 14_00_sudanCsr2011 june18 14_00_sudan
Csr2011 june18 14_00_sudanCSR2011
 
Csr2011 june18 15_45_avron
Csr2011 june18 15_45_avronCsr2011 june18 15_45_avron
Csr2011 june18 15_45_avronCSR2011
 
Csr2011 june18 09_30_shpilka
Csr2011 june18 09_30_shpilkaCsr2011 june18 09_30_shpilka
Csr2011 june18 09_30_shpilkaCSR2011
 
Csr2011 june18 12_00_nguyen
Csr2011 june18 12_00_nguyenCsr2011 june18 12_00_nguyen
Csr2011 june18 12_00_nguyenCSR2011
 
Csr2011 june18 11_00_tiskin
Csr2011 june18 11_00_tiskinCsr2011 june18 11_00_tiskin
Csr2011 june18 11_00_tiskinCSR2011
 
Csr2011 june18 11_30_remila
Csr2011 june18 11_30_remilaCsr2011 june18 11_30_remila
Csr2011 june18 11_30_remilaCSR2011
 
Csr2011 june17 17_00_likhomanov
Csr2011 june17 17_00_likhomanovCsr2011 june17 17_00_likhomanov
Csr2011 june17 17_00_likhomanovCSR2011
 
Csr2011 june17 16_30_blin
Csr2011 june17 16_30_blinCsr2011 june17 16_30_blin
Csr2011 june17 16_30_blinCSR2011
 
Csr2011 june17 09_30_yekhanin
Csr2011 june17 09_30_yekhaninCsr2011 june17 09_30_yekhanin
Csr2011 june17 09_30_yekhaninCSR2011
 
Csr2011 june17 09_30_yekhanin
Csr2011 june17 09_30_yekhaninCsr2011 june17 09_30_yekhanin
Csr2011 june17 09_30_yekhaninCSR2011
 
Csr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCsr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCSR2011
 
Csr2011 june17 11_30_vyalyi
Csr2011 june17 11_30_vyalyiCsr2011 june17 11_30_vyalyi
Csr2011 june17 11_30_vyalyiCSR2011
 
Csr2011 june17 11_00_lonati
Csr2011 june17 11_00_lonatiCsr2011 june17 11_00_lonati
Csr2011 june17 11_00_lonatiCSR2011
 
Csr2011 june17 14_00_bulatov
Csr2011 june17 14_00_bulatovCsr2011 june17 14_00_bulatov
Csr2011 june17 14_00_bulatovCSR2011
 
Csr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCsr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCSR2011
 
Csr2011 june17 14_00_bulatov
Csr2011 june17 14_00_bulatovCsr2011 june17 14_00_bulatov
Csr2011 june17 14_00_bulatovCSR2011
 
Csr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCsr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCSR2011
 

More from CSR2011 (20)

Csr2011 june14 09_30_grigoriev
Csr2011 june14 09_30_grigorievCsr2011 june14 09_30_grigoriev
Csr2011 june14 09_30_grigoriev
 
Csr2011 june18 15_15_bomhoff
Csr2011 june18 15_15_bomhoffCsr2011 june18 15_15_bomhoff
Csr2011 june18 15_15_bomhoff
 
Csr2011 june18 15_15_bomhoff
Csr2011 june18 15_15_bomhoffCsr2011 june18 15_15_bomhoff
Csr2011 june18 15_15_bomhoff
 
Csr2011 june18 14_00_sudan
Csr2011 june18 14_00_sudanCsr2011 june18 14_00_sudan
Csr2011 june18 14_00_sudan
 
Csr2011 june18 15_45_avron
Csr2011 june18 15_45_avronCsr2011 june18 15_45_avron
Csr2011 june18 15_45_avron
 
Csr2011 june18 09_30_shpilka
Csr2011 june18 09_30_shpilkaCsr2011 june18 09_30_shpilka
Csr2011 june18 09_30_shpilka
 
Csr2011 june18 12_00_nguyen
Csr2011 june18 12_00_nguyenCsr2011 june18 12_00_nguyen
Csr2011 june18 12_00_nguyen
 
Csr2011 june18 11_00_tiskin
Csr2011 june18 11_00_tiskinCsr2011 june18 11_00_tiskin
Csr2011 june18 11_00_tiskin
 
Csr2011 june18 11_30_remila
Csr2011 june18 11_30_remilaCsr2011 june18 11_30_remila
Csr2011 june18 11_30_remila
 
Csr2011 june17 17_00_likhomanov
Csr2011 june17 17_00_likhomanovCsr2011 june17 17_00_likhomanov
Csr2011 june17 17_00_likhomanov
 
Csr2011 june17 16_30_blin
Csr2011 june17 16_30_blinCsr2011 june17 16_30_blin
Csr2011 june17 16_30_blin
 
Csr2011 june17 09_30_yekhanin
Csr2011 june17 09_30_yekhaninCsr2011 june17 09_30_yekhanin
Csr2011 june17 09_30_yekhanin
 
Csr2011 june17 09_30_yekhanin
Csr2011 june17 09_30_yekhaninCsr2011 june17 09_30_yekhanin
Csr2011 june17 09_30_yekhanin
 
Csr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCsr2011 june17 12_00_morin
Csr2011 june17 12_00_morin
 
Csr2011 june17 11_30_vyalyi
Csr2011 june17 11_30_vyalyiCsr2011 june17 11_30_vyalyi
Csr2011 june17 11_30_vyalyi
 
Csr2011 june17 11_00_lonati
Csr2011 june17 11_00_lonatiCsr2011 june17 11_00_lonati
Csr2011 june17 11_00_lonati
 
Csr2011 june17 14_00_bulatov
Csr2011 june17 14_00_bulatovCsr2011 june17 14_00_bulatov
Csr2011 june17 14_00_bulatov
 
Csr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCsr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminski
 
Csr2011 june17 14_00_bulatov
Csr2011 june17 14_00_bulatovCsr2011 june17 14_00_bulatov
Csr2011 june17 14_00_bulatov
 
Csr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCsr2011 june17 12_00_morin
Csr2011 june17 12_00_morin
 

Csr2011 june14 17_00_pospelov

  • 1. Faster Polynomial Multiplication via Discrete Fourier Transforms Alexey Pospelov Computer Science Department, Saarland University Cluster of Excellence Multimodal Computing and Interaction June 14th, 2011
  • 2. Polynomial multiplication Given a(x) = a0 + a1 x + · · · + an x n , b(x) = b0 + b1 x + · · · + bn x n , Compute c(x) = c0 + c1 x + · · · + c2n x 2n = a(x)b(x).
  • 3. Polynomial multiplication Given a(x) = a0 + a1 x + · · · + an x n , b(x) = b0 + b1 x + · · · + bn x n , Compute c(x) = c0 + c1 x + · · · + c2n x 2n = a(x)b(x). For all 0 ≤ i ≤ 2n, compute a0 bi + a1 bi−1 + · · · + ai b0 , 0 ≤ i ≤ n, ci = ai−n bn + ai−n+1 bn−1 + · · · + an bi−n , n < i ≤ 2n.
  • 4. In what model? Arithmetic circuits with binary “+”, “−”, “·” Each binary gate has unit cost No divisions Constants from the field available at no cost Inputs are the coefficients of the polynomials to be multiplied Outputs are the coefficients of the product polynomial Interested in a circuit for degree n polynomial multiplication of the minimal size
  • 5. History and state of the art School method: O(n2 ) Karatsuba 1960: O(nlog2 3 ) = O(n1.585 ) √ Toom 1963: n1+O(1/ log n) = O(n1+ ), for any fixed >0 Over infinite fields
  • 6. History and state of the art School method: O(n2 ) Karatsuba 1960: O(nlog2 3 ) = O(n1.585 ) √ Toom 1963: n1+O(1/ log n) = O(n1+ ), for any fixed >0 Over infinite fields Sch¨nhage-Strassen 1971: O(n log n log log n) o Didn’t work for fields of char = 2
  • 7. History and state of the art School method: O(n2 ) Karatsuba 1960: O(nlog2 3 ) = O(n1.585 ) √ Toom 1963: n1+O(1/ log n) = O(n1+ ), for any fixed >0 Over infinite fields Sch¨nhage-Strassen 1971: O(n log n log log n) o Didn’t work for fields of char = 2 Sch¨nhage 1977: O(n log n log log n), over field of char = 2 o Kaminski 1988, Cantor-Kaltofen 1991: O(n log n log log n), over arbitrary algebras Over C or R: O(n log n) All general lower bounds: Ω(n).
  • 8. Multiplication in O(n log n) Given a(x) = a0 + a1 x + · · · + an−1 x n−1 , b(x) = b0 + b1 x + · · · + bn−1 x n−1 , Compute c(x) = c0 + c1 x + · · · + xn−1 x n−1 = a(x)b(x) (mod x n − 1). (Can always choose a larger n and pad polynomials with zeroes to reduce the ordinary polynomial multiplication to the product in k[x]/(x n − 1).)
  • 9. Multiplication in O(n log n) a0 a1 . . . an−1 b0 b1 . . . bn−1 8 x 8 x DFTω n DFTω n . . . ˜n−1 a ˜ ˜ b0 b1 . . . ˜0 ˜1 a a ˜n−1 b 5 { 5 { 5 { · · · c0 ˜ c1 . . . cn−1 ˜ ˜ ω ∈ k is 8 x an nth IDFTω n primitive root of 1 c0 c1 . . . cn−1
  • 11. Discrete Fourier transform Maps a degree n − 1 polynomial to its values at n distinct nth roots of unity: n−1 ˜i := a(ω i ) = a aj ω ij , 0≤i ≤n−1 j=0 DFTω : (a0 , a1 , . . . , an−1 ) → (˜0 , ˜1 , . . . , ˜n−1 ) n a a a (ω is a primitive nth root of unity) Linear transform: DFTω : k[x] → k n n Isomorphism: DFTω : k[x]/(x n − 1) → k n n Can be often computed in O(n log n) The inverse isomorphism is almost a DFT again: 1 n−1 DFTω n : (˜0 , ˜1 , . . . , ˜n−1 ) → (a0 , a1 , . . . , an−1 ) a a a n
  • 12. Discrete Fourier transform a0 a1 . . . an−1 b0 b1 . . . bn−1 8 x 8 x DFTω n DFTω n . . . ˜n−1 a ˜ ˜ b0 b1 . . . ˜0 ˜1 a a ˜n−1 b 5 { 5 { 5 { · · · c0 ˜ c1 . . . cn−1 ˜ ˜ ω ∈ k is 8 x an nth IDFTω n primitive root of 1 c0 c1 . . . cn−1
  • 13. Discrete Fourier transform Lk (n): the complexity of degree n polynomial multiplication over a field k Dk (n): the complexity of computing length n DFT over k Lk (n) ≤ 3Dk (n) + 2n = O(n log n). Note: we need roots of unity.
  • 14. What if roots of unity are not available?
  • 15. What if roots of unity are not available? Attach them!
  • 16. What if roots of unity are not available? Attach them! Switch from the field k to its algebraic extension Am where roots of unity of sufficiently large order exist.
  • 17. What if roots of unity are not available? Attach them! Switch from the field k to its algebraic extension Am where roots of unity of sufficiently large order exist. More precisely: take a (ring) extension Am of k of degree m over k with a 2 th root of unity ω ∈ Am : For example, Am = k[x]/pm (x), pm (x) ∈ k[x] is a polynomial of degree m, pm (x) vanishes on ω2 , (ω2 is a primitive 2 th root of unity in the algebraic closure of the field k.)
  • 18. What if roots of unity are not available? Attach them! Switch from the field k to its algebraic extension Am where roots of unity of sufficiently large order exist. More precisely: take a (ring) extension Am of k of degree m over k with a 2 th root of unity ω ∈ Am : For example, Am = k[x]/pm (x), pm (x) ∈ k[x] is a polynomial of degree m, pm (x) vanishes on ω2 , (ω2 is a primitive 2 th root of unity in the algebraic closure of the field k.) How can it help?
  • 19. What if roots of unity are not available? Attach them! Switch from the field k to its algebraic extension Am where roots of unity of sufficiently large order exist. More precisely: take a (ring) extension Am of k of degree m over k with a 2 th root of unity ω ∈ Am : For example, Am = k[x]/pm (x), pm (x) ∈ k[x] is a polynomial of degree m, pm (x) vanishes on ω2 , (ω2 is a primitive 2 th root of unity in the algebraic closure of the field k.) How can it help? See next slide.
  • 20. Fast polynomial multiplication a0 . . . a m −1 . . . an−1 2 b0 . . . b m −1 . . . bn−1 2 % } % % } % → Am ... → Am → Am ... → Am A0 7 y A2 −1 B0 7 y B2 −1 DFTω 2 DFTω 2 ˜ A2 −1 ˜ B0 ˜ A0 5 y 7 { B2 ˜ · ... · −1 2 ·m =n ˜ C0 7 y ˜ C2 −1 Am = k[x]/pm (x) IDFTω 2 C0 C2 −1 ω ∈ Am is a 2 th primitive ← Am ... ← Am root of 1 Õ 3 Ù c0 . . . cm−1 . . . cn−1
  • 21. Fast polynomial multiplication In this case Lk (n) ≤ 2 Lk (m) + 3DAm (n) · complexity of aritrhmetics in Am + cost of embedding and unembedding in Am Our contribution #1: Formalize this kind of algorithms The relation between m and 2 is a barrier for the algorithm’s performance This relation depends heavily on the field properties The cost of the DFT can usually be made O(n log n) Embedding and unembedding run usually in linear time, e.g., if pm (x) is sparse
  • 22. Does it work? Yes!!! Sch¨nhage-Strassen 1971: o =m Sch¨nhage 1977: 3 = 2m (+ a little trick) o Kaminski 1988: = φ(m) (Euler’s totient function) Cantor-Kaltofen 1991: = m (and Am is a little more complicated than k[x]/pm (x))
  • 24. Slow fields Recall: Lk (n) ≤ 2 Lk (m) + 3DAm (n) · complexity of arithmetics in Am + cost of embedding and unembedding in Am Ideally we want m to be small and to be large.
  • 25. Slow fields Recall: Lk (n) ≤ 2 Lk (m) + 3DAm (n) · complexity of arithmetics in Am + cost of embedding and unembedding in Am Ideally we want m to be small and to be large. Definition For a field k, and n, s.t. char k n, let fk (n) be [k(ωn ) : k], the degree function of k.
  • 26. Slow fields Recall: Lk (n) ≤ 2 Lk (m) + 3DAm (n) · complexity of arithmetics in Am + cost of embedding and unembedding in Am Ideally we want m to be small and to be large. Definition For a field k, and n, s.t. char k n, let fk (n) be [k(ωn ) : k], the degree function of k. Our contribution #2: If fk (n) = o(log log n) for some not too sparse set of n then k is fast and Lk (n) = o(n log n log log n) If fk (n) = Ω(n1− ) for any fixed 0, then k is slow and any algorithm of that kind runs in Ω(n log n log log n)
  • 27. More details To attach an th root of unity we need an extension of degree at least fk ( ) The degree of the polynomial is then ∼ · fk ( ) √ For the least solution i0 of i · fk (i) ≥ n, fk (n) := fk (i0 ) The number√of recursive steps is at least the number of √ √ fk (fk (· · · fk (n) · · · )), until the value becomes O(1) √ This superposition depth will be denoted (fk )∗ (n) The cost of all steps on a single recursion level is determined by the complexity of the DFTs, and is Θ(n log n)
  • 28. More details To attach an th root of unity we need an extension of degree at least fk ( ) The degree of the polynomial is then ∼ · fk ( ) √ For the least solution i0 of i · fk (i) ≥ n, fk (n) := fk (i0 ) The number√of recursive steps is at least the number of √ √ fk (fk (· · · fk (n) · · · )), until the value becomes O(1) √ This superposition depth will be denoted (fk )∗ (n) The cost of all steps on a single recursion level is determined by the complexity of the DFTs, and is Θ(n log n) The total cost is estimated as √ Ω(n log n) · (fk )∗ (n)
  • 29. “Lower bound” For the rational field Q, for all n n fQ (n) = φ(n) ≥ c · , log log n and √ (fQ )∗ (n) = Ω(log log n).
  • 30. “Lower bound” For the rational field Q, for all n n fQ (n) = φ(n) ≥ c · , log log n and √ (fQ )∗ (n) = Ω(log log n). Complexity of any DFT-based multiplication algorithm is then Ω(n log n log log n). It follows that over Q we need another kind of an algorithm.
  • 31. Summary Uniform treatment of all known asymptotically fastest polynomial multiplication algorithms w.r.t. the total complexity A way to improve the total complexity upper bounds over certain fields Impossibility to improve Sch¨nhage-Strassen over any fields o (and rings or algebras) of characteristic 0 In particular, no light at the end of the tunnel for polynomial multiplication over Q
  • 32. Summary Uniform treatment of all known asymptotically fastest polynomial multiplication algorithms w.r.t. the total complexity A way to improve the total complexity upper bounds over certain fields Impossibility to improve Sch¨nhage-Strassen over any fields o (and rings or algebras) of characteristic 0 In particular, no light at the end of the tunnel for polynomial multiplication over Q Over fields of positive characteristic,
  • 33. Thank you for attention!