Fixed FindBugs warning.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1373134 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gilles Sadowski 2012-08-14 22:02:06 +00:00
parent 16a5a02a84
commit 9b5b8d7d45
1 changed files with 9 additions and 10 deletions

View File

@ -75,6 +75,8 @@ import org.apache.commons.math3.util.FastMath;
* @since 2.0 (changed to concrete class in 3.0)
*/
public class EigenDecomposition {
/** Internally used epsilon criteria. */
private static final double EPSILON = 1e-12;
/** Maximum number of iterations accepted in the implicit QL transformation */
private byte maxIter = 30;
/** Main diagonal of the tridiagonal matrix. */
@ -99,9 +101,6 @@ public class EigenDecomposition {
/** Cached value of Vt. */
private RealMatrix cachedVt;
/** Internally used epsilon criteria. */
private final double epsilon = 1e-12;
/**
* Calculates the eigen decomposition of the given real matrix.
* <p>
@ -246,9 +245,9 @@ public class EigenDecomposition {
cachedD = MatrixUtils.createRealDiagonalMatrix(realEigenvalues);
for (int i = 0; i < imagEigenvalues.length; i++) {
if (Precision.compareTo(imagEigenvalues[i], 0.0, epsilon) > 0) {
if (Precision.compareTo(imagEigenvalues[i], 0.0, EPSILON) > 0) {
cachedD.setEntry(i, i+1, imagEigenvalues[i]);
} else if (Precision.compareTo(imagEigenvalues[i], 0.0, epsilon) < 0) {
} else if (Precision.compareTo(imagEigenvalues[i], 0.0, EPSILON) < 0) {
cachedD.setEntry(i, i-1, imagEigenvalues[i]);
}
}
@ -291,7 +290,7 @@ public class EigenDecomposition {
*/
public boolean hasComplexEigenvalues() {
for (int i = 0; i < imagEigenvalues.length; i++) {
if (!Precision.equals(imagEigenvalues[i], 0.0, epsilon)) {
if (!Precision.equals(imagEigenvalues[i], 0.0, EPSILON)) {
return true;
}
}
@ -726,7 +725,7 @@ public class EigenDecomposition {
for (int i = 0; i < realEigenvalues.length; i++) {
if (i == (realEigenvalues.length - 1) ||
Precision.equals(matT[i + 1][i], 0.0, epsilon)) {
Precision.equals(matT[i + 1][i], 0.0, EPSILON)) {
realEigenvalues[i] = matT[i][i];
} else {
final double x = matT[i + 1][i + 1];
@ -777,7 +776,7 @@ public class EigenDecomposition {
}
// we can not handle a matrix with zero norm
if (Precision.equals(norm, 0.0, epsilon)) {
if (Precision.equals(norm, 0.0, EPSILON)) {
throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
}
@ -801,7 +800,7 @@ public class EigenDecomposition {
for (int j = l; j <= idx; j++) {
r = r + matrixT[i][j] * matrixT[j][idx];
}
if (Precision.compareTo(imagEigenvalues[i], 0.0, epsilon) < 0.0) {
if (Precision.compareTo(imagEigenvalues[i], 0.0, EPSILON) < 0.0) {
z = w;
s = r;
} else {
@ -863,7 +862,7 @@ public class EigenDecomposition {
}
double w = matrixT[i][i] - p;
if (Precision.compareTo(imagEigenvalues[i], 0.0, epsilon) < 0.0) {
if (Precision.compareTo(imagEigenvalues[i], 0.0, EPSILON) < 0.0) {
z = w;
r = ra;
s = sa;