17 - Matrix Multiplication Data Structures and Algorithms...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Matrix Multiplication Data Structures and Algorithms Andrei Bulatov
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Algorithms – Matrix Multiplication 17-2 Matrix Multiplication Matrix multiplication . Given two n-by-n matrices A and B, compute C = A B. = = n k kj ik ij b a c 1 Brute force. arithmetic operations. Fundamental question. Can we improve upon brute force? × = nn n n n n nn n n n n nn n n n n b b b b b b b b b a a a a a a a a a c c c c c c c c c L M O M M L L L M O M M L L L M O M M L L 2 1 2 22 21 1 12 11 2 1 2 22 21 1 12 11 2 1 2 22 21 1 12 11 ) ( 3 n Θ
Background image of page 2
Algorithms – Matrix Multiplication 17-3 Matrix Multiplication: Divide and Conquer Divide: partition A and B into ½n-by-½n blocks. Conquer: multiply 8 ½n-by-½n recursively. Combine: add appropriate products using 4 matrix additions. × = 12 11 12 11 12 11 B B A A C C ( 29 ( 29 ( 29 ( 29 ( 29 ( 29 ( 29 ( 29 22 22 12 21 22 21 22 11 21 21 22 12 12 11 12 21 12 11 11 11 B A B A C B A B A C B A B A C B A B A C × + × = × + × = × + × = × + × = 22 21 22 21 22 21 B B A A C C ( 29 ) ( ) T( ) ( 2 / 8 ) T( 3 s submatrice form add, 2 calls recursive n n n n T n Θ = Θ + = 3 2 1 43 42 1
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Algorithms – Matrix Multiplication 17-4 Better Divide and Conquer Key idea: multiply 2-by-2 block matrices with only 7 multiplications. × = 22 21 12 11 22 21 12 11 22 21 12 11 B B B B A A A A C C C C ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( 12 11 21 11 7 22 21 22 12 6 22 11 22 11 5 11 21 22 4 11 22 21 3 22 12 11 2 22 12 11 1 B B A A P B B A A P B B A A P B B A P B A A P B A A P B B A P + × - = + × - = + × + = - × = × + = × + = - × = 7 3 1 5 22 4 3 21 2 1 12 6 2 4 5 11 P P P P C P P C P P C P P P P C - - + = + = + = + - + =
Background image of page 4
Algorithms – Matrix Multiplication 17-5 Fast Matrix Multiplication Fast matrix multiplication . (Strassen, 1969) Divide: partition A and B into ½n-by-½n blocks. Compute:
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/19/2009 for the course CS CMPT 307 taught by Professor A.bulatov during the Fall '09 term at Simon Fraser.

Page1 / 22

17 - Matrix Multiplication Data Structures and Algorithms...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online