public static Pair<Double, Double> calcMeanAndVariance(double[] weights,
Double[] avgPerf, Double[][] covMat) {
Matrix w = new Matrix(weights);
Matrix s = new Matrix(covMat);
Matrix r = new Matrix(avgPerf);
return new Pair<>(r.transpose().mult(w).getElement(0, 0), w
.transpose().mult(s.mult(w)).getElement(0, 0));
}
/**
* Gets the avg and cov from performances.