commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r729291 - in /commons/proper/math/trunk: ./ src/java/org/apache/commons/math/ src/java/org/apache/commons/math/analysis/ src/java/org/apache/commons/math/distribution/ src/java/org/apache/commons/math/genetics/ src/java/org/apache/commons/m...
Date Wed, 24 Dec 2008 10:47:54 GMT
Author: luc
Date: Wed Dec 24 02:47:53 2008
New Revision: 729291

URL: http://svn.apache.org/viewvc?rev=729291&view=rev
Log:
fixed various errors and warnings detected by checkstyle and findbugs

Added:
    commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/package.html   (with
props)
Modified:
    commons/proper/math/trunk/findbugs-exclude-filter.xml
    commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/MullerSolver.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistribution.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/Fitness.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/GeneticAlgorithm.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DecompositionSolver.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecomposition.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrix.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Min.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Product.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Sum.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java

Modified: commons/proper/math/trunk/findbugs-exclude-filter.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/findbugs-exclude-filter.xml?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/findbugs-exclude-filter.xml (original)
+++ commons/proper/math/trunk/findbugs-exclude-filter.xml Wed Dec 24 02:47:53 2008
@@ -27,14 +27,14 @@
   <!--  which already know about limited precision of the double numbers -->
   <Match>
     <Class name="org.apache.commons.math.analysis.BrentSolver" />
-    <Method name="solve" params="double,double,double,double,double,double" returns="double"
/>
+    <Method name="solve" params="UnivariateRealFunction,double,double,double,double,double,double"
returns="double" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
     <Class name="org.apache.commons.math.analysis.MullerSolver" />
     <Or>
-      <Method name="solve"  params="double,double" returns="double" />
-      <Method name="solve2" params="double,double" returns="double" />
+      <Method name="solve"  params="UnivariateRealFunction,double,double" returns="double"
/>
+      <Method name="solve2" params="UnivariateRealFunction,double,double" returns="double"
/>
     </Or>
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
@@ -79,7 +79,7 @@
   </Match>
   <Match>
     <Class name="org.apache.commons.math.util.ResizableDoubleArray"/>
-    <Method name="getValues" params="" returns="double[]" />
+    <Method name="getInternalValues" params="" returns="double[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java Wed
Dec 24 02:47:53 2008
@@ -193,6 +193,7 @@
      * Message formatting is delegated to {@link java.text.MessageFormat}.
      * @param pattern format specifier
      * @param arguments format arguments
