Algorithm Design and Analysis

Size: px
Start display at page:

Download "Algorithm Design and Analysis"

Transcription

1 Algorithm Design and Analysis LECTURE 14 Divide and Conquer Fast Fourier Transform Sofya Raskhodnikova 10/7/2016 S. Raskhodnikova; based on slides by K. Wayne.

2 5.6 Convolution and FFT

3 Fast Fourier Transform: Applications Applications. Optics, acoustics, quantum physics, telecommunications, control systems, signal processing, speech recognition, data compression, image processing. DVD, JPEG, MP3, MRI, CAT scan. Numerical solutions to Poisson's equation. The FFT is one of the truly great computational developments of this [20th] century. It has changed the face of science and engineering so much that it is not an exaggeration to say that life as we know it would be very different without the FFT. -Charles van Loan 3

4 Fast Fourier Transform: Brief History Gauss (1805, 1866). Analyzed periodic motion of asteroid Ceres. Runge-König (1924). Laid theoretical groundwork. Danielson-Lanczos (1942). Efficient algorithm. Cooley-Tukey (1965). Monitoring nuclear tests in Soviet Union and tracking submarines. Rediscovered and popularized FFT. Importance not fully realized until advent of digital computers. 4

5 Polynomials: Coefficient Representation Polynomial. [coefficient representation] A(x) a 0 a 1 x a 2 x 2 B(x) b 0 b 1 x b 2 x 2 a n 1 x n 1 b n 1 x n 1 Add: O(n) arithmetic operations. A(x) B(x) (a 0 b 0 ) (a 1 b 1 )x (a n 1 b n 1 )x n 1 Evaluate: O(n) using Horner's method. A(x) a 0 (x(a 1 x(a 2 x(a n 2 x(a n 1 )) )) Multiply (convolve): O(n 2 ) using brute force. A(x) B(x) 2n 2 c i x i, where c i a j b i j i 0 i j 0 5

6 Polynomials: Point-Value Representation Fundamental theorem of algebra. [Gauss, PhD thesis] A degree n polynomial with complex coefficients has n complex roots. Corollary. A degree n-1 polynomial A(x) is uniquely specified by its evaluation at n distinct values of x. y y j = A(x j ) x j x 6

7 Polynomials: Point-Value Representation Polynomial. [point-value representation] A(x) : (x 0, y 0 ),, (x n-1, y n 1 ) B(x) : (x 0, z 0 ),, (x n-1, z n 1 ) Add: O(n) arithmetic operations. A(x) B(x): (x 0, y 0 z 0 ),, (x n-1, y n 1 z n 1 ) Multiply: O(n), but need 2n-1 points. A(x) B(x): (x 0, y 0 z 0 ),, (x 2n-1, y 2n 1 z 2n 1 ) Evaluate: O(n 2 ) using Lagrange's formula. (x x j ) n 1 j k A(x) y k (x k x j ) k 0 j k 7

8 Converting Between Two Polynomial Representations Tradeoff. Fast evaluation or fast multiplication. We want both! Representation Coefficient Multiply O(n 2 ) Evaluate O(n) Point-value O(n) O(n 2 ) Goal. Make all ops fast by efficiently converting between two representations. a 0, a 1,, a n-1 coefficient representation (x 0, y 0 ),, (x n 1, y n 1 ) point-value representation 8

9 Converting Between Two Polynomial Representations: Brute Force Coefficient to point-value. Given a polynomial a 0 + a 1 x a n-1 x n-1, evaluate it at n distinct points x 0,..., x n-1. y 0 y 1 y 2 y n x 0 x x 1 x 1 1 x 2 2 x 2 1 x n 1 2 x n 1 x 0 n 1 x 1 n 1 x 2 n 1 n 1 x n 1 a 0 a 1 a 2 a n 1 O(n 2 ) for matrix-vector multiply O(n 3 ) for Gaussian elimination Vandermonde matrix is invertible iff x i distinct Point-value to coefficient. Given n distinct points x 0,..., x n-1 and values y 0,..., y n-1, find unique polynomial a 0 + a 1 x a n-1 x n-1 that has given values at given points. 9

10 Coefficient to Point-Value Representation: Intuition Coefficient to point-value. Given a polynomial a 0 + a 1 x a n-1 x n-1, evaluate it at n distinct points x 0,..., x n-1. Divide. Break polynomial up into even and odd powers. A(x) = a 0 + a 1 x + a 2 x 2 + a 3 x 3 + a 4 x 4 + a 5 x 5 + a 6 x 6 + a 7 x 7. A even (x) = a 0 + a 2 x + a 4 x 2 + a 6 x 3. A odd (x) = a 1 + a 3 x + a 5 x 2 + a 7 x 3. A(-x) = A even (x 2 ) + x A odd (x 2 ). A(-x) = A even (x 2 ) - x A odd (x 2 ). Intuition. Choose two points to be 1. A(-1) = A even (1) + 1 A odd (1). A(-1) = A even (1) - 1 A odd (1). Can evaluate polynomial of degree n at 2 points by evaluating two polynomials of degree ½n at 1 point. 10

11 Coefficient to Point-Value Representation: Intuition Coefficient to point-value. Given a polynomial a 0 + a 1 x a n-1 x n-1, evaluate it at n distinct points x 0,..., x n-1. Divide. Break polynomial up into even and odd powers. A(x) = a 0 + a 1 x + a 2 x 2 + a 3 x 3 + a 4 x 4 + a 5 x 5 + a 6 x 6 + a 7 x 7. A even (x) = a 0 + a 2 x + a 4 x 2 + a 6 x 3. A odd (x) = a 1 + a 3 x + a 5 x 2 + a 7 x 3. A(-x) = A even (x 2 ) + x A odd (x 2 ). A(-x) = A even (x 2 ) - x A odd (x 2 ). Intuition. Choose four points to be 1, i. A(-1) = A even (-1) + 1 A odd ( 1). A(-1) = A even (-1) - 1 A odd (-1). A(-i) = A even (-1) + i A odd (-1). A(-i) = A even (-1) - i A odd (-1). Can evaluate polynomial of degree n at 4 points by evaluating two polynomials of degree ½n at 2 points. 11

