算法设计(分治法-大整数、矩阵相乘)_48286.ppt

算法设计(分治法-大整数、矩阵相乘)_48286.ppt

  1. 1、本文档共28页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
算法设计(分治法-大整数、矩阵相乘)_48286

2007-2008-01《Design and Analysis of Algorithms》SCUEC Review of last class The difference between quick sort and merge sort Goals of the Lecture At the end of this lecture, you should Understand the algorithm based on DAC for solving large integers’ multiplication and its analysis Master the Strassen’s matrix multiplication algorithm and its analysis Know how to solve the triomino puzzle Multiplication of Large Integers The grade-school algorithm: a1 a2 … an b1 b2 … bn (d10) d11d12 … d1n (d20) d21d22 … d2n … … … … … … … (dn0) dn1dn2 … dnn Standard Algorithm based on DAC Improved Algorithm based on DAC Multiplication of Matrices Time complexity: T(n) = n3 + (n3 – n2) Standard Algorithm Based on Divide and Conquer Technique (I) Suppose we want to multiply matrices A and B, both of size n?n, and n = 2k, we can use divide and conquer technique to solve it. Standard Algorithm Based on Divide and Conquer Technique (II) So the result consists of computing C as defined by the following equation: Analysis of the algorithm Number of multiplications and additions T(n) = 8T(n/2) + 4(n/2)2 if n=2 T(1) = 1 Strassen’s Matrix Mutiplication Uses a set of seven formulas to multiply two 2?2 matrices The formulas do not rely on elements being commutative under multiplication, so the elements can be matrices It can be applied recursively, in other words, two 4 ? 4 matrices can be multiplied by treating each as a 2 ? 2 matrix of 2 ? 2 matrices Strassen’s Formulas (I) First we calculate a set of temporary values: m1 = (A1,1 + A2,2) * (B1,1 + B2,2) m2 = (A2,1 + A2,2) * B1,1 m3 = A1,1 * (B1,2 - B2,2) m4 = A2,2 * (B2,1 - B1,1) m5 = (A1,1 + A1,2) * B2,2 m6 = (A2,1 - A1,1) * (B1,1 + B1,2) m7 = (A1,2 - A2,2) * (B2,1 + B2,2) Strassen’s Formulas (II) Can you write out the strassen’s algorithm? (description) Algorithm analysis These formulas require 7 multiplications and 18 additions to multiply two 2 ? 2 matrices Standard vs DAC vs Strasse

您可能关注的文档

文档评论(0)

ustt002 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档