SlideShare una empresa de Scribd logo
1 de 14
Multiplying Polynomials Fast

 Why do we need Complex
       Numbers?
The Problem


• (an xn + an-1 xn-1+…..+ a0 x0) * (bn xn + bn-1 xn-1+…..+ b0 x0)

• O(n^2) time
  – (Σi=0..k ai * bk-i) is coefficient of xk

• Can one do better?
Applications

• Where all does a pattern string P appear in a text string
  T?

   – P 0’s, 1’s and don’t cares.

   – T 0’s and 1’s


• Easy in O(|P|*|T|) time

   – Can one do better?
Conversion to Polynomial
                    Multiplication
•   Treat P and T as polynomials

     – T=0101       1 x0 + 0 x1 + 1 x2 + 0 x3
                                                                  tk-i       tk-2 tk-1 tk
     – P=01D1       0 x0 + 1 x1 + 0 x2 + 1 x3
                                                      1   0   1   0      1   1    0    0    1

•   Multiply Prev and T
                                                          1   0    0 0       1   0 0
                                                                  p-i            p-1 p-0
     – (Σi=0..k previ * tk-i) is coefficient of xk

     – (Σi=0..k p|P|-i * tk-i) is coefficient of xk


•   >=1 if and only if a 1 in P aligns with a 0 in T when P is placed with end at
    tk
     – 2 polynomial multiplications suffice to find all matches of P in T
Other Applications

• Image Processing                   At this
                                    location



      Slide this mask
        all over the
                                    Multiply each bit
         bigger one                  in the mask with
                                            the
                                    corresponding bit
                                       in the image,
                                       sum these up
Polynomial Multiplication
                     An Equivalent Form

• Evaluate each polynomial at 2n+1 distinct x’s

   – A(x) = (an xn + an-1 xn-1+…..+ a0 x0) -> A(v0)…..A(v2n)

   – B(x) = (bn xn + bn-1 xn-1+…..+ b0 x0) -> B(v0)…..B(v2n)


• A(x) * B(x)       ->   A(v0)*B(v0)………..A(v2n)*B(v2n)

   – Convolution in one domain=Simple multiplication in another

   – O(n) time!!!
Multi-Point Polynomial Evaluation

• Evaluate A(x) at v0 ……vn

  – O(n) time per vi using Horner’s rule




• Problems
  – O(n2) time

  – Large numbers with n log vi bits
Multi-Point Polynomial Evaluation
                Speed Up
• A(x) mod (x-v)

   – A(v)

   – O(n) time using high school polynomial division



• A’(x) = A(x) mod (x-v0) (x-v1)         [how fast?]
   – A’(x) mod (x-v0) = A(v0)   [O(1)]

   – A’(x) mod (x-v1) = A(v1)   [O(1)]

   – 2 expensive polynomial divisions could potentially be replaced by 1
Fast Multi-Point Polynomial Evaluation

                                          T0(x)=A(x) mod (x-v0) (x-v1).. (x-vn)

T1(x)=T0 (x) mod (x-v0)..(x-v(n+1)/2-1)        T2 (x)=T0 (x) mod (x-v(n+1)/2) (x-vn)




    • If T(x) mod (x-vi).. (x-vj) can be done in O(deg(T))
      time, then what is the total time taken?

         – O(n log n)!!
Computing T(x) mod (x-v1).. (x-vk)

•   High school algorithm

    – Time taken: O( deg(T) * k )

    – How do we make this faster?


• Stroke of genius
       • Can we choose vi’s so (x-v1).. (x-vk) = xk-v?

       • Then we get O(deg(T) ) time
Choosing vi’s
• When is (x-v1)(x-v2) = x2+v1v2 ?

   – v2+v1=0


• When is (x-a)(x+a)(x-b)(x+b) = x4+ a2b2?

   – b2-a2=0 => b2=-a2

      • => b= sqrt(-1) a

      • the 4 numbers are 1 –i -1 i

      • alternatively (–i)0 (–i)1 (–i)2 (–i)3
Choosing vi’s


