C++ Programming Assignment
$30-45 USD
着払い
Background
This exercise is on programming of some statistical functions. No preliminary knowledge of
statistics is required. All necessary concepts are explained in this section.
Standard deviation
Standard deviation is a popular measure of variability or diversity of data used in statistics.
If we have some set of data, each data point being a real or rational number (e.g. hight of
a person expressed in cm), then low standard deviation indicates that the data points tend
to be very close to the mean value, while high standard deviation indicates that the data
points are spread over a large range of values, far away from the mean value.
The standard deviation1 is defined as follows.
For a set of data points X = {x1, x2, . . . , xn} its mean value is mean(X) = x1+x2+...+xn
n .
Then the standard deviation of X is the value
X =
s
(x1 − mean(X))2 + (x2 − mean(X))2 + . . . + (xn − mean(X))2
n
.
Pearson correlation coefficient
Assume now that we have two data sets of equal size X = {x1, . . . , xn} and X = {y1, . . . yn}
and we would like to find out if there is some correlation between the values xi and yi. For
example, if xi and yi represent the height and the weight of a person, respectively, then,
perhaps, there is some correlation. On the other hand, if xi and yi represent the height of a
person and his/her performance in COMP528, then I doubt that there is a correlation.
There are different ways to measure the correlation between two data sets. Perhaps, the
most popular is a Pearson correlation coefficient, which is defined as follows.
For two data sets X = {x1, . . . , xn} and Y = {y1, . . . , yn}, their Pearson coefficient
X,Y =
1
ni=n
i=1 (xi − mean(X)) · (yi − mean(Y ))
X · Y
where X and Y are standard deviations of X and Y , respectively, as defined above. The
Pearson correlation coefficient always has the value in between −1 and 1. The closer it to 1
the more indication of the correlation between data values2.
If you would like to learn more on the standard deviation and Pearson correlation, the
Wikipedia entries are good starting points.
1we use here so called population standard deviation, there are other versions, which are not of our
concern
2notice that Pearson correlation coefficient captures only one type of the correlation that is a linear
dependence
2
Computing the Pearson correlation coefficient
asks you to write a program computing Pearson correlation coefficient using
parallel loop templates from Intel Threading Building Blocks library (TBB).
The input data are given in two arrays a and b of values of type double. The length of each
array is 100000. You need to write a C++ program which
• implements a serial (not using parallelism) algorithm for computing Pearson correlation
coefficient of data presented in arrays a and b;
• implements a parallel algorithm using parallel loop templates from TBB library for
computing the same;
• for a given data computes the Pearson correlation by both serial and parallel algorithm;
• prints out the results of both algorithms and the acceleration achieved by paralleliza-
tion;
The program speed will be evaluated using particular initialization of the arrays by the values
of the trigonometric functions sine and cosine applied to the indexes, that is a[i] = sin(i)
and b[i] = cosin(i).
プロジェクトID: #1491013
プロジェクトについて
アワード:
12人のフリーランサーが、平均$35 で、この仕事に入札しています。
If you take my bid, you can be confident that I will deliver the project code in a well commented and useful format. I have over 8 years in programming in C++, in mathematical, engineering, and physics projects.