Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the C++ programming language of your choice, implement the matrix multiplication algorithm use the multithreading that we will explaine it down (the one that

Using the C++ programming language of your choice, implement the matrix multiplication algorithm use the multithreading that we will explaine it down (the one that recursively partitions the two n x n matrices which are to be multiplied into n/2 x n/2 matrices). Demonstrate that your algorithm actually runs by multiplying the 2 16 x 16 matrices shown below. When you submit the solution, please include your source code as well as the output for the specified input. Note: you must use multithreading every place that it is reasonable to do so in your program; that includes the 8 sub-matrix recursive multiplication calls, the 4 sub-matrix additions, and the partitioning of the n x n matrices into the various n/2 x n/2 matrices (i.e., those partitions can be created concurrently).

Pleae use the method for the solution:

Matrix Multiplication . Can multiply 2 n x n matrices in O(n2.81) time using Strassens algorithm; Can we do better using multithreading??? . To multiply 2 n x n matrices in the non-Strassens way, we perform 8 matrix multiplications of n/2 x n/2 matrices and 4 additions of n/2 x n/2 matrices; for simplicity, assume n is a power of 2 . Multithreaded algorithm MatrixMultiply(C, A, B, n): // C = A * B, assume n is a power of 2 if (n == 1) C[1][1] = A[1][1] * B[1][1]; else { allocate a temporary matrix T[1..n][1..n]; partition A, B, C, and T into n/2 x n/2 submatrices; spawn MatrixMultiply(C11, A11, B11, n/2); spawn MatrixMultiply(C12, A11, B12, n/2); spawn MatrixMultiply(C21, A21, B11, n/2); spawn MatrixMultiply(C22, A21, B12, n/2); spawn MatrixMultiply(T11, A12, B21, n/2); spawn MatrixMultiply(T12, A12, B22, n/2); spawn MatrixMultiply(T21, A22, B21, n/2); spawn MatrixMultiply(T22, A22, B22, n/2); sync; // wait for spawnd child processes to finish parallel for (i = 1; i

}

image text in transcribedimage text in transcribed

2531710032111090 6031232019108051 3111151100515940 0210461112413130 1320609113122015 8141200717015101 6002100609003101 0211110000020101 1127066010712852 3002835010412543 9421252111312402 5629323112231010 1058444134111211 2347040520106111 3216120001198120

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_2

Step: 3

blur-text-image_3

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions

Question

Why do most AISs try to avoid data transcription?

Answered: 1 week ago

Question

a. What happens to the aggregate demand curve? LOP8

Answered: 1 week ago