12 Discrete Fourier Transform Coefficient to point-value. Given a polynomial a 0 + a 1 x a n-1 x n-1, evaluate it at n distinct points x 0,..., x n-1. Key idea: choose x k = k where is principal n th root of unity. y 0 y 1 y 2 y 3 y n n (n 1) (n 1) 1 n 1 2(n 1) 3(n 1) (n 1)(n 1) a 0 a 1 a 2 a 3 a n 1 Discrete Fourier transform Fourier matrix F n 12

13 Roots of Unity Def. An n th root of unity is a complex number x such that x n = 1. Fact. The n th roots of unity are: 0, 1,, n-1 where = e 2 i / n. Pf. ( k ) n = (e 2 i k / n ) n = (e i ) 2k = (-1) 2k = 1. Fact. The ½n th roots of unity are: 0, 1,, n/2-1 where = e 4 i / n. Fact. 2 = and ( 2 ) k = k. 2 = 1 = i = 2 = -1 n = 8 0 = 0 = = 3 = -i 13

14 Fast Fourier Transform Goal. Evaluate a degree n-1 polynomial A(x) = a a n-1 x n-1 at its n th roots of unity: 0, 1,, n-1. Divide. Break polynomial up into even and odd powers. A even (x) = a 0 + a 2 x + a 4 x a n/2-2 x (n-1)/2. A odd (x) = a 1 + a 3 x + a 5 x a n/2-1 x (n-1)/2. A(x) = A even (x 2 ) + x A odd (x 2 ). Conquer. Evaluate degree A even (x) and A odd (x) at the ½n th roots of unity: 0, 1,, n/2-1. Combine. A( k+n ) = A even ( k ) + k A odd ( k ), 0 k < n/2 A( k+n ) = A even ( k ) - k A odd ( k ), 0 k < n/2 k = ( k ) 2 = ( k+n ) 2 k+n = - k 14

15 FFT Algorithm assumes n is a power of 2 fft(n, a 0,a 1,,a n-1 ) { if (n == 1) return a 0 (e 0,e 1,,e n/2-1 ) FFT(n/2, a 0,a 2,a 4,,a n-2 ) (d 0,d 1,,d n/2-1 ) FFT(n/2, a 1,a 3,a 5,,a n-1 ) for k = 0 to n/2-1 { k e 2 ik/n y k+n/2 e k + k d k } y k+n/2 e k - k d k } return (y 0,y 1,,y n-1 ) 15

16 FFT Summary Theorem. FFT algorithm evaluates a degree n-1 polynomial at each of the n th roots of unity in O(n log n) steps. assumes n is a power of 2 Running time. T(2n) = 2T(n) + O(n) T(n) = O(n log n). O(n log n) a 0, a 1,, a n-1 coefficient representation ( 0, y 0 ),, ( n 1, y n 1 ) point-value representation 16

17 Recursion Tree a 0, a 1, a 2, a 3, a 4, a 5, a 6, a 7 perfect shuffle a 0, a 2, a 4, a 6 a 1, a 3, a 5, a 7 a 0, a 4 a 2, a 6 a 1, a 5 a 3, a 7 a 0 a 4 a 2 a 6 a 1 a 5 a 3 a "bit-reversed" order 17

18 Point-Value to Coefficient Representation: Inverse DFT Goal. Given the values y 0,..., y n-1 of a degree n-1 polynomial at the n points 0, 1,, n-1, find unique polynomial a 0 + a 1 x a n-1 x n-1 that has given values at given points. a 0 a 1 a 2 a 3 a n n (n 1) (n 1) 1 n 1 2(n 1) 3(n 1) (n 1)(n 1) y 0 y 1 y 2 y 3 y n 1 Inverse DFT Fourier matrix inverse (F n ) -1 18

19 Inverse FFT Claim. Inverse of Fourier matrix is given by following formula. G n 1 n (n 1) (n 1) (n 1) 1 (n 1) 2(n 1) 3(n 1) (n 1)(n 1) Consequence. To compute inverse FFT, apply same algorithm but use -1 = e -2 i / n as principal n th root of unity (and divide by n). 19

20 Inverse FFT: Proof of Correctness Claim. F n and G n are inverses. Pf. F n G n k k 1 n n 1 k j j k 1 n j 0 n 1 (k k ) j j 0 1 if k k 0 otherwise summation lemma Summation lemma. Let be a principal n th root of unity. Then n 1 k j j 0 n if k 0 mod n 0 otherwise Pf. If k is a multiple of n then k = 1 sums to n. Each n th root of unity k is a root of x n - 1 = (x - 1) (1 + x + x x n-1 ). if k 1 we have: 1 + k + k(2) k(n-1) = 0 sums to 0. 20

21 Inverse FFT: Algorithm ifft(n, a 0,a 1,,a n-1 ) { if (n == 1) return a 0 (e 0,e 1,,e n/2-1 ) FFT(n/2, a 0,a 2,a 4,,a n-2 ) (d 0,d 1,,d n/2-1 ) FFT(n/2, a 1,a 3,a 5,,a n-1 ) for k = 0 to n/2-1 { } k e -2 ik/n y k+n/2 (e k + k d k ) / n y k+n/2 (e k - k d k ) / n } return (y 0,y 1,,y n-1 ) 21

22 Inverse FFT Summary Theorem. Inverse FFT algorithm interpolates a degree n-1 polynomial given values at each of the n th roots of unity in O(n log n) steps. assumes n is a power of 2 O(n log n) a 0, a 1,, a n-1 coefficient representation O(n log n) ( 0, y 0 ),, ( n 1, y n 1 ) point-value representation 22