• Choose vi to be roots of xn -1

   = Cos(2Πk/n) + i Sin(2Πk/n)
   = e i 2Πk/n

   – Powering just goes around the unit circle

      • Computing with log n bits suffices
Exercise


• Choose vi to be roots of xn -1

   = Cos(2Πk/n) + i Sin(2Πk/n)
   = e i 2Πk/n

   – Organize these roots so we get polynomials with
     just 2 terms in every node of the tree on slide 9
      • Assume n+1 is a power of 2
Conclusion


• Also called : Fast Fourier Transform

• Complex Numbers are interesting!

     • Reality can be explained elegantly only with
       complex numbers!!

Más contenido relacionado

La actualidad más candente

optimal control principle slided
optimal control principle slidedoptimal control principle slided
optimal control principle slidedKarthi Ramachandran
 
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)STAIR Lab, Chiba Institute of Technology
 
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...Francesco Tudisco
 
Conditional neural processes
Conditional neural processesConditional neural processes
Conditional neural processesKazuki Fujikawa
 
Introduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from ScratchIntroduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from ScratchAhmed BESBES
 
A new Perron-Frobenius theorem for nonnegative tensors
A new Perron-Frobenius theorem for nonnegative tensorsA new Perron-Frobenius theorem for nonnegative tensors
A new Perron-Frobenius theorem for nonnegative tensorsFrancesco Tudisco
 
Estimating structured vector autoregressive models
Estimating structured vector autoregressive modelsEstimating structured vector autoregressive models
Estimating structured vector autoregressive modelsAkira Tanimoto
 
Small updates of matrix functions used for network centrality
Small updates of matrix functions used for network centralitySmall updates of matrix functions used for network centrality
Small updates of matrix functions used for network centralityFrancesco Tudisco
 
Computational Linguistics week 5
Computational Linguistics  week 5Computational Linguistics  week 5
Computational Linguistics week 5Mark Chang
 
NTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsNTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsMark Chang
 
Image Restoration 2 (Digital Image Processing)
Image Restoration 2 (Digital Image Processing)Image Restoration 2 (Digital Image Processing)
Image Restoration 2 (Digital Image Processing)VARUN KUMAR
 
Computational Linguistics week 10
 Computational Linguistics week 10 Computational Linguistics week 10
Computational Linguistics week 10Mark Chang
 
Murphy: Machine learning A probabilistic perspective: Ch.9
Murphy: Machine learning A probabilistic perspective: Ch.9Murphy: Machine learning A probabilistic perspective: Ch.9
Murphy: Machine learning A probabilistic perspective: Ch.9Daisuke Yoneoka
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOWMark Chang
 
Levitan Centenary Conference Talk, June 27 2014
Levitan Centenary Conference Talk, June 27 2014Levitan Centenary Conference Talk, June 27 2014
Levitan Centenary Conference Talk, June 27 2014Nikita V. Artamonov
 
Convex Optimization Modelling with CVXOPT
Convex Optimization Modelling with CVXOPTConvex Optimization Modelling with CVXOPT
Convex Optimization Modelling with CVXOPTandrewmart11
 

La actualidad más candente (20)

optimal control principle slided
optimal control principle slidedoptimal control principle slided
optimal control principle slided
 
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
 
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
Nodal Domain Theorem for the p-Laplacian on Graphs and the Related Multiway C...
 
Conditional neural processes
Conditional neural processesConditional neural processes
Conditional neural processes
 
Lec8
Lec8Lec8
Lec8
 
Introduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from ScratchIntroduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from Scratch
 
A new Perron-Frobenius theorem for nonnegative tensors
A new Perron-Frobenius theorem for nonnegative tensorsA new Perron-Frobenius theorem for nonnegative tensors
A new Perron-Frobenius theorem for nonnegative tensors
 
Lec16
Lec16Lec16
Lec16
 
Estimating structured vector autoregressive models
Estimating structured vector autoregressive modelsEstimating structured vector autoregressive models
Estimating structured vector autoregressive models
 
Small updates of matrix functions used for network centrality
Small updates of matrix functions used for network centralitySmall updates of matrix functions used for network centrality
Small updates of matrix functions used for network centrality
 
