/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q11E In justifying our matrix multipl... [FREE SOLUTION] | 91影视

91影视

In justifying our matrix multiplication algorithm (Section 2.5), we claimed the following block wise property: if X and Y are nnn matrices, and

X=[ABCD],Y=[EFGH],

where A,B,C,D,E,F,G, and H are n/2n/2 sub-matrices, then the product XY can be expressed in terms of these blocks:

XY=[ABCD][EFGH]=[AE+BGAF+BHCE+DGCF+DH]

Prove this property.

Short Answer

Expert verified

Justification of matrix multiplication

Step by step solution

01

Prove:

Environment multiplication

Allowing the following matrices:

X=ABCD and Y=EFGH

X and Y vectors are split into 4 size blocks. n2n2. This combination between X or Y matrix (z) has the following i , j the elements because X and Y were nnmatrices:

Zij=k=1XikYkj where 1i,jn

With each region of both the process of making the product, the specified property may be demonstrated (Z) .

For the sector in which i,jn2:

Zij=X,Yij=K=1nXikYkj=k=1nXikYkj+K=1nXikYkj=K=1n/2AikEkj+K=1n/2BikGkj=AE+BGij

For the sector in which in2and n2jn:

Zij=(XY)ij =K=1nXikYkj=K=1nXikYkj+nk=-+12nXikYkj=K=1n/2AikFkj+K=1n/2BikHkj=AF+BHij

For the sector in which n2inand jn2:

Zij=X,Yij=K=1nXikYkj=k=1nXikYkj+K=1nXikYkj=K=1n/2CikEkj+K=1n/2DikGkj=CE+DGij

For the sector in which n2i,jn :

Zij=X,Yij=K=1nXikYkj=k=1nXikYkj+K=1nXikYkj=K=1n/2CikFkj+K=1n/2DikHkj=CF+DHij

The product of X and Y can be expressed as follows:

Z=Zijwherei,jn2Zijwherein2andn2<jnZijwheren2<inandjn2Zijwheren2<i,jn

Z=AE+BGAF+BHCE+DGCF+DH

Therefore, the given property is proved.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91影视!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Question: On page 66 there is a high-level description of the quicksort algorithm.

(a) Write down the pseudocode for quicksort.

(b) Show that its worst - case running time on an array of size n is (n)2.

(c) Show that its expected running time satisfies the recurrence relation.

T(n)O(n)+1ni=1n-1(Ti+Tn-i)

Then, show that the solution to this recurrence is O(nlogn).

Question: You are given an infinite array A[]in which the first n cells contain integers in sorted order and the rest of the cells are filled with . You are not given the value of n. Describe an algorithm that takes an integer x as input and finds a position in the array containing x, if such a position exists, in O(log n) time. (If you are disturbed by the fact that the array A has infinite length, assume instead that it is of length n, but that you don鈥檛 know this length, and that the implementation of the array data type in your programming language returns the error message whenever elements A[i]withi>n are accessed.)

In Section 2.1 we described an algorithm that multiplies two n-bit binary integers x and y in time na, where a=log23. Call this procedure fast multiply (x,y).

(a) We want to convert the decimal integer 10n(a 1 followed by n zeros) into binary. Here is the algorithm (assume n is a power of 2):

function pwr2bin(n)

if n = 1: return10102

else:

z= ???

return fastmultiply(z,z)

Fill in the missing details. Then give a recurrence relation for the running time of the algorithm, and solve the recurrence.

(b) Next, we want to convert any decimal integer x with n digits (where n is a power of 2) into binary. The algorithm is the following:

function dec2bin(x)

if n=1: return binary [ x ]

else:

split x into two decimal numbers xt,xRwith n/2 digits each

return ???

Here binary [.] is a vector that contains the binary representation of all one-digit integers. That is, binary role="math" localid="1659333641173" [0]=02, binary [1]=12, up to binary [9]=10012. Assume that a lookup in binary takes 0(1) time. Fill in the missing details. Once again, give a recurrence for the running time of the algorithm, and solve it.

You are given two sorted lists of size mandn. Give an O(logm+logn)time algorithm for computing the k th smallest element in the union of the two lists.

Thesquare of a matrix A is its product with itself, AA.

(a) Show that five multiplications are sufficient to compute the square of a 2 x 2 matrix.

(b) What is wrong with the following algorithm for computing the square of an n x n matrix?

鈥淯se a divide-and-conquer approach as in Strassen鈥檚 algorithm, except that instead of getting 7 subproblems of size n2, we now get 5 subproblems of size n2 thanks to part (a). Using the same analysis as in Strassen鈥檚 algorithm, we can conclude that the algorithm runs in time O (nc) .鈥

(c) In fact, squaring matrices is no easier than matrix multiplication. In this part, you will show that if n x n matrices can be squared in time S(n) = O(nc), then any two n x n matrices can be multiplied in time O(nc) .

  1. Given two n x n matrices A and B, show that the matrix AB + BA can be computed in time 3S(n) + O(n2 ) .
  2. Given two n x n matrices X and Y, define the 2n x 2n matrices A and B,L as follows:
    A=X000andB=0Y00
    What is AB + BA, in terms of X and Y?
  3. Using (i) and (ii), argue that the product XY can be computed in time 3S(2n) + O(n2 ). Conclude that matrix multiplication takes time O(nc ).
See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.