320 likes | 746 Views
Algorithms for the Maximum Subarray Problem Based on Matrix Multiplication. Authours : Hisao Tamaki & Takeshi Tokuyama Speaker : Rung-Ren Lin. Outline. Introduction ½ -approximation Funny matrix multiplication Reduction Two little programs. Introduction ½ -approximation
E N D
Algorithms for the Maximum Subarray Problem Based on Matrix Multiplication Authours:Hisao Tamaki & Takeshi Tokuyama Speaker:Rung-Ren Lin
Outline • Introduction • ½-approximation • Funny matrix multiplication • Reduction • Two little programs
Introduction • ½-approximation • Funny matrix multiplication • Reduction • Two little programs
Definition • Given an m by n matrix, output the maximum subarray.
History • Bentley proposes this problem in 1984. • Kadane’s algorithm solves 1-D problem in linear time. • Kadane’s idea does not work for the 2-D case. • There’s an O(m2n) algorithm by using Kadane’s idea.
Kadane’s algorithm i S(i) = A(i) + max{S(i-1), 0}
Preprocessing • Given a matrix A[1…m][1…n], we can compute B[1…m][1…n] in O(mn) time such that B[i][j] represents the sum of A[1…i][1…j].
Introduction • ½-approximation • Funny matrix multiplication • Reduction • Two little programs
m n Time = mn/2 * 2 = mn
m n Time = mn/4 * 4= mn
Time Complexity • O(mn*logm)
Introduction • ½-approximation • Funny matrix multiplication • Reduction • Two little programs
Definition • Given two n by n matrices, Aij & Bij Cij = maxk=1 to n{Aik + Bkj} j j i i A B C
History • Funny matrix multiplication is well-studied, since its computational complexity is known to be equivalent to that of “all-pairs shortest paths”. • Fredman constructs a subcubic algorithm with running time:
Cont’d • Takaoka improved to in 1992.
Introduction • ½-approximation • Funny matrix multiplication • Reduction • Two little programs
Definition • T(m, n):computing time for the m by n matrix • Trow(m, n):row-centered • Tcol(m, n):column-centered T(m, n) = Trow(m, n) + Tcol(m, n) + 4T(m/2, n/2)
Cont’d • Tcenter(m, n):row & column-centered Trow(m, n) = Tcenter(m, n) + 2Trow(m, n/2) Tcol(m, n) = Tcenter(m, n) + 2Tcol(m/2, n)
Reduction B A C D
Cont’d • Let A, B, C, D[1…m/2][1…n/2] be the sum of the given area. Xij = maxk=1 to m/2{Aik + Cjk} Yij = maxk=1 to m/2{Bik + Djk} output = max{Xij + Yij}
Introduction • ½-approximation • Funny matrix multiplication • Reduction • Two little programs
Challenges • It’s difficult to search 3-D models.