Gentle intro to SVM
Gentle intro to SVMGentle intro to SVM
Gentle intro to SVM
 
Computational Linguistics week 5
Computational Linguistics  week 5Computational Linguistics  week 5
Computational Linguistics week 5
 
NTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANsNTHU AI Reading Group: Improved Training of Wasserstein GANs
NTHU AI Reading Group: Improved Training of Wasserstein GANs
 
Image Restoration 2 (Digital Image Processing)
Image Restoration 2 (Digital Image Processing)Image Restoration 2 (Digital Image Processing)
Image Restoration 2 (Digital Image Processing)
 
Computational Linguistics week 10
 Computational Linguistics week 10 Computational Linguistics week 10
Computational Linguistics week 10
 
Murphy: Machine learning A probabilistic perspective: Ch.9
Murphy: Machine learning A probabilistic perspective: Ch.9Murphy: Machine learning A probabilistic perspective: Ch.9
Murphy: Machine learning A probabilistic perspective: Ch.9
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOW
 
Levitan Centenary Conference Talk, June 27 2014
Levitan Centenary Conference Talk, June 27 2014Levitan Centenary Conference Talk, June 27 2014
Levitan Centenary Conference Talk, June 27 2014
 
Convex Optimization Modelling with CVXOPT
Convex Optimization Modelling with CVXOPTConvex Optimization Modelling with CVXOPT
Convex Optimization Modelling with CVXOPT
 
2010 mainz
2010 mainz2010 mainz
2010 mainz
 

Destacado

Complex Numbers
Complex NumbersComplex Numbers
Complex Numbersswartzje
 
complex numbers
complex numberscomplex numbers
complex numbersvalour
 
Complex Numbers
Complex NumbersComplex Numbers
Complex Numbersitutor
 
Complex Number's Applications
Complex Number's ApplicationsComplex Number's Applications
Complex Number's ApplicationsNikhil Deswal
 
Complex numbers org.ppt
Complex numbers org.pptComplex numbers org.ppt
Complex numbers org.pptOsama Tahir
 
Complex Number I - Presentation
Complex Number I - PresentationComplex Number I - Presentation
Complex Number I - Presentationyhchung
 
Ch 7 Review March 18
Ch  7 Review March 18Ch  7 Review March 18
Ch 7 Review March 18RyanWatt
 
Complex Numbers And Appsfeb
Complex Numbers And AppsfebComplex Numbers And Appsfeb
Complex Numbers And Appsfebnitinpatelceng
 
Lattice Multiplication
Lattice MultiplicationLattice Multiplication
Lattice MultiplicationLilianPatrick
 
Applications of Definite Intergral
Applications of Definite IntergralApplications of Definite Intergral
Applications of Definite IntergralRAVI PRASAD K.J.
 
B.tech ii unit-3 material multiple integration
B.tech ii unit-3 material multiple integrationB.tech ii unit-3 material multiple integration
B.tech ii unit-3 material multiple integrationRai University
 
B.tech ii unit-2 material beta gamma function
B.tech ii unit-2 material beta gamma functionB.tech ii unit-2 material beta gamma function
B.tech ii unit-2 material beta gamma functionRai University
 
Complex number
Complex numberComplex number
Complex numberAnum Urooj
 

Destacado (19)

5.9 complex numbers
5.9 complex numbers5.9 complex numbers
5.9 complex numbers
 
Complex Numbers
Complex NumbersComplex Numbers
Complex Numbers
 
complex numbers
complex numberscomplex numbers
complex numbers
 
Complex number
Complex numberComplex number
Complex number
 
Complex Numbers
Complex NumbersComplex Numbers
Complex Numbers
 
Complex Number's Applications
Complex Number's ApplicationsComplex Number's Applications
Complex Number's Applications
 
Complex numbers org.ppt
Complex numbers org.pptComplex numbers org.ppt
Complex numbers org.ppt
 
Complex Number I - Presentation
Complex Number I - PresentationComplex Number I - Presentation
Complex Number I - Presentation
 
