Finished the funciton to calculate the semivariance between each pair of input data