Skip to content

Commit 030f5c8

Browse files
authored
Update ChebyshevIteration.java
1 parent 358ae02 commit 030f5c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static double[] solve(double[][] a, double[] b, double[] x0, double minEi
6767
alpha = 1.0 / d;
6868
System.arraycopy(r, 0, p, 0, n); // p = r
6969
} else {
70-
double beta = (c * alphaPrev / 2.0) * (c * alphaPrev / 2.0);
70+
double beta = c * alphaPrev / 2.0 * (c * alphaPrev / 2.0);
7171
alpha = 1.0 / (d - beta / alphaPrev);
7272
double[] pUpdate = scalarMultiply(beta / alphaPrev, p);
7373
p = vectorAdd(r, pUpdate); // p = r + (beta / alphaPrev) * p
@@ -138,7 +138,7 @@ private static double[] matrixVectorMultiply(double[][] a, double[] v) {
138138
private static double[] vectorSubtract(double[] v1, double[] v2) {
139139
int n = v1.length;
140140
double[] result = new double[n];
141-
for (int i = 0; i < n; i++) {
141+
for (int i = or (int i = 0; i < n; i++) {
142142
result[i] = v1[i] - v2[i];
143143
}
144144
return result;

0 commit comments

Comments
 (0)