23 Polynomial Multiplication Theorem. Can multiply two degree n-1 polynomials in O(n log n) steps. coefficient representation a 0, a 1,, a n-1 b 0, b 1,, b n-1 coefficient representation c 0, c 1,, c 2n-2 FFT O(n log n) inverse FFT O(n log n) A(x 0 ),, A(x 2n-1 ) point-value multiplication B(x 0 ),, B(x 2n-1 ) C(x 0 ), C(x 1 ),, C(x 2n-1 ) O(n) 23

24 FFT in Practice Fastest Fourier transform in the West. [Frigo and Johnson] Optimized C library. Features: DFT, DCT, real, complex, any size, any dimension. Won 1999 Wilkinson Prize for Numerical Software. Portable, competitive with vendor-tuned code. Implementation details. Instead of executing predetermined algorithm, it evaluates your hardware and uses a special-purpose compiler to generate an optimized algorithm catered to "shape" of the problem. Core algorithm is nonrecursive version of Cooley-Tukey radix 2 FFT. O(n log n), even for prime sizes. Reference: 24

25 Integer Multiplication Integer multiplication. Given two n bit integers a = a n-1 a 1 a 0 and b = b n-1 b 1 b 0, compute their product c = a b. Convolution algorithm. A(x) a 0 a 1 x a 2 x 2 Form two polynomials. Note: a = A(2), b = B(2). B(x) b 0 b 1 x b 2 x 2 Compute C(x) = A(x) B(x). Evaluate C(2) = a b. Running time: O(n log n) complex arithmetic steps. a n 1 x n 1 b n 1 x n 1 Theory. [Schönhage-Strassen 1971] O(n log n log log n) bit operations. [Martin Fϋrer (Penn State) 2007] O(n log n 2 log* n ) bit operations. Practice. [GNU Multiple Precision Arithmetic Library] GMP proclaims to be "the fastest bignum library on the planet." It uses brute force, Karatsuba, and FFT, depending on the size of n. 25

5.6 Convolution and FFT

5.6 Convolution and FFT 5.6 Convolution and FFT Fast Fourier Transform: Applications Applications. Optics, acoustics, quantum physics, telecommunications, control systems, signal processing, speech recognition, data compression,

More information

How to Multiply. 5.5 Integer Multiplication. Complex Multiplication. Integer Arithmetic. Complex multiplication. (a + bi) (c + di) = x + yi.

How to Multiply. 5.5 Integer Multiplication. Complex Multiplication. Integer Arithmetic. Complex multiplication. (a + bi) (c + di) = x + yi. How to ultiply Slides by Kevin Wayne. Copyright 5 Pearson-Addison Wesley. All rights reserved. integers, matrices, and polynomials Complex ultiplication Complex multiplication. a + bi) c + di) = x + yi.

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 5 Divide and Conquer: Fast Fourier Transform Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms

More information

DIVIDE AND CONQUER II

DIVIDE AND CONQUER II DIVIDE AND CONQUER II master theorem integer multiplication matrix multiplication convolution and FFT Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley http://www.cs.princeton.edu/~wayne/kleinberg-tardos

More information

DIVIDE AND CONQUER II

DIVIDE AND CONQUER II DIVIDE AND CONQUER II master theorem integer multiplication matrix multiplication convolution and FFT SECTION 5.6 Fourier analysis Fourier theorem. [Fourier, Dirichlet, Riemann] Any sufficiently smooth)

More information

The Fast Fourier Transform. Andreas Klappenecker

The Fast Fourier Transform. Andreas Klappenecker The Fast Fourier Transform Andreas Klappenecker Motivation There are few algorithms that had more impact on modern society than the fast Fourier transform and its relatives. The applications of the fast

More information

Chapter 5. Divide and Conquer. CS 350 Winter 2018

Chapter 5. Divide and Conquer. CS 350 Winter 2018 Chapter 5 Divide and Conquer CS 350 Winter 2018 1 Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve each part recursively. Combine solutions to sub-problems into overall

More information

The Fast Fourier Transform: A Brief Overview. with Applications. Petros Kondylis. Petros Kondylis. December 4, 2014

The Fast Fourier Transform: A Brief Overview. with Applications. Petros Kondylis. Petros Kondylis. December 4, 2014 December 4, 2014 Timeline Researcher Date Length of Sequence Application CF Gauss 1805 Any Composite Integer Interpolation of orbits of celestial bodies F Carlini 1828 12 Harmonic Analysis of Barometric

More information

FFT: Fast Polynomial Multiplications

FFT: Fast Polynomial Multiplications FFT: Fast Polynomial Multiplications Jie Wang University of Massachusetts Lowell Department of Computer Science J. Wang (UMass Lowell) FFT: Fast Polynomial Multiplications 1 / 20 Overview So far we have

More information

DIVIDE AND CONQUER II

DIVIDE AND CONQUER II DIVIDE AND CONQUER II master theorem integer multiplication matrix multiplication convolution and FFT DIVIDE AND CONQUER II master theorem integer multiplication matrix multiplication convolution and FFT

More information

Computational Methods CMSC/AMSC/MAPL 460

Computational Methods CMSC/AMSC/MAPL 460 Computational Methods CMSC/AMSC/MAPL 460 Fourier transform Balaji Vasan Srinivasan Dept of Computer Science Several slides from Prof Healy s course at UMD Last time: Fourier analysis F(t) = A 0 /2 + A

More information

CSE 421 Algorithms. T(n) = at(n/b) + n c. Closest Pair Problem. Divide and Conquer Algorithms. What you really need to know about recurrences

CSE 421 Algorithms. T(n) = at(n/b) + n c. Closest Pair Problem. Divide and Conquer Algorithms. What you really need to know about recurrences CSE 421 Algorithms Richard Anderson Lecture 13 Divide and Conquer What you really need to know about recurrences Work per level changes geometrically with the level Geometrically increasing (x > 1) The

More information

CS S Lecture 5 January 29, 2019

