add weightedcov function & test

Hey @rbiswas4 can you check this out? I think the weighted covariance we had in before was wrong.