Ankit maths ppt
Ankit maths pptAnkit maths ppt
Ankit maths ppt
 
Ch 7 Review March 18
Ch  7 Review March 18Ch  7 Review March 18
Ch 7 Review March 18
 
Complex Numbers And Appsfeb
Complex Numbers And AppsfebComplex Numbers And Appsfeb
Complex Numbers And Appsfeb
 
Lattice multiplication
Lattice multiplicationLattice multiplication
Lattice multiplication
 
Lattice Multiplication
Lattice MultiplicationLattice Multiplication
Lattice Multiplication
 
Complex Numbers
Complex NumbersComplex Numbers
Complex Numbers
 
Ch 7 c volumes
Ch 7 c  volumesCh 7 c  volumes
Ch 7 c volumes
 
Applications of Definite Intergral
Applications of Definite IntergralApplications of Definite Intergral
Applications of Definite Intergral
 
B.tech ii unit-3 material multiple integration
B.tech ii unit-3 material multiple integrationB.tech ii unit-3 material multiple integration
B.tech ii unit-3 material multiple integration
 
B.tech ii unit-2 material beta gamma function
B.tech ii unit-2 material beta gamma functionB.tech ii unit-2 material beta gamma function
B.tech ii unit-2 material beta gamma function
 
Complex number
Complex numberComplex number
Complex number
 

Similar a Complex numbers polynomial multiplication

Gaussian Integration
Gaussian IntegrationGaussian Integration
Gaussian IntegrationReza Rahimi
 
An Algorithm to Find the Largest Circle inside a Polygon
An Algorithm to Find the Largest Circle inside a PolygonAn Algorithm to Find the Largest Circle inside a Polygon
An Algorithm to Find the Largest Circle inside a PolygonKasun Ranga Wijeweera
 
VHDL and Cordic Algorithim
VHDL and Cordic AlgorithimVHDL and Cordic Algorithim
VHDL and Cordic AlgorithimSubeer Rangra
 
Recurrent Problem in Discrete Mathmatics.pptx
Recurrent Problem in Discrete Mathmatics.pptxRecurrent Problem in Discrete Mathmatics.pptx
Recurrent Problem in Discrete Mathmatics.pptxgbikorno
 
Binomial theorem for any index
Binomial theorem for any indexBinomial theorem for any index
Binomial theorem for any indexindu psthakur
 
Unit 1 Operation on signals
Unit 1  Operation on signalsUnit 1  Operation on signals
Unit 1 Operation on signalsDr.SHANTHI K.G
 
05 history of cv a machine learning (theory) perspective on computer vision
05  history of cv a machine learning (theory) perspective on computer vision05  history of cv a machine learning (theory) perspective on computer vision
05 history of cv a machine learning (theory) perspective on computer visionzukun
 
An Algorithm to Find the Visible Region of a Polygon
An Algorithm to Find the Visible Region of a PolygonAn Algorithm to Find the Visible Region of a Polygon
An Algorithm to Find the Visible Region of a PolygonKasun Ranga Wijeweera
 
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE ShivangiSingh241
 
Interpolation techniques - Background and implementation
Interpolation techniques - Background and implementationInterpolation techniques - Background and implementation
Interpolation techniques - Background and implementationQuasar Chunawala
 
Copy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquerCopy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquerJoepang2015
 
Calculus Review for semester 1 at University
Calculus Review for semester 1 at UniversityCalculus Review for semester 1 at University
Calculus Review for semester 1 at Universitynetaf56543
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
Graphs of the Sine and Cosine Functions Lecture
Graphs of the Sine and Cosine Functions LectureGraphs of the Sine and Cosine Functions Lecture
Graphs of the Sine and Cosine Functions LectureFroyd Wess
 

Similar a Complex numbers polynomial multiplication (20)

Gaussian Integration
Gaussian IntegrationGaussian Integration
Gaussian Integration
 
