Another Randomized Algorithm

Slides:



Advertisements
Similar presentations
Sublinear Algorithms … Lecture 23: April 20.
Advertisements

CSCI 3160 Design and Analysis of Algorithms Tutorial 4
WS Algorithmentheorie 03 – Randomized Algorithms (Primality Testing) Prof. Dr. Th. Ottmann.
Divide-and-Conquer Matrix multiplication and Strassen’s algorithm Median Problem –In general finding the kth largest element of an unsorted list of numbers.
DIVIDE AND CONQUER APPROACH. General Method Works on the approach of dividing a given problem into smaller sub problems (ideally of same size).  Divide.
1 Dynamic Programming Jose Rolim University of Geneva.
Theoretical Program Checking Greg Bronevetsky. Background The field of Program Checking is about 13 years old. Pioneered by Manuel Blum, Hal Wasserman,
1 Reduction between Transitive Closure & Boolean Matrix Multiplication Presented by Rotem Mairon.
© 2004 Goodrich, Tamassia Sorting Lower Bound1. © 2004 Goodrich, Tamassia Sorting Lower Bound2 Comparison-Based Sorting (§ 10.3) Many sorting algorithms.
Algorithm Design Strategy Divide and Conquer. More examples of Divide and Conquer  Review of Divide & Conquer Concept  More examples  Finding closest.
Totally Unimodular Matrices Lecture 11: Feb 23 Simplex Algorithm Elliposid Algorithm.
1 Fast Sparse Matrix Multiplication Raphael Yuster Haifa University (Oranim) Uri Zwick Tel Aviv University ESA 2004.
Algorithms in Exponential Time. Outline Backtracking Local Search Randomization: Reducing to a Polynomial-Time Case Randomization: Permuting the Evaluation.
1 Finding cycles using rectangular matrix multiplication and dynamic programming Raphael Yuster Haifa Univ. - Oranim Uri Zwick Tel Aviv University Uri.
Towards Communication Avoiding Fast Algorithm for Sparse Matrix Multiplication Part I: Minimizing arithmetic operations Oded Schwartz CS294, Lecture #21.
1 Matrix Addition, C = A + B Add corresponding elements of each matrix to form elements of result matrix. Given elements of A as a i,j and elements of.
Review of important distributions Another randomized algorithm
Table of Contents Matrices - Multiplication Assume that matrix A is of order m  n and matrix B is of order p  q. To determine whether or not A can be.
1 Fingerprinting techniques. 2 Is X equal to Y? = ? = ?
CPSC 335 Randomized Algorithms Dr. Marina Gavrilova Computer Science University of Calgary Canada.
PROBABILISTIC COMPUTATION By Remanth Dabbati. INDEX  Probabilistic Turing Machine  Probabilistic Complexity Classes  Probabilistic Algorithms.
Lecture 10. Paradigm #8: Randomized Algorithms Back to the “majority problem” (finding the majority element in an array A). FIND-MAJORITY(A, n) while (true)
8.2 Operations With Matrices
Chapter 1 Section 1.5 Matrix Operations. Matrices A matrix (despite the glamour of the movie) is a collection of numbers arranged in a rectangle or an.
Sorting Fundamental Data Structures and Algorithms Aleks Nanevski February 17, 2004.
1.7 Linear Independence. in R n is said to be linearly independent if has only the trivial solution. in R n is said to be linearly dependent if there.
Young CS 331 D&A of Algo. Topic: Divide and Conquer1 Divide-and-Conquer General idea: Divide a problem into subprograms of the same kind; solve subprograms.
3.6 Multiplying Matrices Homework 3-17odd and odd.
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
Multiplication Timed Tests.
PROBABILITY AND COMPUTING RANDOMIZED ALGORITHMS AND PROBABILISTIC ANALYSIS CHAPTER 1 IWAMA and ITO Lab. M1 Sakaidani Hikaru 1.
Machine Learning: Ensemble Methods
Fundamental Data Structures and Algorithms
13.4 Product of Two Matrices
Lap Chi Lau we will only use slides 4 to 19
ECE 3301 General Electrical Engineering
Multidimensional Arrays
Topics in Algorithms Lap Chi Lau.
Dynamic Array Multidimensional Array Matric Operation with Array
Matrix Multiplication
Complex Eigenvalues Prepared by Vince Zaccone
Section 7.4 Matrix Algebra.
CSCE 411 Design and Analysis of Algorithms
Unit-2 Divide and Conquer
Another Randomized Algorithm
8/04/2009 Many thanks to David Sun for some of the included slides!
Topic: Divide and Conquer
Sorting.
Merge Sort 1/12/2019 5:31 PM Dynamic Programming Dynamic Programming.
Objectives Multiply two matrices.
Raphael Yuster Haifa University Uri Zwick Tel Aviv University
Dynamic Programming Dynamic Programming 1/18/ :45 AM
Dynamic Programming Merge Sort 1/18/ :45 AM Spring 2007
Warm-Up 3) 1) 4) Name the dimensions 2).
Fast Sparse Matrix Multiplication
Topic: Divide and Conquer
3.6 Multiply Matrices.
Richard Anderson Lecture 14 Divide and Conquer
Matrix Addition, C = A + B Add corresponding elements of each matrix to form elements of result matrix. Given elements of A as ai,j and elements of B as.
Topic: Divide and Conquer
Richard Anderson Lecture 14, Winter 2019 Divide and Conquer
Dynamic Programming Merge Sort 5/23/2019 6:18 PM Spring 2008
Design and Analysis of Algorithms
Richard Anderson Lecture 14 Divide and Conquer
Randomized Algorithms
Matrix Multiplication Sec. 4.2
Randomized Algorithms
Matrices - Operations MULTIPLICATION OF MATRICES
Presentation transcript:

