Author: tn Date: Sun Aug 5 14:11:27 2012 New Revision: 1369597 URL: http://svn.apache.org/viewvc?rev=1369597&view=rev Log: Fix findbugs warning, use strict comparison for negative values.
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SchurTransformer.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SchurTransformer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SchurTransformer.java?rev=1369597&r1=1369596&r2=1369597&view=diff ============================================================================== --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SchurTransformer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SchurTransformer.java Sun Aug 5 14:11:27 2012 @@ -43,6 +43,9 @@ import org.apache.commons.math3.util.Pre * @since 3.1 */ class SchurTransformer { + /** Maximum allowed iterations for convergence of the transformation. */ + private static final int MAX_ITERATIONS = 100; + /** P matrix. */ private final double matrixP[][]; /** T matrix. */ @@ -54,9 +57,6 @@ class SchurTransformer { /** Cached value of PT. */ private RealMatrix cachedPt; - /** Maximum allowed iterations for convergence of the transformation. */ - private final int maxIterations = 100; - /** Epsilon criteria taken from JAMA code (originally was 2^-52). */ private final double epsilon = Precision.EPSILON; @@ -205,9 +205,9 @@ class SchurTransformer { computeShift(l, idx, iteration, shift); // stop transformation after too many iterations - if (++iteration > maxIterations) { + if (++iteration > MAX_ITERATIONS) { throw new MaxCountExceededException(LocalizedFormats.CONVERGENCE_FAILED, - maxIterations); + MAX_ITERATIONS); } // Look for two consecutive small sub-diagonal elements @@ -370,7 +370,7 @@ class SchurTransformer { break; } double s = FastMath.sqrt(p * p + q * q + r * r); - if (Precision.compareTo(p, 0.0, epsilon) < 0) { + if (p < 0.0) { s = -s; } if (!Precision.equals(s, 0.0, epsilon)) {