return results_;
}
public Matrix correlation() {
final Matrix correlation = covariance();
final Array variances = correlation.diagonal();
for (int i = 0; i < dimension_; i++) {
for (int j = 0; j < dimension_; j++)
if (i == j) {
if (variances.get(i) == 0.0) {
correlation.set(i, j, 1.0);
} else {
correlation.set(i, j, correlation.get(i, j) * 1.0 / Math.sqrt(variances.get(i) * variances.get(j)));
}
} else if (variances.get(i) == 0.0 && variances.get(j) == 0) {
correlation.set(i, j, 1.0);
} else if (variances.get(i) == 0.0 || variances.get(j) == 0.0) {
correlation.set(i, j, 1.0);
} else {
correlation.set(i, j, correlation.get(i, j) * 1.0 / Math.sqrt(variances.get(i) * variances.get(j)));
}
}
return correlation;
}