Tasksheet 7:Solved

$24.99 $18.99

  Task 1. Computing products of matrices with OpenMP. You should have a routine for computing the product of two matrices with real number of entries. If the code is not written in C, create a version of the code in C. Then modify the C code to be done in parallel using OpenMP. You…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

 

Task 1. Computing products of matrices with OpenMP.

You should have a routine for computing the product of two matrices with real number of entries. If the code is not written in C, create a version of the code in C. Then modify the C code to be done in parallel using OpenMP. You can use the dot-product version of the matrix multiplication. That is, the inner most loop represents a dot product.

Task 2. Now you get to write code.

Suppose we have two vectors, u and v, of length n. The Hadamard product of these vectors is the component wise product of the vectors. That is if

w = u : v

if wi = ui vi. Write a serial code that implements the Hadamard product of two vectors of length n. Note that the input to the routine should be two vectors of equal length and the output is a vector of the same length.

Task 3. OpenMP Version of the Hadamard Product.

Implement a parallel version of the Hadamard product of two vectors. If you look around the internet at all, this is an example used to illustrate parallelism in OpenMP.

Task 4. Generalization of the Hadamard Product to Matrices.

The Hadamard product can also be applied to two matrices of the same size. So,

  • = Ai,j Bi,j

if Ci,j where the component multiplication is just the product of two real

numbers. You should test the code on really large sizes of matrices or at least as big as possible.

Task 5. Outer Products of Vectors/Matrices

Find sites off the internet that define and discuss the outer product of two vectors and implement an algorithm to create the outer product of two vectors. Can this be extended to matrices. What are the restrictions on the matrices. How would you implement an algorithm for the outer product of two vectors in parallel.

Tasksheet 7:Solved
$24.99 $18.99