CS S Lecture 5 January 29, 2019 CS 6363.005.19S Lecture 5 January 29, 2019 Main topics are #divide-and-conquer with #fast_fourier_transforms. Prelude Homework 1 is due Tuesday, February 5th. I hope you ve at least looked at it by now!

More information

The tangent FFT. D. J. Bernstein University of Illinois at Chicago

The tangent FFT. D. J. Bernstein University of Illinois at Chicago The tangent FFT D. J. Bernstein University of Illinois at Chicago Advertisement SPEED: Software Performance Enhancement for Encryption and Decryption A workshop on software speeds for secret-key cryptography

More information

CS711008Z Algorithm Design and Analysis

CS711008Z Algorithm Design and Analysis CS711008Z Algorithm Design and Analysis Lecture 5 FFT and Divide and Conquer Dongbo Bu Institute of Computing Technology Chinese Academy of Sciences, Beijing, China 1 / 56 Outline DFT: evaluate a polynomial

More information

DIVIDE AND CONQUER II

DIVIDE AND CONQUER II DIVIDE AND CONQUER II DIVIDE AND CONQUER II master theorem integer multiplication matrix multiplication convolution and FFT master theorem integer multiplication matrix multiplication convolution and FFT

More information

Fast Convolution; Strassen s Method

Fast Convolution; Strassen s Method Fast Convolution; Strassen s Method 1 Fast Convolution reduction to subquadratic time polynomial evaluation at complex roots of unity interpolation via evaluation at complex roots of unity 2 The Master

More information

Fast Polynomials Multiplication Using FFT

Fast Polynomials Multiplication Using FFT Li Chen lichen.xd at gmail.com Xidian University January 17, 2014 Outline 1 Discrete Fourier Transform (DFT) 2 Discrete Convolution 3 Fast Fourier Transform (FFT) 4 umber Theoretic Transform (TT) 5 More

More information

CSE 548: Analysis of Algorithms. Lecture 4 ( Divide-and-Conquer Algorithms: Polynomial Multiplication )

CSE 548: Analysis of Algorithms. Lecture 4 ( Divide-and-Conquer Algorithms: Polynomial Multiplication ) CSE 548: Analysis of Algorithms Lecture 4 ( Divide-and-Conquer Algorithms: Polynomial Multiplication ) Rezaul A. Chowdhury Department of Computer Science SUNY Stony Brook Spring 2015 Coefficient Representation

More information

Integer multiplication with generalized Fermat primes

Integer multiplication with generalized Fermat primes Integer multiplication with generalized Fermat primes CARAMEL Team, LORIA, University of Lorraine Supervised by: Emmanuel Thomé and Jérémie Detrey Journées nationales du Calcul Formel 2015 (Cluny) November

More information

Chapter 1 Divide and Conquer Polynomial Multiplication Algorithm Theory WS 2015/16 Fabian Kuhn

Chapter 1 Divide and Conquer Polynomial Multiplication Algorithm Theory WS 2015/16 Fabian Kuhn Chapter 1 Divide and Conquer Polynomial Multiplication Algorithm Theory WS 2015/16 Fabian Kuhn Formulation of the D&C principle Divide-and-conquer method for solving a problem instance of size n: 1. Divide

More information

Computer Vision, Convolutions, Complexity and Algebraic Geometry

Computer Vision, Convolutions, Complexity and Algebraic Geometry Computer Vision, Convolutions, Complexity and Algebraic Geometry D. V. Chudnovsky, G.V. Chudnovsky IMAS Polytechnic Institute of NYU 6 MetroTech Center Brooklyn, NY 11201 December 6, 2012 Fast Multiplication:

More information

Kartsuba s Algorithm and Linear Time Selection

Kartsuba s Algorithm and Linear Time Selection CS 374: Algorithms & Models of Computation, Fall 2015 Kartsuba s Algorithm and Linear Time Selection Lecture 09 September 22, 2015 Chandra & Manoj (UIUC) CS374 1 Fall 2015 1 / 32 Part I Fast Multiplication

More information

Multiplying huge integers using Fourier transforms

Multiplying huge integers using Fourier transforms Fourier transforms October 25, 2007 820348901038490238478324 1739423249728934932894??? integers occurs in many fields of Computational Science: Cryptography Number theory... Traditional approaches to

More information

Fast Polynomial Multiplication

Fast Polynomial Multiplication Fast Polynomial Multiplication Marc Moreno Maza CS 9652, October 4, 2017 Plan Primitive roots of unity The discrete Fourier transform Convolution of polynomials The fast Fourier transform Fast convolution

More information

Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201

Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201 Divide and Conquer: Polynomial Multiplication Version of October 7, 2014 Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201 Outline Outline: Introduction The polynomial multiplication

More information

E The Fast Fourier Transform

E The Fast Fourier Transform Fourier Transform Methods in Finance By Umberto Cherubini Giovanni Della Lunga Sabrina Mulinacci Pietro Rossi Copyright 2010 John Wiley & Sons Ltd E The Fast Fourier Transform E.1 DISCRETE FOURIER TRASFORM

More information

CPSC 518 Introduction to Computer Algebra Asymptotically Fast Integer Multiplication

CPSC 518 Introduction to Computer Algebra Asymptotically Fast Integer Multiplication CPSC 518 Introduction to Computer Algebra Asymptotically Fast Integer Multiplication 1 Introduction We have now seen that the Fast Fourier Transform can be applied to perform polynomial multiplication

More information

How to Write Fast Numerical Code

How to Write Fast Numerical Code How to Write Fast Numerical Code Lecture: Discrete Fourier transform, fast Fourier transforms Instructor: Markus Püschel TA: Georg Ofenbeck & Daniele Spampinato Rest of Semester Today Lecture Project meetings

More information

feb abhi shelat Matrix, FFT

feb abhi shelat Matrix, FFT L7 feb 11 2016 abhi shelat Matrix, FFT userid: = Using the standard method, how many multiplications does it take to multiply two NxN matrices? cos( /4) = cos( /2) = sin( /4) = sin( /2) = Mergesort Karatsuba