An Algorithm to Find the Largest Circle inside a Polygon
An Algorithm to Find the Largest Circle inside a PolygonAn Algorithm to Find the Largest Circle inside a Polygon
An Algorithm to Find the Largest Circle inside a Polygon
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
VHDL and Cordic Algorithim
VHDL and Cordic AlgorithimVHDL and Cordic Algorithim
VHDL and Cordic Algorithim
 
Recurrent Problem in Discrete Mathmatics.pptx
Recurrent Problem in Discrete Mathmatics.pptxRecurrent Problem in Discrete Mathmatics.pptx
Recurrent Problem in Discrete Mathmatics.pptx
 
Time complexity
Time complexityTime complexity
Time complexity
 
Binomial theorem for any index
Binomial theorem for any indexBinomial theorem for any index
Binomial theorem for any index
 
Unit 1 Operation on signals
Unit 1  Operation on signalsUnit 1  Operation on signals
Unit 1 Operation on signals
 
05 history of cv a machine learning (theory) perspective on computer vision
05  history of cv a machine learning (theory) perspective on computer vision05  history of cv a machine learning (theory) perspective on computer vision
05 history of cv a machine learning (theory) perspective on computer vision
 
Taylor problem
Taylor problemTaylor problem
Taylor problem
 
An Algorithm to Find the Visible Region of a Polygon
An Algorithm to Find the Visible Region of a PolygonAn Algorithm to Find the Visible Region of a Polygon
An Algorithm to Find the Visible Region of a Polygon
 
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
 
Interpolation techniques - Background and implementation
Interpolation techniques - Background and implementationInterpolation techniques - Background and implementation
Interpolation techniques - Background and implementation
 
Copy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquerCopy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquer
 
Calculus Review for semester 1 at University
Calculus Review for semester 1 at UniversityCalculus Review for semester 1 at University
Calculus Review for semester 1 at University
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
stoch41.pdf
stoch41.pdfstoch41.pdf
stoch41.pdf
 
Computer science-formulas
Computer science-formulasComputer science-formulas
Computer science-formulas
 
Graphs of the Sine and Cosine Functions Lecture
Graphs of the Sine and Cosine Functions LectureGraphs of the Sine and Cosine Functions Lecture
Graphs of the Sine and Cosine Functions Lecture
 

Más de Strand Life Sciences Pvt Ltd (12)

Strand genomics features in CIO review
Strand genomics features in CIO reviewStrand genomics features in CIO review
Strand genomics features in CIO review
 
Rules of a Quantum World
Rules of  a Quantum WorldRules of  a Quantum World
Rules of a Quantum World
 
Least common ancestors in constant time
Least common ancestors in constant timeLeast common ancestors in constant time
Least common ancestors in constant time
 
Introduction to statistics iii
Introduction to statistics iiiIntroduction to statistics iii
Introduction to statistics iii
 
Introduction to statistics ii
Introduction to statistics iiIntroduction to statistics ii
Introduction to statistics ii
 
Introduction to statistics
Introduction to statisticsIntroduction to statistics
Introduction to statistics
 
Dynamic programming for simd
Dynamic programming for simdDynamic programming for simd
Dynamic programming for simd
 
Converting High Dimensional Problems to Low Dimensional Ones
Converting High Dimensional Problems to Low Dimensional OnesConverting High Dimensional Problems to Low Dimensional Ones
Converting High Dimensional Problems to Low Dimensional Ones
 
Searching using Quantum Rules
Searching using Quantum RulesSearching using Quantum Rules
Searching using Quantum Rules
 
Randomized algorithms
Randomized algorithmsRandomized algorithms
Randomized algorithms
 
Suffix arrays
Suffix arraysSuffix arrays
Suffix arrays
 
Alignment of raw reads in Avadis NGS
Alignment of raw reads in Avadis NGSAlignment of raw reads in Avadis NGS
Alignment of raw reads in Avadis NGS
 

