Skip to content

Commit 20cc206

Browse files
committed
Minor bug fix
1 parent 3322d90 commit 20cc206

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/org/cicirello/math/la/JacobiDiagonalization.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Vincent A. Cicirello, <https://www.cicirello.org/>.
2+
* Copyright 2018, 2021 Vincent A. Cicirello, <https://www.cicirello.org/>.
33
*
44
* This file is part of JavaPermutationTools (https://jpt.cicirello.org/).
55
*
@@ -26,8 +26,7 @@
2626
* This class uses Jacobi iteration to compute the eigenvalues and eigenvectors of a symmetric matrix, provided as a 2-D Java array.
2727
*
2828
* @author <a href=https://www.cicirello.org/ target=_top>Vincent A. Cicirello</a>, <a href=https://www.cicirello.org/ target=_top>https://www.cicirello.org/</a>
29-
* @version 1.18.7.1
30-
* @since 1.3
29+
* @version 2.15.2021
3130
*/
3231
public class JacobiDiagonalization {
3332

@@ -150,7 +149,7 @@ private boolean oneIteration(double epsilon) {
150149
for (int j = 0; j < N; j++) {
151150
if (i==j) continue;
152151
double absAij = Math.abs(a[i][j]);
153-
if (absAij > 0 && absAij < EPSILON) {
152+
if (absAij > 0 && absAij < epsilon) {
154153
// zero out any small entries
155154
absAij = a[i][j] = 0.0;
156155
}
@@ -175,11 +174,13 @@ private boolean oneIteration(double epsilon) {
175174
}
176175
return true;
177176
}
177+
/* This appears to be an impossibility, so I'm removing it.
178178
// If a_pq is small, simply set entry to 0 and don't rotate.
179179
if (a_pq < epsilon) {
180180
a[p][q] = 0;
181181
return false;
182182
}
183+
*/
183184
// compute some values
184185
double f = -a_pq;
185186
double g = 0.5*(a[p][p]-a[q][q]);

0 commit comments

Comments
 (0)