More information

Interpolation on the unit circle

Interpolation on the unit circle Lecture 2: The Fast Discrete Fourier Transform Interpolation on the unit circle So far, we have considered interpolation of functions at nodes on the real line. When we model periodic phenomena, it is

More information

Fast Fourier Transform

Fast Fourier Transform Why Fourier Transform? Fast Fourier Transform Jordi Cortadella and Jordi Petit Department of Computer Science Polynomials: coefficient representation Divide & Conquer Dept. CS, UPC Polynomials: point-value

More information

How to Write Fast Numerical Code Spring 2012 Lecture 19. Instructor: Markus Püschel TAs: Georg Ofenbeck & Daniele Spampinato

How to Write Fast Numerical Code Spring 2012 Lecture 19. Instructor: Markus Püschel TAs: Georg Ofenbeck & Daniele Spampinato How to Write Fast Numerical Code Spring 2012 Lecture 19 Instructor: Markus Püschel TAs: Georg Ofenbeck & Daniele Spampinato Miscellaneous Roofline tool Project report etc. online Midterm (solutions online)

More information

Periodic motions. Periodic motions are known since the beginning of mankind: Motion of planets around the Sun; Pendulum; And many more...

Periodic motions. Periodic motions are known since the beginning of mankind: Motion of planets around the Sun; Pendulum; And many more... Periodic motions Periodic motions are known since the beginning of mankind: Motion of planets around the Sun; Pendulum; And many more... Periodic motions There are several quantities which describe a periodic

More information

Divide and Conquer algorithms

Divide and Conquer algorithms Divide and Conquer algorithms Another general method for constructing algorithms is given by the Divide and Conquer strategy. We assume that we have a problem with input that can be split into parts in

More information

Frequency Domain Finite Field Arithmetic for Elliptic Curve Cryptography

Frequency Domain Finite Field Arithmetic for Elliptic Curve Cryptography Frequency Domain Finite Field Arithmetic for Elliptic Curve Cryptography Selçuk Baktır, Berk Sunar {selcuk,sunar}@wpi.edu Department of Electrical & Computer Engineering Worcester Polytechnic Institute

More information

Sequential Fast Fourier Transform (PSC ) Sequential FFT

Sequential Fast Fourier Transform (PSC ) Sequential FFT Sequential Fast Fourier Transform (PSC 3.1 3.2) 1 / 18 Applications of Fourier analysis Fourier analysis studies the decomposition of functions into their frequency components. Piano Concerto no. 9 by

More information

Implementation of the DKSS Algorithm for Multiplication of Large Numbers

Implementation of the DKSS Algorithm for Multiplication of Large Numbers Implementation of the DKSS Algorithm for Multiplication of Large Numbers Christoph Lüders Universität Bonn The International Symposium on Symbolic and Algebraic Computation, July 6 9, 2015, Bath, United

More information

Speedy Maths. David McQuillan

Speedy Maths. David McQuillan Speedy Maths David McQuillan Basic Arithmetic What one needs to be able to do Addition and Subtraction Multiplication and Division Comparison For a number of order 2 n n ~ 100 is general multi precision

More information

Chapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn

Chapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn Chapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn Formulation of the D&C principle Divide-and-conquer method for solving a problem instance of size n: 1. Divide n c: Solve the problem

More information

Lecture 20: Discrete Fourier Transform and FFT

Lecture 20: Discrete Fourier Transform and FFT EE518 Digital Signal Processing University of Washington Autumn 2001 Dept of Electrical Engineering Lecture 20: Discrete Fourier Transform and FFT Dec 10, 2001 Prof: J Bilmes TA:

More information

! Break up problem into several parts. ! Solve each part recursively. ! Combine solutions to sub-problems into overall solution.

! Break up problem into several parts. ! Solve each part recursively. ! Combine solutions to sub-problems into overall solution. Divide-and-Conquer Chapter 5 Divide and Conquer Divide-and-conquer.! Break up problem into several parts.! Solve each part recursively.! Combine solutions to sub-problems into overall solution. Most common

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 9 Divide and Conquer Merge sort Counting Inversions Binary Search Exponentiation Solving Recurrences Recursion Tree Method Master Theorem Sofya Raskhodnikova S. Raskhodnikova;

More information

Parallel Integer Polynomial Multiplication Changbo Chen, Svyatoslav Parallel Integer Covanov, Polynomial FarnamMultiplication

Parallel Integer Polynomial Multiplication Changbo Chen, Svyatoslav Parallel Integer Covanov, Polynomial FarnamMultiplication Parallel Integer Polynomial Multiplication Parallel Integer Polynomial Multiplication Changbo Chen 1 Svyatoslav Covanov 2,3 Farnam Mansouri 2 Marc Moreno Maza 2 Ning Xie 2 Yuzhen Xie 2 1 Chinese Academy

More information

Parallelism in Computer Arithmetic: A Historical Perspective

Parallelism in Computer Arithmetic: A Historical Perspective Parallelism in Computer Arithmetic: A Historical Perspective 21s 2s 199s 198s 197s 196s 195s Behrooz Parhami Aug. 218 Parallelism in Computer Arithmetic Slide 1 University of California, Santa Barbara

More information

Integer multiplication and the truncated product problem

Integer multiplication and the truncated product problem Integer multiplication and the truncated product problem David Harvey Arithmetic Geometry, Number Theory, and Computation MIT, August 2018 University of New South Wales Political update from Australia

More information

Chapter 5 Divide and Conquer

Chapter 5 Divide and Conquer CMPT 705: Design and Analysis of Algorithms Spring 008 Chapter 5 Divide and Conquer Lecturer: Binay Bhattacharya Scribe: Chris Nell 5.1 Introduction Given a problem P with input size n, P (n), we define

More information

CS483 Design and Analysis of Algorithms

