CSCE 411 Lecture 6

From Notes
Jump to navigation Jump to search
Lecture Slides

« previous | Friday, September 7, 2012 | next »


Master Theorem

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle T(n) = a T\left( \frac{n}{b} \right) + f(n)}

We assume Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle a \ge 1} , , and eventually positive

Note: For case 3, must be regular

Matrix Multiplication

Classic algorithm

for

for i from 1 to n do:

 for j from 1 to k do:
   for t from 1 to m do:
   end for
 end for

end for

Approx

Divide and Conquer

Divide batrices and into four smaller matrices:

  • 8 matrix multiplications on submatrices of and
  • scalar additions

Running Time

  • great, all that work for nothing.

Can we do fewer operations?

Strassen's Matrix

Just calculate 7 products and do a bunch of cheap additions


Integer Multiplication

Elementary school algorithm

Multiplication of 2 -bit numbers takes .

Kolmogrov (at one of his seminars) conjectured that we can't do better, but Karatsuba proved him wrong a week later.

Dividery and Conquery

Split and into two smaller parts: their most significant and least significant parts:

  • , where and are n/2-bit algorithms
  • , where and are n/2-bit algorithms
  • still

What if we multiply ? Just correct the terms:

This has only 3 multiplications, so

Summary of Dividery and Conquery

  1. Split into two parts and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle B}
  2. Split Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle y} into two parts Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle C} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle D}
  3. calculate Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle AC} , Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (A+B)(C+D)} , and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle BD}
  4. shift each of the results by a certain amount and add all of those together