+     * @return built exception
      */
     public static ArithmeticException createArithmeticException(final String pattern,
                                                                 final Object[] arguments)
{
@@ -214,6 +215,7 @@
      * Message formatting is delegated to {@link java.text.MessageFormat}.
      * @param pattern format specifier
      * @param arguments format arguments
+     * @return built exception
      */
     public static ArrayIndexOutOfBoundsException createArrayIndexOutOfBoundsException(final
String pattern,
                                                                                       final
Object[] arguments) {
@@ -235,6 +237,7 @@
      * Message formatting is delegated to {@link java.text.MessageFormat}.
      * @param pattern format specifier
      * @param arguments format arguments
+     * @return built exception
      */
     public static EOFException createEOFException(final String pattern,
                                                   final Object[] arguments) {
@@ -260,6 +263,7 @@
      * with Java 6.</p>
      * @param rootCause the exception or error that caused this exception
      * to be thrown.
+     * @return built exception
      */
     public static IOException createIOException(final Throwable rootCause) {
         IOException ioe = new IOException(rootCause.getLocalizedMessage());
@@ -272,6 +276,7 @@
      * Message formatting is delegated to {@link java.text.MessageFormat}.
      * @param pattern format specifier
      * @param arguments format arguments
+     * @return built exception
      */
     public static IllegalArgumentException createIllegalArgumentException(final String pattern,
                                                                           final Object[]
arguments) {
@@ -293,6 +298,7 @@
      * Message formatting is delegated to {@link java.text.MessageFormat}.
      * @param pattern format specifier
      * @param arguments format arguments
+     * @return built exception
      */
     public static IllegalStateException createIllegalStateException(final String pattern,
                                                                     final Object[] arguments)
{
@@ -314,6 +320,7 @@
      * Message formatting is delegated to {@link java.text.MessageFormat}.
      * @param pattern format specifier
      * @param arguments format arguments
+     * @return built exception
      */
     public static ConcurrentModificationException createConcurrentModificationException(final
String pattern,
                                                                                         final
Object[] arguments) {
@@ -335,6 +342,7 @@
      * Message formatting is delegated to {@link java.text.MessageFormat}.
      * @param pattern format specifier
      * @param arguments format arguments
+     * @return built exception
      */
     public static NoSuchElementException createNoSuchElementException(final String pattern,
                                                                       final Object[] arguments)
{
@@ -358,6 +366,7 @@
      * @param pattern format specifier
      * @param arguments format arguments
      * @param offset offset at which error occurred
+     * @return built exception
      */
     public static ParseException createParseException(final String pattern,
                                                       final Object[] arguments,

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java Wed
Dec 24 02:47:53 2008
@@ -141,6 +141,7 @@
      * signs. An <code>IllegalArgumentException</code> is thrown if this is not
      * the case.</p>
      * 
+     * @param f the function to solve
      * @param min the lower bound for the interval.
      * @param max the upper bound for the interval.
      * @return the value where the function is zero

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/MullerSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/MullerSolver.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/MullerSolver.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/MullerSolver.java
Wed Dec 24 02:47:53 2008
@@ -264,6 +264,7 @@
      * <p>
      * The formulas here do not use divided differences directly.</p>
      * 
+     * @param f the function to solve
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
      * @return the point at which the function value is zero

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java
Wed Dec 24 02:47:53 2008
@@ -72,6 +72,7 @@
     /**
      * Find a zero near the midpoint of <code>min</code> and <code>max</code>.
      * 
+     * @param f the function to solve
      * @param min the lower bound for the interval
      * @param max the upper bound for the interval
      * @return the value where the function is zero
@@ -89,6 +90,7 @@
     /**
      * Find a zero near the value <code>startValue</code>.
      * 
+     * @param f the function to solve
      * @param min the lower bound for the interval (ignored).
      * @param max the upper bound for the interval (ignored).
      * @param startValue the start value to use.

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistribution.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistribution.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistribution.java
Wed Dec 24 02:47:53 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java
Wed Dec 24 02:47:53 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,9 +28,14 @@
  */
 public class ZipfDistributionImpl extends AbstractIntegerDistribution 
     implements ZipfDistribution, Serializable {
+
+    /** Serializable version identifier. */
     private static final long serialVersionUID = -140627372283420404L;
 
+    /** Number of elements. */
     private int numberOfElements;
+
+    /** Exponent parameter of the distribution. */
     private double exponent;
 
     /**
@@ -38,8 +43,8 @@
      * exponent. Both values must be positive; otherwise an 
      * <code>IllegalArgumentException</code> is thrown.
      * 
-     * @param n the number of elements
-     * @param s the exponent
+     * @param numberOfElements the number of elements
+     * @param exponent the exponent
      * @exception IllegalArgumentException if n &le; 0 or s &le; 0.0
      */
     public ZipfDistributionImpl(final int numberOfElements, final double exponent)

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/Fitness.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/Fitness.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/Fitness.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/Fitness.java Wed Dec
24 02:47:53 2008
@@ -16,5 +16,10 @@
  */
 package org.apache.commons.math.genetics;
 
-public interface Fitness extends Comparable {
+/**
+ * Interface used to compare chromosomes.
+ * @version $Revision$ $Date$
+ * @since 2.0
+ */
+public interface Fitness extends Comparable<Fitness> {
 }

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/GeneticAlgorithm.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/GeneticAlgorithm.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/GeneticAlgorithm.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/GeneticAlgorithm.java
Wed Dec 24 02:47:53 2008
@@ -102,7 +102,7 @@
     /**
      * <p>Evolve the given population into the next generation.</p>
      * <p><ol>
-     *    <li>Get nextGeneration polulation to fill from <code>current</code>
+     *    <li>Get nextGeneration population to fill from <code>current</code>
      *        generation, using its nextGeneration method</li>
      *    <li>Loop until new generation is filled:</li>
      *    <ul><li>Apply configured SelectionPolicy to select a pair of parents

Added: commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/package.html
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/package.html?rev=729291&view=auto
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/package.html (added)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/package.html Wed Dec
24 02:47:53 2008
@@ -0,0 +1,24 @@
+<html>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+    <!-- $Revision$ -->
+<body>
+<p>
+This package provides basic genetic algorithms components.
+</p>
+</body>
+</html>

Propchange: commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/math/trunk/src/java/org/apache/commons/math/genetics/package.html
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DecompositionSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DecompositionSolver.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DecompositionSolver.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DecompositionSolver.java
Wed Dec 24 02:47:53 2008
@@ -76,7 +76,6 @@
     boolean isNonSingular();
 
     /** Get the inverse (or pseudo-inverse) of the decomposed matrix.
-     * @param decomposition decomposition of the matrix A
      * @return inverse matrix
      * @throws InvalidMatrixException if decomposed matrix is singular
      */

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/EigenDecompositionImpl.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
Wed Dec 24 02:47:53 2008
@@ -186,8 +186,8 @@
      * Calculates the eigen decomposition of the given tridiagonal symmetric matrix. 
      * <p>Calling this constructor is equivalent to first call the no-arguments
      * constructor and then call {@link #decompose(double[], double[])}.</p>
-     * @param main the main diagonal of the matrix
-     * @param secondary the secondary diagonal of the matrix
+     * @param main the main diagonal of the matrix (will be copied)
+     * @param secondary the secondary diagonal of the matrix (will be copied)
      * @param splitTolerance tolerance on the off-diagonal elements relative to the
      * geometric mean to split the tridiagonal matrix (a suggested value is
      * {@link MathUtils#SAFE_MIN})
@@ -198,8 +198,8 @@
             final double splitTolerance)
         throws InvalidMatrixException {
 
-        this.main      = main;
-        this.secondary = secondary;
+        this.main      = main.clone();
+        this.secondary = secondary.clone();
         transformer    = null;
 
         // pre-compute some elements
@@ -365,7 +365,7 @@
         if (eigenvectors == null) {
             findEigenVectors();
         }
-        return new Solver(realEigenvalues, eigenvectors);
+        return new Solver(realEigenvalues, imagEigenvalues, eigenvectors);
     }
 
     /** Specialized solver. */
@@ -374,20 +374,26 @@
         /** Serializable version identifier. */
         private static final long serialVersionUID = -8965845906036558410L;
 
-        /** Eigenvalues. */
-        private final double[] eigenvalues;
+        /** Real part of the realEigenvalues. */
+        private double[] realEigenvalues;
+
+        /** Imaginary part of the realEigenvalues. */
+        private double[] imagEigenvalues;
 
         /** Eigenvectors. */
         private final RealVectorImpl[] eigenvectors;
 
         /**
          * Build a solver from decomposed matrix.
-         * @param realEigenvalues realEigenvalues
+         * @param realEigenvalues real parts of the eigenvalues
+         * @param imagEigenvalues imaginary parts of the eigenvalues
          * @param eigenvectors eigenvectors
          */
-        private Solver(final double[] eigenvalues, final RealVectorImpl[] eigenvectors) {
-            this.eigenvalues  = eigenvalues;
-            this.eigenvectors = eigenvectors; 
+        private Solver(final double[] realEigenvalues, final double[] imagEigenvalues,
+                       final RealVectorImpl[] eigenvectors) {
+            this.realEigenvalues = realEigenvalues;
+            this.imagEigenvalues = imagEigenvalues;
+            this.eigenvectors    = eigenvectors; 
         }
 
         /** Solve the linear equation A &times; X = B for symmetric matrices A.
@@ -405,7 +411,7 @@
                 throw new SingularMatrixException();
             }
 
-            final int m = eigenvalues.length;
+            final int m = realEigenvalues.length;
             if (b.length != m) {
                 throw new IllegalArgumentException("constant vector has wrong length");
             }
@@ -414,7 +420,7 @@
             for (int i = 0; i < m; ++i) {
                 final RealVectorImpl v = eigenvectors[i];
                 final double[] vData = v.getDataRef();
-                final double s = v.dotProduct(b) / eigenvalues[i];
+                final double s = v.dotProduct(b) / realEigenvalues[i];
                 for (int j = 0; j < m; ++j) {
                     bp[j] += s * vData[j];
                 }
@@ -439,7 +445,7 @@
                 throw new SingularMatrixException();
             }
 
-            final int m = eigenvalues.length;
+            final int m = realEigenvalues.length;
             if (b.getDimension() != m) {
                 throw new IllegalArgumentException("constant vector has wrong length");
             }
@@ -448,7 +454,7 @@
             for (int i = 0; i < m; ++i) {
                 final RealVectorImpl v = eigenvectors[i];
                 final double[] vData = v.getDataRef();
-                final double s = v.dotProduct(b) / eigenvalues[i];
+                final double s = v.dotProduct(b) / realEigenvalues[i];
                 for (int j = 0; j < m; ++j) {
                     bp[j] += s * vData[j];
                 }
@@ -473,7 +479,7 @@
                 throw new SingularMatrixException();
             }
 
-            final int m = eigenvalues.length;
+            final int m = realEigenvalues.length;
             if (b.getRowDimension() != m) {
                 throw new IllegalArgumentException("Incorrect row dimension");
             }
@@ -488,7 +494,7 @@
                     for (int j = 0; j < m; ++j) {
                         s += v.getEntry(j) * b.getEntry(j, k);
                     }
-                    s /= eigenvalues[i];
+                    s /= realEigenvalues[i];
                     for (int j = 0; j < m; ++j) {
                         bp[j][k] += s * vData[j];
                     }
@@ -504,8 +510,8 @@
          * @return true if the decomposed matrix is non-singular
          */
         public boolean isNonSingular() {
-            for (double lambda : eigenvalues) {
-                if (lambda == 0) {
+            for (int i = 0; i < realEigenvalues.length; ++i) {
+                if ((realEigenvalues[i] == 0) && (imagEigenvalues[i] == 0)) {
                     return false;
                 }
             }
@@ -523,7 +529,7 @@
                 throw new SingularMatrixException();
             }
 
-            final int m = eigenvalues.length;
+            final int m = realEigenvalues.length;
             final double[][] invData = new double[m][m];
 
             for (int i = 0; i < m; ++i) {
@@ -532,7 +538,7 @@
                     double invIJ = 0;
                     for (int k = 0; k < m; ++k) {
                         final double[] vK = eigenvectors[k].getDataRef();
-                        invIJ += vK[i] * vK[j] / eigenvalues[k];
+                        invIJ += vK[i] * vK[j] / realEigenvalues[k];
                     }
                     invI[j] = invIJ;
                 }
@@ -818,18 +824,12 @@
         throws InvalidMatrixException {
 
         // check decomposed matrix data range
-        final int fourN1  = 4 * (n - 1);
-        double sumDiag    = 0;
         double sumOffDiag = 0;
         for (int i = 0; i < n - 1; ++i) {
             final int fourI = 4 * i;
-            final double qi = work[fourI];
             final double ei = work[fourI + 2];
-            sumDiag    += qi;
             sumOffDiag += ei;
         }
-        final double qi = work[fourN1];
-        sumDiag += qi;
 
         if (sumOffDiag == 0) {
             // matrix is already diagonal

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecomposition.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecomposition.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecomposition.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecomposition.java
Wed Dec 24 02:47:53 2008
@@ -44,7 +44,7 @@
      * <p>R is an upper-triangular matrix</p>
      * @return the R matrix
      */
-    RealMatrix getR() throws IllegalStateException;
+    RealMatrix getR();
 
     /**
      * Returns the matrix Q of the decomposition.

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrix.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrix.java Wed
Dec 24 02:47:53 2008
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.linear;
 
+import java.io.Serializable;
+
 /**
  * Interface defining a real-valued matrix with basic algebraic operations.
  * <p>
@@ -25,7 +27,7 @@
  * 
  * @version $Revision$ $Date$
  */
-public interface RealMatrix {
+public interface RealMatrix extends Serializable {
 
     /**
      * Create a new RealMatrix of the same type as the instance with the supplied
@@ -33,6 +35,7 @@
      *
      * @param rowDimension  the number of rows in the new matrix
      * @param columnDimension  the number of columns in the new matrix
+     * @return a new matrix of the same type as the instance
      * @throws IllegalArgumentException if row or column dimension is not positive
      * @since 2.0
      */

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
Wed Dec 24 02:47:53 2008
@@ -52,10 +52,10 @@
     private double[] secondaryBidiagonal;
 
     /** Main diagonal of the tridiagonal matrix. */
-    double[] mainTridiagonal;
+    private double[] mainTridiagonal;
 
     /** Secondary diagonal of the tridiagonal matrix. */
-    double[] secondaryTridiagonal;
+    private double[] secondaryTridiagonal;
 
     /** Eigen decomposition of the tridiagonal matrix. */
     private EigenDecomposition eigenDecomposition;

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java Wed
Dec 24 02:47:53 2008
@@ -16,13 +16,14 @@
  */
 
 package org.apache.commons.math.random;
+import java.io.Serializable;
 import java.util.Collection;
 
 /**
  * Random data generation utilities.
  * @version $Revision$ $Date$
  */
-public interface RandomData {
+public interface RandomData extends Serializable {
     /**
      * Generates a random string of hex characters of length
      * <code>len</code>.

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
Wed Dec 24 02:47:53 2008
@@ -164,7 +164,7 @@
         return Double.NaN;
     }
     
-    /*
+    /**
      * {@inheritDoc}
      */
     public Mean copy() {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
Wed Dec 24 02:47:53 2008
@@ -131,7 +131,7 @@
         return max;
     }
     
-    /*
+    /**
      * {@inheritDoc}
      */
     public Max copy() {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Min.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Min.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Min.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Min.java
Wed Dec 24 02:47:53 2008
@@ -133,7 +133,7 @@
         return min;
     }
     
-    /*
+    /**
      * {@inheritDoc}
      */
     public Min copy() {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
Wed Dec 24 02:47:53 2008
@@ -248,7 +248,7 @@
         quantile = p;
     }
     
-    /*
+    /**
      * {@inheritDoc}
      */
     public Percentile copy() {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Product.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Product.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Product.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Product.java
Wed Dec 24 02:47:53 2008
@@ -123,7 +123,7 @@
         return product;
     }
     
-    /*
+    /**
      * {@inheritDoc}
      */
     public Product copy() {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Sum.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Sum.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Sum.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Sum.java
Wed Dec 24 02:47:53 2008
@@ -123,7 +123,7 @@
         return sum;
     }
     
-    /*
+    /**
      * {@inheritDoc}
      */
     public Sum copy() {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java
Wed Dec 24 02:47:53 2008
@@ -134,7 +134,7 @@
         return sumLog;
     }
     
-    /*
+    /**
      * {@inheritDoc}
      */
     public SumOfLogs copy() {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java
Wed Dec 24 02:47:53 2008
@@ -123,7 +123,7 @@
         return sumSq;
     }
     
-    /*
+    /**
      * {@inheritDoc}
      */
     public SumOfSquares copy() {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastFourierTransformer.java
Wed Dec 24 02:47:53 2008
@@ -44,7 +44,7 @@
  */
 public class FastFourierTransformer implements Serializable {
 
-    /** serializable version identifier */
+    /** Serializable version identifier. */
     static final long serialVersionUID = 5138259215438106000L;
 
     /** array of the roots of unity */
@@ -566,16 +566,17 @@
     }
     
     /**
-     * Performs a multi-dimensional Fourier transform on a given
-     * array, using {@link #inversetransform2(Complex[])} and
+     * Performs a multi-dimensional Fourier transform on a given array.
+     * Use {@link #inversetransform2(Complex[])} and
      * {@link #transform2(Complex[])} in a row-column implementation
      * in any number of dimensions with O(N&times;log(N)) complexity with
      * N=n<sub>1</sub>&times;n<sub>2</sub>&times;n<sub>3</sub>&times;...&times;n<sub>d</sub>,
      * n<sub>x</sub>=number of elements in dimension x,
      * and d=total number of dimensions.
      *
-     * @param forward inverseTransform2 is preformed if this is false
      * @param mdca Multi-Dimensional Complex Array id est Complex[][][][]
+     * @param forward inverseTransform2 is preformed if this is false
+     * @return transform of mdca as a Multi-Dimensional Complex Array id est Complex[][][][]
      * @throws MathException if any dimension is not a power of two
      */
     public Object mdfft(Object mdca, boolean forward) throws MathException {
@@ -589,6 +590,15 @@
         return mdcm.getArray();
     }
     
+    /**
+     * Performs one dimension of a multi-dimensional Fourier transform.
+     *
+     * @param mdcm input matrix
+     * @param forward inverseTransform2 is preformed if this is false
+     * @param d index of the dimension to process
+     * @param subVector recursion subvector
+     * @throws MathException if any dimension is not a power of two
+     */
     private void mdfft(MultiDimensionalComplexMatrix mdcm, boolean forward,
                          int d, int[] subVector) throws MathException {
         int[] dimensionSize = mdcm.getDimensionSizes();
@@ -629,19 +639,28 @@
         return;
     }
 
-    /*
-     * not designed for synchronized access
+    /**
+     * Complex matrix implementation.
+     * Not designed for synchronized access
      * may eventually be replaced by jsr-83 of the java community process
      * http://jcp.org/en/jsr/detail?id=83
      * may require additional exception throws for other basic requirements.
      */
     private class MultiDimensionalComplexMatrix implements Serializable,
                                                            Cloneable {
+
+        /** Serializable version identifier. */
         private static final long serialVersionUID =  0x564FCD47EBA8169BL;
-        
+
+        /** Size in all dimensions. */
         protected int[] dimensionSize = new int[1];
+
+        /** Storage array. */
         protected Object multiDimensionalComplexArray;
-        
+
+        /** Simple constructor.
+         * @param multiDimensionalComplexArray array containing the matrix elements
+         */
         public MultiDimensionalComplexMatrix(Object
                                              multiDimensionalComplexArray) {
             this.multiDimensionalComplexArray = multiDimensionalComplexArray;
@@ -669,12 +688,16 @@
                 dimensionSize = newDimensionSize;
             }
         }
-        
+
+        /**
+         * Get a matrix element.
+         * @param vector indices of the element
+         * @return matrix element
+         */
         public Complex get(int... vector) {
             if ((vector == null && dimensionSize.length > 1) ||
-                    vector.length != dimensionSize.length) {
-                throw new IllegalArgumentException("Number of dimensions must "
-                                                   + "match");
+                (vector != null && vector.length != dimensionSize.length)) {
+                throw new IllegalArgumentException("Number of dimensions must match");
             }
             
             Object lastDimension = multiDimensionalComplexArray;
@@ -685,11 +708,16 @@
             return (Complex) lastDimension;
         }
         
+        /**
+         * Set a matrix element.
+         * @param magnitude magnitude of the element
+         * @param vector indices of the element
+         * @return the previous value
+         */
         public Complex set(Complex magnitude, int... vector) {
             if ((vector == null && dimensionSize.length > 1) ||
-                    vector.length != dimensionSize.length) {
-                throw new IllegalArgumentException("Number of dimensions must "
-                                                   + "match");
+                (vector != null && vector.length != dimensionSize.length)) {
+                throw new IllegalArgumentException("Number of dimensions must match");
             }
             
             Object lastDimension = multiDimensionalComplexArray;
@@ -704,15 +732,24 @@
                     magnitude;
             return lastValue;
         }
-        
+
+        /**
+         * Get the size in all dimensions.
+         * @return size in all dimensions
+         */
         public int[] getDimensionSizes() {
             return dimensionSize.clone();
         }
-        
+
+        /**
+         * Get the underlying storage array
+         * @return underlying storage array
+         */
         public Object getArray() {
             return multiDimensionalComplexArray;
         }
-        
+
+        /** {@inheritDoc} */
         @Override
         public Object clone() {
             MultiDimensionalComplexMatrix mdcm =
@@ -722,8 +759,9 @@
             return mdcm;
         }
         
-        /*
+        /**
          * Copy contents of current array into mdcm.
+         * @param mdcm array where to copy data
          */
         private void clone(MultiDimensionalComplexMatrix mdcm) {
             int[] vector = new int[dimensionSize.length];

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
Wed Dec 24 02:47:53 2008
@@ -454,7 +454,7 @@
     public class Iterator {
 
         /** Reference modification count. */
-        final int referenceCount;
+        private final int referenceCount;
 
         /** Index of curent element. */
         private int current;

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java?rev=729291&r1=729290&r2=729291&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java
Wed Dec 24 02:47:53 2008
@@ -251,7 +251,7 @@
      * on original.  Original may not be null; otherwise a NullPointerException
      * is thrown.
      * 
-     * @param original
+     * @param original array to copy
      * @since 2.0
      */
     public ResizableDoubleArray(ResizableDoubleArray original) {
@@ -846,18 +846,22 @@
        if (object instanceof ResizableDoubleArray == false) {
             return false;
         }
-       boolean result = true;
-       ResizableDoubleArray other = (ResizableDoubleArray) object;
-       result = result && (other.initialCapacity == initialCapacity);
-       result = result && (other.contractionCriteria == contractionCriteria);
-       result = result && (other.expansionFactor == expansionFactor);
-       result = result && (other.expansionMode == expansionMode);
-       result = result && (other.numElements == numElements);
-       result = result && (other.startIndex == startIndex);
-       if (!result) { 
-           return false;
-       } else {
-           return Arrays.equals(internalArray, other.internalArray);
+       synchronized(this) {
+           synchronized(object) {
+               boolean result = true;
+               ResizableDoubleArray other = (ResizableDoubleArray) object;
+               result = result && (other.initialCapacity == initialCapacity);
+               result = result && (other.contractionCriteria == contractionCriteria);
+               result = result && (other.expansionFactor == expansionFactor);
+               result = result && (other.expansionMode == expansionMode);
+               result = result && (other.numElements == numElements);
+               result = result && (other.startIndex == startIndex);
+               if (!result) { 
+                   return false;
+               } else {
+                   return Arrays.equals(internalArray, other.internalArray);
+               }
+           }
        }
     }
     



Mime
View raw message