Último

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Último (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

Complex numbers polynomial multiplication

  • 1. Multiplying Polynomials Fast Why do we need Complex Numbers?
  • 2. The Problem • (an xn + an-1 xn-1+…..+ a0 x0) * (bn xn + bn-1 xn-1+…..+ b0 x0) • O(n^2) time – (Σi=0..k ai * bk-i) is coefficient of xk • Can one do better?
  • 3. Applications • Where all does a pattern string P appear in a text string T? – P 0’s, 1’s and don’t cares. – T 0’s and 1’s • Easy in O(|P|*|T|) time – Can one do better?
  • 4. Conversion to Polynomial Multiplication • Treat P and T as polynomials – T=0101 1 x0 + 0 x1 + 1 x2 + 0 x3 tk-i tk-2 tk-1 tk – P=01D1 0 x0 + 1 x1 + 0 x2 + 1 x3 1 0 1 0 1 1 0 0 1 • Multiply Prev and T 1 0 0 0 1 0 0 p-i p-1 p-0 – (Σi=0..k previ * tk-i) is coefficient of xk – (Σi=0..k p|P|-i * tk-i) is coefficient of xk • >=1 if and only if a 1 in P aligns with a 0 in T when P is placed with end at tk – 2 polynomial multiplications suffice to find all matches of P in T
  • 5. Other Applications • Image Processing At this location Slide this mask all over the Multiply each bit bigger one in the mask with the corresponding bit in the image, sum these up
  • 6. Polynomial Multiplication An Equivalent Form • Evaluate each polynomial at 2n+1 distinct x’s – A(x) = (an xn + an-1 xn-1+…..+ a0 x0) -> A(v0)…..A(v2n) – B(x) = (bn xn + bn-1 xn-1+…..+ b0 x0) -> B(v0)…..B(v2n) • A(x) * B(x) -> A(v0)*B(v0)………..A(v2n)*B(v2n) – Convolution in one domain=Simple multiplication in another – O(n) time!!!
  • 7. Multi-Point Polynomial Evaluation • Evaluate A(x) at v0 ……vn – O(n) time per vi using Horner’s rule • Problems – O(n2) time – Large numbers with n log vi bits
  • 8. Multi-Point Polynomial Evaluation Speed Up • A(x) mod (x-v) – A(v) – O(n) time using high school polynomial division • A’(x) = A(x) mod (x-v0) (x-v1) [how fast?] – A’(x) mod (x-v0) = A(v0) [O(1)] – A’(x) mod (x-v1) = A(v1) [O(1)] – 2 expensive polynomial divisions could potentially be replaced by 1
  • 9. Fast Multi-Point Polynomial Evaluation T0(x)=A(x) mod (x-v0) (x-v1).. (x-vn) T1(x)=T0 (x) mod (x-v0)..(x-v(n+1)/2-1) T2 (x)=T0 (x) mod (x-v(n+1)/2) (x-vn) • If T(x) mod (x-vi).. (x-vj) can be done in O(deg(T)) time, then what is the total time taken? – O(n log n)!!
  • 10. Computing T(x) mod (x-v1).. (x-vk) • High school algorithm – Time taken: O( deg(T) * k ) – How do we make this faster? • Stroke of genius • Can we choose vi’s so (x-v1).. (x-vk) = xk-v? • Then we get O(deg(T) ) time
  • 11. Choosing vi’s • When is (x-v1)(x-v2) = x2+v1v2 ? – v2+v1=0 • When is (x-a)(x+a)(x-b)(x+b) = x4+ a2b2? – b2-a2=0 => b2=-a2 • => b= sqrt(-1) a • the 4 numbers are 1 –i -1 i • alternatively (–i)0 (–i)1 (–i)2 (–i)3
  • 12. Choosing vi’s • Choose vi to be roots of xn -1 = Cos(2Πk/n) + i Sin(2Πk/n) = e i 2Πk/n – Powering just goes around the unit circle • Computing with log n bits suffices
  • 13. Exercise • Choose vi to be roots of xn -1 = Cos(2Πk/n) + i Sin(2Πk/n) = e i 2Πk/n – Organize these roots so we get polynomials with just 2 terms in every node of the tree on slide 9 • Assume n+1 is a power of 2
  • 14. Conclusion • Also called : Fast Fourier Transform • Complex Numbers are interesting! • Reality can be explained elegantly only with complex numbers!!