commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1157288 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
Date Fri, 12 Aug 2011 23:11:46 GMT
Author: erans
Date: Fri Aug 12 23:11:46 2011
New Revision: 1157288

URL: http://svn.apache.org/viewvc?rev=1157288&view=rev
Log:
Code cleanup: "0.0" -> "0", "1.0" -> "1".

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java?rev=1157288&r1=1157287&r2=1157288&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
Fri Aug 12 23:11:46 2011
@@ -96,20 +96,20 @@ public class SingularValueDecompositionI
                 for (int i = k; i < m; i++) {
                     singularValues[k] = FastMath.hypot(singularValues[k], A[i][k]);
                 }
-                if (singularValues[k] != 0.0) {
-                    if (A[k][k] < 0.0) {
+                if (singularValues[k] != 0) {
+                    if (A[k][k] < 0) {
                         singularValues[k] = -singularValues[k];
                     }
                     for (int i = k; i < m; i++) {
                         A[i][k] /= singularValues[k];
                     }
-                    A[k][k] += 1.0;
+                    A[k][k] += 1;
                 }
                 singularValues[k] = -singularValues[k];
             }
             for (int j = k + 1; j < n; j++) {
                 if (k < nct &&
-                    singularValues[k] != 0.0) {
+                    singularValues[k] != 0) {
                     // Apply the transformation.
                     double t = 0;
                     for (int i = k; i < m; i++) {
@@ -139,21 +139,21 @@ public class SingularValueDecompositionI
                 for (int i = k + 1; i < n; i++) {
                     e[k] = FastMath.hypot(e[k], e[i]);
                 }
-                if (e[k] != 0.0) {
-                    if (e[k + 1] < 0.0) {
+                if (e[k] != 0) {
+                    if (e[k + 1] < 0) {
                         e[k] = -e[k];
                     }
                     for (int i = k + 1; i < n; i++) {
                         e[i] /= e[k];
                     }
-                    e[k + 1] += 1.0;
+                    e[k + 1] += 1;
                 }
                 e[k] = -e[k];
                 if (k + 1 < m &&
                     e[k] != 0) {
                     // Apply the transformation.
                     for (int i = k + 1; i < m; i++) {
-                        work[i] = 0.0;
+                        work[i] = 0;
                     }
                     for (int j = k + 1; j < n; j++) {
                         for (int i = k + 1; i < m; i++) {
@@ -181,22 +181,22 @@ public class SingularValueDecompositionI
             singularValues[nct] = A[nct][nct];
         }
         if (m < p) {
-            singularValues[p - 1] = 0.0;
+            singularValues[p - 1] = 0;
         }
         if (nrt + 1 < p) {
             e[nrt] = A[nrt][p - 1];
         }
-        e[p - 1] = 0.0;
+        e[p - 1] = 0;
 
         // Generate U.
         for (int j = nct; j < n; j++) {
             for (int i = 0; i < m; i++) {
-                U[i][j] = 0.0;
+                U[i][j] = 0;
             }
-            U[j][j] = 1.0;
+            U[j][j] = 1;
         }
         for (int k = nct - 1; k >= 0; k--) {
-            if (singularValues[k] != 0.0) {
+            if (singularValues[k] != 0) {
                 for (int j = k + 1; j < n; j++) {
                     double t = 0;
                     for (int i = k; i < m; i++) {
@@ -210,15 +210,15 @@ public class SingularValueDecompositionI
                 for (int i = k; i < m; i++) {
                     U[i][k] = -U[i][k];
                 }
-                U[k][k] = 1.0 + U[k][k];
+                U[k][k] = 1 + U[k][k];
                 for (int i = 0; i < k - 1; i++) {
-                    U[i][k] = 0.0;
+                    U[i][k] = 0;
                 }
             } else {
                 for (int i = 0; i < m; i++) {
-                    U[i][k] = 0.0;
+                    U[i][k] = 0;
                 }
-                U[k][k] = 1.0;
+                U[k][k] = 1;
             }
         }
 
@@ -238,9 +238,9 @@ public class SingularValueDecompositionI
                 }
             }
             for (int i = 0; i < n; i++) {
-                V[i][k] = 0.0;
+                V[i][k] = 0;
             }
-            V[k][k] = 1.0;
+            V[k][k] = 1;
         }
 
         // Main iteration loop for the singular values.
@@ -266,7 +266,7 @@ public class SingularValueDecompositionI
                     = TINY + EPS * (FastMath.abs(singularValues[k]) +
                                     FastMath.abs(singularValues[k + 1]));
                 if (FastMath.abs(e[k]) <= threshold) {
-                    e[k] = 0.0;
+                    e[k] = 0;
                     break;
                 }
             }
@@ -278,10 +278,10 @@ public class SingularValueDecompositionI
                     if (ks == k) {
                         break;
                     }
-                    final double t = (ks != p ? FastMath.abs(e[ks]) : 0.0) +
-                        (ks != k + 1 ? FastMath.abs(e[ks - 1]) : 0.0);
+                    final double t = (ks != p ? FastMath.abs(e[ks]) : 0) +
+                        (ks != k + 1 ? FastMath.abs(e[ks - 1]) : 0);
                     if (FastMath.abs(singularValues[ks]) <= TINY + EPS * t) {
-                        singularValues[ks] = 0.0;
+                        singularValues[ks] = 0;
                         break;
                     }
                 }
@@ -300,7 +300,7 @@ public class SingularValueDecompositionI
                 // Deflate negligible s(p).
                 case 1: {
                     double f = e[p - 2];
-                    e[p - 2] = 0.0;
+                    e[p - 2] = 0;
                     for (int j = p - 2; j >= k; j--) {
                         double t = FastMath.hypot(singularValues[j], f);
                         final double cs = singularValues[j] / t;
@@ -322,7 +322,7 @@ public class SingularValueDecompositionI
                 // Split at negligible s(k).
                 case 2: {
                     double f = e[k - 1];
-                    e[k - 1] = 0.0;
+                    e[k - 1] = 0;
                     for (int j = k; j < p; j++) {
                         double t = FastMath.hypot(singularValues[j], f);
                         final double cs = singularValues[j] / t;
@@ -352,11 +352,11 @@ public class SingularValueDecompositionI
                     final double ek = e[k] / scale;
                     final double b = ((spm1 + sp) * (spm1 - sp) + epm1 * epm1) / 2.0;
                     final double c = (sp * epm1) * (sp * epm1);
-                    double shift = 0.0;
+                    double shift = 0;
                     if (b != 0 ||
                         c != 0) {
                         shift = FastMath.sqrt(b * b + c);
-                        if (b < 0.0) {
+                        if (b < 0) {
                             shift = -shift;
                         }
                         shift = c / (b + shift);
@@ -404,8 +404,8 @@ public class SingularValueDecompositionI
                 // Convergence.
                 default: {
                     // Make the singular values positive.
-                    if (singularValues[k] <= 0.0) {
-                        singularValues[k] = singularValues[k] < 0.0 ? -singularValues[k]
: 0.0;
+                    if (singularValues[k] <= 0) {
+                        singularValues[k] = singularValues[k] < 0 ? -singularValues[k]
: 0;
 
                         for (int i = 0; i <= pp; i++) {
                             V[i][k] = -V[i][k];



Mime
View raw message