CS483 Design and Analysis of Algorithms CS483 Design and Analysis of Algorithms Lecture 6-8 Divide and Conquer Algorithms Instructor: Fei Li lifei@cs.gmu.edu with subject: CS483 Office hours: STII, Room 443, Friday 4:00pm - 6:00pm or by appointments

More information

CPSC 518 Introduction to Computer Algebra Schönhage and Strassen s Algorithm for Integer Multiplication

CPSC 518 Introduction to Computer Algebra Schönhage and Strassen s Algorithm for Integer Multiplication CPSC 518 Introduction to Computer Algebra Schönhage and Strassen s Algorithm for Integer Multiplication March, 2006 1 Introduction We have now seen that the Fast Fourier Transform can be applied to perform

More information

PUTTING FÜRER ALGORITHM INTO PRACTICE WITH THE BPAS LIBRARY. (Thesis format: Monograph) Linxiao Wang. Graduate Program in Computer Science

PUTTING FÜRER ALGORITHM INTO PRACTICE WITH THE BPAS LIBRARY. (Thesis format: Monograph) Linxiao Wang. Graduate Program in Computer Science PUTTING FÜRER ALGORITHM INTO PRACTICE WITH THE BPAS LIBRARY. (Thesis format: Monograph) by Linxiao Wang Graduate Program in Computer Science A thesis submitted in partial fulfillment of the requirements

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Divide-and-Conquer Chapter 5 Divide and Conquer Divide-and-conquer. Break up problem into several parts. Solve each part recursively. Combine solutions to sub-problems into overall solution. Most common

More information

Divide and Conquer. Maximum/minimum. Median finding. CS125 Lecture 4 Fall 2016

Divide and Conquer. Maximum/minimum. Median finding. CS125 Lecture 4 Fall 2016 CS125 Lecture 4 Fall 2016 Divide and Conquer We have seen one general paradigm for finding algorithms: the greedy approach. We now consider another general paradigm, known as divide and conquer. We have

More information

Implementation of the DKSS Algorithm for Multiplication of Large Numbers

Implementation of the DKSS Algorithm for Multiplication of Large Numbers Implementation of the DKSS Algorithm for Multiplication of Large Numbers Christoph Lüders Universität Bonn Institut für Informatik Bonn, Germany chris@cfos.de ABSTRACT The Schönhage-Strassen algorithm

More information

Toeplitz matrices. Niranjan U N. May 12, NITK, Surathkal. Definition Toeplitz theory Computational aspects References

Toeplitz matrices. Niranjan U N. May 12, NITK, Surathkal. Definition Toeplitz theory Computational aspects References Toeplitz matrices Niranjan U N NITK, Surathkal May 12, 2010 Niranjan U N (NITK, Surathkal) Linear Algebra May 12, 2010 1 / 15 1 Definition Toeplitz matrix Circulant matrix 2 Toeplitz theory Boundedness

More information

Three Ways to Test Irreducibility

Three Ways to Test Irreducibility Three Ways to Test Irreducibility Richard P. Brent Australian National University joint work with Paul Zimmermann INRIA, Nancy France 12 Feb 2009 Outline Polynomials over finite fields Irreducibility criteria

More information

Chapter 6 Randomization Algorithm Theory WS 2012/13 Fabian Kuhn

Chapter 6 Randomization Algorithm Theory WS 2012/13 Fabian Kuhn Chapter 6 Randomization Algorithm Theory WS 2012/13 Fabian Kuhn Randomization Randomized Algorithm: An algorithm that uses (or can use) random coin flips in order to make decisions We will see: randomization

More information

shelat 16f-4800 sep Matrix Mult, Median, FFT

shelat 16f-4800 sep Matrix Mult, Median, FFT L5 shelat 16f-4800 sep 23 2016 Matrix Mult, Median, FFT merge-sort (A, p, r) if p

More information

Chapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 5 Divide and Conquer CLRS 4.3 Slides by Kevin Wayne. Copyright 25 Pearson-Addison Wesley. All rights reserved. Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve

More information

Space- and Time-Efficient Polynomial Multiplication

Space- and Time-Efficient Polynomial Multiplication Space- and Time-Efficient Polynomial Multiplication Daniel S. Roche Symbolic Computation Group School of Computer Science University of Waterloo ISSAC 2009 Seoul, Korea 30 July 2009 Univariate Polynomial

More information

Three Ways to Test Irreducibility

Three Ways to Test Irreducibility Outline Three Ways to Test Irreducibility Richard P. Brent Australian National University joint work with Paul Zimmermann INRIA, Nancy France 8 Dec 2008 Polynomials over finite fields Irreducibility criteria

More information

Fast, Parallel Algorithm for Multiplying Polynomials with Integer Coefficients

Fast, Parallel Algorithm for Multiplying Polynomials with Integer Coefficients , July 4-6, 01, London, UK Fast, Parallel Algorithm for Multiplying Polynomials with Integer Coefficients Andrzej Chmielowiec Abstract This paper aims to develop and analyze an effective parallel algorithm

More information

arxiv: v1 [cs.na] 8 Feb 2016

arxiv: v1 [cs.na] 8 Feb 2016 Toom-Coo Multiplication: Some Theoretical and Practical Aspects arxiv:1602.02740v1 [cs.na] 8 Feb 2016 M.J. Kronenburg Abstract Toom-Coo multiprecision multiplication is a well-nown multiprecision multiplication

More information

Transforms and Orthogonal Bases

Transforms and Orthogonal Bases Orthogonal Bases Transforms and Orthogonal Bases We now turn back to linear algebra to understand transforms, which map signals between different domains Recall that signals can be interpreted as vectors

More information

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences. MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences. Congruences Let n be a postive integer. The integers a and b are called congruent modulo n if they have the same

More information

4.3 The Discrete Fourier Transform (DFT) and the Fast Fourier Transform (FFT)

