Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In class, we saw Karatsuba s algorithm which was a way to speed up the computation of a b for two n - bit integers

In class, we saw Karatsubas algorithm which was a way to speed up the computation of a b
for two n-bit integers a and b. In this problem, we analyse an algorithm for multiplying two
2
CSC236H1Y 20245 Last updated: July 4,2024
upper-triangular 1 matrices abbreviated UT matrices. See Algorithm 2. The standard approach for
multiplying two matrices is shown below for two 2\times 2 matrices.
A B =
a1,1 a1,2
a2,1 a2,2
b1,1 b1,2
b2,1 b2,2
=
a1,1b1,1+ a1,2b2,1 a1,1b1,2+ a1,2b2,2
a2,1b1,1+ a2,2b2,1 a2,1b1,2+ a2,2b2,2
For ease of explanation, if the inputs A and B to Algorithm 2, Algorithm 3, and Algorithm 4 have
dimension n \times n, then let n be a power of two. In practice, we can always pad the matrix with
rows and columns of all zeros so that this is the case.
Note that the notation A[i : j, : k] represents the submatrix of A consisting of the rows i to j
inclusive and columns to k inclusive. For A and B, let A11= A[1 : n/2,1 : n/2], A12= A[1 :
n/2,(n/2+1) : n], A21= A[(n/2+1) : n,1 : n/2], and A22= A[(n/2+1) : n,(n/2+1) : n]. Bij
are defined similarly for i, j in [2].
The time it takes to multiple two constant dimension matrices is constant time.
Algorithm 2 multiplyTT(A : UT matrix, B : UT matrix)-> UT matrix
Require: A and B are two upper-triangular matrices.
Ensure: Outputs A B.
1: if n =1 then return A B
2: end if
3: M1 multiplyTT(A11, B11)
4: M2 multiplyTM(A11, B12)+ multiplyMT(A12, B22)
5: M3 multiplyTT(A22, B22)
6: return
M1 M2
0 M3
Algorithm 3 multiplyTM(A : UT matrix, B : matrix)-> matrix
Require: A is an upper-triangular matrix and B is a matrix.
Ensure: Outputs A B.
1: if n =1 then return A B
2: end if
3: M1 multiplyTM(A11, B11)+ multiply(A12, B21)
4: M2 multiplyTM(A11, B12)+ multiply(A12, B22)
5: M3 multiplyTM(A22, B21)
6: M4 multiplyTM(A22, B22)
7: return
M1 M2
M3 M\

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions