0% found this document useful (0 votes)
99 views2 pages

MPI Lab Assignment 2015

The document outlines 9 programming assignments for a parallel and distributed computing lab. The assignments include: 1) Summing array elements, 2) Calculating dot products, 3-4) Numerical integration using trapezoidal and Simpson's 1/3 rules, 5) Lagrange interpolation, 6) Prefix sums, 7) Matrix-matrix multiplication, 8) Polynomial evaluation, 9) Matrix-vector multiplication. Students are asked to write programs to solve each problem.

Uploaded by

Anubhav Sah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views2 pages

MPI Lab Assignment 2015

The document outlines 9 programming assignments for a parallel and distributed computing lab. The assignments include: 1) Summing array elements, 2) Calculating dot products, 3-4) Numerical integration using trapezoidal and Simpson's 1/3 rules, 5) Lagrange interpolation, 6) Prefix sums, 7) Matrix-matrix multiplication, 8) Polynomial evaluation, 9) Matrix-vector multiplication. Students are asked to write programs to solve each problem.

Uploaded by

Anubhav Sah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Department of Computer Sc.

& Engineering
Parallel and Distributed Computing Lab.
Monsoon semester 2015-16

1) Write a program to implement summation of n data values stored in an array.

2) Write a program to calculate the following dot product:

x. y  x0 y0  x1 y1    xn1 y n1

3) The following definite integral of nonnegative function f(x)

b
I   f ( x)dx
a
can be calculated using following trapezoidal rule:

I  h[( f ( x0 )  f ( xn ) / 2  f ( x1 )  f ( x2 )    f ( xn1 )]

where h  (b  a) / n .

Write a program to calculate the definite integral using trapezoidal rule.

4) The following definite integral of nonnegative function f(x)

b
I   f ( x)dx
a

can be calculated using following Simpson’s 1/3 rule:

h
I [( f ( x0 )  4 f ( x1 )  2 f ( x 2 )  4 f ( x3 )    2 f ( x n2 )  4 f ( x n1 )  f ( x n )]
3

where h  (b  a) / n .

Write a program to calculate the definite integral using Simpson’s 1/3 rule.

5) Write a program to compute f(x) using the Lagrange’s interpolation defined as follows :

f ( x)  L0 y0  L1 y1  L2 y 2    Ln1 y n1

( x  x 0 )( x  x1 )( x  x 2 )  ( x  x i 1 )( x  x i 1 )  ( x  x n1 )
Where L 
i ( x i  x 0 )( x i  x1 )( x i  x 2 )  ( x i  x i 1 )( x i  x i 1 )  ( x i  x n1 )
6) Given the data set d0, d1, …, dn-1, the prefix computation needs to calculate

Pi = d0 + d1 + d2 +…+ di , 0  i < n

Write a program for the above prefix computation.

7) Write a program to implement the following matrix-matrix multiplication:

n1
cij   aik bkj , 0  i, j  n
k 0

8) Write a program to compute the polynomial

f  a0 x 0  a1 x1  a2 x 2  an1 x n1

9) Write a program to implement the following matrix-vector multiplication:

c k  a k 0 x0  a k1 x1    a k ,n1 xn1 , k = 0, 1, …, n-1

You might also like