4.3 The Discrete Fourier Transform (DFT) and the Fast Fourier Transform (FFT) CHAPTER. TIME-FREQUECY AALYSIS: FOURIER TRASFORMS AD WAVELETS.3 The Discrete Fourier Transform (DFT and the Fast Fourier Transform (FFT.3.1 Introduction In this section, we discuss some of the mathematics

More information

Elliptic Curves Spring 2013 Lecture #3 02/12/2013

Elliptic Curves Spring 2013 Lecture #3 02/12/2013 18.783 Elliptic Curves Spring 2013 Lecture #3 02/12/2013 3.1 Arithmetic in finite fields To make explicit computations with elliptic curves over finite fields, we need to know how to perform arithmetic

More information

Faster integer multiplication using short lattice vectors

Faster integer multiplication using short lattice vectors Faster integer multiplication using short lattice vectors David Harvey and Joris van der Hoeven ANTS XIII, University of Wisconsin, Madison, July 2018 University of New South Wales / CNRS, École Polytechnique

More information

Radix-4 Factorizations for the FFT with Ordered Input and Output

Radix-4 Factorizations for the FFT with Ordered Input and Output Radix-4 Factorizations for the FFT with Ordered Input and Output Vikrant 1, Ritesh Vyas 2, Sandeep Goyat 3, Jitender Kumar 4, Sandeep Kaushal 5 YMCA University of Science & Technology, Faridabad (Haryana),

More information

Algorithms and Data Structures

Algorithms and Data Structures Charles A. Wuethrich Bauhaus-University Weimar - CogVis/MMC June 1, 2017 1/44 Space reduction mechanisms Range searching Elementary Algorithms (2D) Raster Methods Shell sort Divide and conquer Quicksort

More information

University of the Virgin Islands, St. Thomas January 14, 2015 Algorithms and Programming for High Schoolers. Lecture 5

University of the Virgin Islands, St. Thomas January 14, 2015 Algorithms and Programming for High Schoolers. Lecture 5 University of the Virgin Islands, St. Thomas January 14, 2015 Algorithms and Programming for High Schoolers Numerical algorithms: Lecture 5 Today we ll cover algorithms for various numerical problems:

More information

Old and new algorithms for computing Bernoulli numbers

Old and new algorithms for computing Bernoulli numbers Old and new algorithms for computing Bernoulli numbers University of New South Wales 25th September 2012, University of Ballarat Bernoulli numbers Rational numbers B 0, B 1,... defined by: x e x 1 = n

More information

The tangent FFT. Daniel J. Bernstein

The tangent FFT. Daniel J. Bernstein The tangent FFT Daniel J. Bernstein Department of Mathematics, Statistics, and Computer Science (M/C 249) University of Illinois at Chicago, Chicago, IL 60607 7045, USA djb@cr.yp.to Abstract. The split-radix

More information

Algorithms and data structures

Algorithms and data structures Algorithms and data structures Amin Coja-Oghlan LFCS Complex numbers Roots of polynomials A polynomial of degree d is a function of the form p(x) = d a i x i with a d 0. i=0 There are at most d numbers

More information

ELEG 305: Digital Signal Processing

ELEG 305: Digital Signal Processing ELEG 5: Digital Signal Processing Lecture 6: The Fast Fourier Transform; Radix Decimatation in Time Kenneth E. Barner Department of Electrical and Computer Engineering University of Delaware Fall 8 K.

More information

Problem Set 8 - Solution

Problem Set 8 - Solution Problem Set 8 - Solution Jonasz Słomka Unless otherwise specified, you may use MATLAB to assist with computations. provide a print-out of the code used and its output with your assignment. Please 1. More

More information

RSA Implementation. Oregon State University

RSA Implementation. Oregon State University RSA Implementation Çetin Kaya Koç Oregon State University 1 Contents: Exponentiation heuristics Multiplication algorithms Computation of GCD and Inverse Chinese remainder algorithm Primality testing 2

More information

feb abhi shelat FFT,Median

feb abhi shelat FFT,Median L8 feb 16 2016 abhi shelat FFT,Median merge-sort (A, p, r) if pn B[k] A[i];

More information

Sequential Fast Fourier Transform

Sequential Fast Fourier Transform Sequential Fast Fourier Transform Departement Computerwetenschappen Room 03.018 (Celestijnenlaan 200A) albert-jan.yzelman@cs.kuleuven.be Includes material from slides by Prof. dr. Rob H. Bisseling Applications

More information

CSE 421 Algorithms: Divide and Conquer

CSE 421 Algorithms: Divide and Conquer CSE 42 Algorithms: Divide and Conquer Larry Ruzzo Thanks to Richard Anderson, Paul Beame, Kevin Wayne for some slides Outline: General Idea algorithm design paradigms: divide and conquer Review of Merge

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. Prof. R. Fateman

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. Prof. R. Fateman UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS 282 Spring, 2000 Prof. R. Fateman The (finite field) Fast Fourier Transform 0. Introduction

More information

CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication

CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication Integer multiplication Say we have 5 baskets with 8 apples in each How do we determine how many apples we have? Count them all? That would take

More information

Faster arithmetic for number-theoretic transforms

Faster arithmetic for number-theoretic transforms University of New South Wales 7th October 2011, Macquarie University Plan for talk 1. Review number-theoretic transform (NTT) 2. Discuss typical butterfly algorithm 3. Improvements to butterfly algorithm

More information

Today. Polynomials. Secret Sharing.

Today. Polynomials. Secret Sharing. Today. Polynomials. Secret Sharing. A secret! I have a secret! A number from 0 to 10. What is it? Any one of you knows nothing! Any two of you can figure it out! Example Applications: Nuclear launch: need

More information

CS168: The Modern Algorithmic Toolbox Lecture #11: The Fourier Transform and Convolution

CS168: The Modern Algorithmic Toolbox Lecture #11: The Fourier Transform and Convolution CS168: The Modern Algorithmic Toolbox Lecture #11: The Fourier Transform and Convolution Tim Roughgarden & Gregory Valiant May 8, 2015 1 Intro Thus far, we have seen a number of different approaches to

More information

The Discrete Fourier transform

The Discrete Fourier transform 453.70 Linear Systems, S.M. Tan, The University of uckland 9- Chapter 9 The Discrete Fourier transform 9. DeÞnition When computing spectra on a computer it is not possible to carry out the integrals involved

More information

Group-theoretic approach to Fast Matrix Multiplication

Group-theoretic approach to Fast Matrix Multiplication Jenya Kirshtein 1 Group-theoretic approach to Fast Matrix Multiplication Jenya Kirshtein Department of Mathematics University of Denver Jenya Kirshtein 2 References 1. H. Cohn, C. Umans. Group-theoretic

More information

18.085: Summer 2016 Due: 3 August 2016 (in class) Problem Set 8

18.085: Summer 2016 Due: 3 August 2016 (in class) Problem Set 8 Problem Set 8 Unless otherwise specified, you may use MATLAB to assist with computations. provide a print-out of the code used and its output with your assignment. Please 1. More on relation between Fourier

More information

Even faster integer multiplication

Even faster integer multiplication Even faster integer multiplication DAVID HARVEY School of Mathematics and Statistics University of New South Wales Sydney NSW 2052 Australia Email: d.harvey@unsw.edu.au JORIS VAN DER HOEVEN a, GRÉGOIRE

More information

x 9 or x > 10 Name: Class: Date: 1 How many natural numbers are between 1.5 and 4.5 on the number line?

x 9 or x > 10 Name: Class: Date: 1 How many natural numbers are between 1.5 and 4.5 on the number line? 1 How many natural numbers are between 1.5 and 4.5 on the number line? 2 How many composite numbers are between 7 and 13 on the number line? 3 How many prime numbers are between 7 and 20 on the number

More information

Lecture 3: Divide and Conquer: Fast Fourier Transform

Lecture 3: Divide and Conquer: Fast Fourier Transform Lecture 3: Divide ad Coquer: Fast Fourier Trasform Polyomial Operatios vs. Represetatios Divide ad Coquer Algorithm Collapsig Samples / Roots of Uity FFT, IFFT, ad Polyomial Multiplicatio Polyomial operatios

More information

The New Largest Known Prime is 2 p 1 With p = Who Cares? Sam Wagstaff Computer Sciences and Mathematics.

The New Largest Known Prime is 2 p 1 With p = Who Cares? Sam Wagstaff Computer Sciences and Mathematics. The New Largest Known Prime is 2 p 1 With p = 74207281. Who Cares? Sam Wagstaff Computer Sciences and Mathematics November 10, 2016 Earlier in 2016, Cooper, Woltman, Kurowski, Blosser and GIMPS found this

More information

Output-sensitive algorithms for sumset and sparse polynomial multiplication

Output-sensitive algorithms for sumset and sparse polynomial multiplication Output-sensitive algorithms for sumset and sparse polynomial multiplication Andrew Arnold Cheriton School of Computer Science University of Waterloo Waterloo, Ontario, Canada Daniel S. Roche Computer Science

More information

MA441: Algebraic Structures I. Lecture 18

MA441: Algebraic Structures I. Lecture 18 MA441: Algebraic Structures I Lecture 18 5 November 2003 1 Review from Lecture 17: Theorem 6.5: Aut(Z/nZ) U(n) For every positive integer n, Aut(Z/nZ) is isomorphic to U(n). The proof used the map T :

More information

Large Integer Multiplication on Hypercubes. Barry S. Fagin Thayer School of Engineering Dartmouth College Hanover, NH

Large Integer Multiplication on Hypercubes. Barry S. Fagin Thayer School of Engineering Dartmouth College Hanover, NH Large Integer Multiplication on Hypercubes Barry S. Fagin Thayer School of Engineering Dartmouth College Hanover, NH 03755 barry.fagin@dartmouth.edu Large Integer Multiplication 1 B. Fagin ABSTRACT Previous

More information

arxiv: v3 [cs.sc] 19 Sep 2008

arxiv: v3 [cs.sc] 19 Sep 2008 Fast Integer Multiplication Using Modular Arithmetic arxiv:0801.1416v3 [cs.sc] 19 Sep 2008 Anindya De, Piyush P Kurur, Chandan Saha Dept. of Computer Science and Engineering Indian Institute of Technology,

More information

arithmetic properties of weighted catalan numbers

arithmetic properties of weighted catalan numbers arithmetic properties of weighted catalan numbers Jason Chen Mentor: Dmitry Kubrak May 20, 2017 MIT PRIMES Conference background: catalan numbers Definition The Catalan numbers are the sequence of integers

More information

Fast reversion of formal power series

Fast reversion of formal power series Fast reversion of formal power series Fredrik Johansson LFANT, INRIA Bordeaux RAIM, 2016-06-29, Banyuls-sur-mer 1 / 30 Reversion of power series F = exp(x) 1 = x + x 2 2! + x 3 3! + x 4 G = log(1 + x)

More information

Lecture 2: Number Representations (2)

Lecture 2: Number Representations (2) Lecture 2: Number Representations (2) ECE 645 Computer Arithmetic 1/29/08 ECE 645 Computer Arithmetic Lecture Roadmap Number systems (cont'd) Floating point number system representations Residue number

More information

Lecture 01 August 31, 2017

Lecture 01 August 31, 2017 Sketching Algorithms for Big Data Fall 2017 Prof. Jelani Nelson Lecture 01 August 31, 2017 Scribe: Vinh-Kha Le 1 Overview In this lecture, we overviewed the six main topics covered in the course, reviewed

More information

Mid-term Exam Answers and Final Exam Study Guide CIS 675 Summer 2010

Mid-term Exam Answers and Final Exam Study Guide CIS 675 Summer 2010 Mid-term Exam Answers and Final Exam Study Guide CIS 675 Summer 2010 Midterm Problem 1: Recall that for two functions g : N N + and h : N N +, h = Θ(g) iff for some positive integer N and positive real

More information