Another Randomized Algorithm Freivalds’ Algorithm for Matrix Multiplication

Randomized Algorithms Quicksort makes effective use of random numbers, but is no faster than Mergesort or Heapsort. Here we will see a problem that has a simple randomized algorithm faster than any known deterministic solution.

Matrix Multiplication Multiplying nn matrices (n = 2 in this example) 𝑎 𝑏 𝑐 𝑑 𝑤 𝑥 𝑦 𝑧 = 𝑎𝑤+𝑏𝑦 𝑎𝑥+𝑏𝑧 𝑐𝑤+𝑑𝑦 𝑐𝑥+𝑑𝑧 Complexity of straightforward algorithm: Θ(n3) time (There are 8 multiplications here; in general, n multiplications for each of n2 entries) Coppersmith & Winograd showed how to do it in time O(n2.376) in 1989. Williams improved this to O(n2.3729) in 2011. Progress!

History of Matrix Multiplication Algorithms Running time: O(nω)

Freivalds’ Algorithm (1977) Freivalds’ variant of problem: Determine whether n  n matrices A, B, and C satisfy the condition AB = C Method: Choose x  {0,1}n randomly and uniformly (vector of length n) If ABx ≠ Cx then report “AB ≠ C” else report “AB = C probably”

Running Time ABx = A(Bx), so we have 3 instances of an n  n matrix times an n-vector These are O(n2) time operations if done straightforwardly Total running time O(n2) Fastest deterministic solution known: O(n2.3729)

How Often Is It Wrong? Case 1: AB = C. Then P(ABx = Cx) = 1. Case 2: AB  C . Then P(ABx = Cx) ≤ ½, as follows: Assume AB  C Then AB - C  0, so there exist i, j with (AB - C)ij  0 Let (d1, d2, …, dn) be i-th row of AB - C; dj  0 P((AB - C) x = 0) ≤ P( 𝑘=1 𝑛 dk x𝑘 = 0) = P(xj = − 1 dj 𝑘≠𝑗 dk x𝑘 ) ≤ ½

Decreasing the Probability of Error By iterating with k random, independent choices of x, we can decrease probability of error to 1/2k, using time O(kn2). Interesting comparison Quicksort is always correct, and runs slowly with small probability. Frievalds’ algorithm is always fast, and incorrect with small probability.