Skip to content

Commit b366607

Browse files
authored
Refactor variable initialization in correlation method
1 parent e88fd72 commit b366607

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/thealgorithms/maths/Correlation.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ private Correlation() {
2121
* @return The result of the correlation of variables x,y.
2222
*/
2323
public static double correlation(double[] x, double[] y, int n) {
24-
double exy = 0, ex = 0, exx = 0, ey = 0, eyy = 0;
24+
double exy = 0;
25+
double ex = 0;
26+
double exx = 0;
27+
double ey = 0;
28+
double eyy = 0;
2529
for (int i = 0; i < n; i++) {
2630
exy += x[i] * y[i];
2731
ex += x[i];

0 commit comments

Comments
 (0)