commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r775751 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/analysis/ test/org/apache/commons/math/optimization/general/
Date Sun, 17 May 2009 20:19:35 GMT
Author: luc
Date: Sun May 17 20:19:34 2009
New Revision: 775751

URL: http://svn.apache.org/viewvc?rev=775751&view=rev
Log:
simplified DifferentiableMultivariateVectorialFunction
the gradient and partial derivaritves can be retrieved from the jacobian
and adding them at the interface level was cumbersome for implementing
optimization problems.
Now users need to provide only the jacobian method

Modified:
    commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/DifferentiableMultivariateVectorialFunction.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/MinpackTest.java

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/DifferentiableMultivariateVectorialFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/DifferentiableMultivariateVectorialFunction.java?rev=775751&r1=775750&r2=775751&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/DifferentiableMultivariateVectorialFunction.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/DifferentiableMultivariateVectorialFunction.java
Sun May 17 20:19:34 2009
@@ -28,45 +28,7 @@
     extends MultivariateVectorialFunction {
 
     /**
-     * Returns the partial derivative of the function with respect to point
-     * coordinate x<sub>j</sub>.
-     * <p>
-     * The partial derivative basically represents column j of the jacobian
-     * matrix. If the partial derivatives with respect to all coordinates are
-     * needed, it may be more efficient to use the {@link #jacobian()} method
-     * which will compute the complete matrix at once.
-     * </p>
-     * @param j index of the coordinate with respect to which the partial
-     * derivative is computed
-     * @return the partial derivative function with respect to point coordinate
-     * x<sub>i</sub>
-     */
-    MultivariateVectorialFunction partialDerivative(int j);
-
-    /**
-     * Returns the gradient function of the i<sup>th</sup> component of
-     * the vectorial function.
-     * 
-     * <p>
-     * The i<sup>th</sup> gradient basically represents row i of the jacobian
-     * matrix. If all gradients are needed, it may be more efficient to use the
-     * {@link #jacobian()} method which will compute the complete matrix at once.
-     * </p>
-     * @param i index of the function component for which the gradient is requested
-     * @return the gradient function of the i<sup>th</sup> component of
-     * the vectorial function
-     */
-    MultivariateVectorialFunction gradient(int i);
-
-    /**
      * Returns the jacobian function.
-     * <p>
-     * If only one column of the jacobian is needed, it may be more efficient to
-     * use the {@link #partialDerivative(int)} method which will compute only the
-     * specified column. If only one row of the jacobian is needed, it may be more
-     * efficient to use the {@link #gradient(int)} method which will compute only the
-     * specified row.
-     * </p>
      * @return the jacobian function
      */
     MultivariateMatrixFunction jacobian();

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java?rev=775751&r1=775750&r2=775751&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java
Sun May 17 20:19:34 2009
@@ -493,24 +493,6 @@
             return factors.operate(variables);
         }
 
-        public MultivariateVectorialFunction partialDerivative(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = 1037082026387842358L;
-                public double[] value(double[] point) {
-                    return factors.getColumn(i);
-                }
-            };
-        }
-
-        public MultivariateVectorialFunction gradient(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = -3268626996728727146L;
-                public double[] value(double[] point) {
-                    return factors.getRow(i);
-                }
-            };
-        }
-
         public MultivariateMatrixFunction jacobian() {
             return new MultivariateMatrixFunction() {
                 private static final long serialVersionUID = -8387467946663627585L;
@@ -590,29 +572,6 @@
 
         }
 
-        public MultivariateVectorialFunction partialDerivative(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = -2884159755283203273L;
-                public double[] value(double[] point) {
-                    double[][] m = jacobian(point);
-                    double[] partial = new double[m.length];
-                    for (int j = 0; j < partial.length; ++j) {
-                        partial[i] = m[i][j];
-                    }
-                    return partial;
-                }
-            };
-        }
-
-        public MultivariateVectorialFunction gradient(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = -43357217231860547L;
-                public double[] value(double[] point) {
-                    return jacobian(point)[i];
-                }
-            };
-        }
-
         public MultivariateMatrixFunction jacobian() {
             return new MultivariateMatrixFunction() {
                 private static final long serialVersionUID = -4340046230875165095L;

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java?rev=775751&r1=775750&r2=775751&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
Sun May 17 20:19:34 2009
@@ -533,24 +533,6 @@
             return factors.operate(variables);
         }
 
-        public MultivariateVectorialFunction partialDerivative(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = 4868131119285501303L;
-                public double[] value(double[] point) {
-                    return factors.getColumn(i);
-                }
-            };
-        }
-
-        public MultivariateVectorialFunction gradient(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = 6280336674474631774L;
-                public double[] value(double[] point) {
-                    return factors.getRow(i);
-                }
-            };
-        }
-
         public MultivariateMatrixFunction jacobian() {
             return new MultivariateMatrixFunction() {
                 private static final long serialVersionUID = 556396458721526234L;
@@ -632,29 +614,6 @@
 
         }
 
-        public MultivariateVectorialFunction partialDerivative(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = -2884159755283203273L;
-                public double[] value(double[] point) {
-                    double[][] m = jacobian(point);
-                    double[] partial = new double[m.length];
-                    for (int j = 0; j < partial.length; ++j) {
-                        partial[i] = m[i][j];
-                    }
-                    return partial;
-                }
-            };
-        }
-
-        public MultivariateVectorialFunction gradient(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = -43357217231860547L;
-                public double[] value(double[] point) {
-                    return jacobian(point)[i];
-                }
-            };
-        }
-
         public MultivariateMatrixFunction jacobian() {
             return new MultivariateMatrixFunction() {
                 private static final long serialVersionUID = -4340046230875165095L;
@@ -700,29 +659,6 @@
             return values;
         }
 
-        public MultivariateVectorialFunction partialDerivative(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = 2371658898687841192L;
-                public double[] value(double[] point) {
-                    double[][] m = jacobian(point);
-                    double[] partial = new double[m.length];
-                    for (int j = 0; j < partial.length; ++j) {
-                        partial[i] = m[i][j];
-                    }
-                    return partial;
-                }
-            };
-        }
-
-        public MultivariateVectorialFunction gradient(final int i) {
-            return new MultivariateVectorialFunction() {
-                private static final long serialVersionUID = 6863958501785879369L;
-                public double[] value(double[] point) {
-                    return jacobian(point)[i];
-                }
-            };
-        }
-
         public MultivariateMatrixFunction jacobian() {
             return new MultivariateMatrixFunction() {
                 private static final long serialVersionUID = -8673650298627399464L;

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/MinpackTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/MinpackTest.java?rev=775751&r1=775750&r2=775751&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/MinpackTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/MinpackTest.java
Sun May 17 20:19:34 2009
@@ -582,29 +582,6 @@
           return true;
       }
 
-      public MultivariateVectorialFunction partialDerivative(final int i) {
-          return new MultivariateVectorialFunction() {
-            private static final long serialVersionUID = 2192585229396907068L;
-            public double[] value(double[] point) {
-                  double[][] m = jacobian(point);
-                  double[] partial = new double[m.length];
-                  for (int j = 0; j < partial.length; ++j) {
-                      partial[i] = m[i][j];
-                  }
-                  return partial;
-              }
-          };
-      }
-
-      public MultivariateVectorialFunction gradient(final int i) {
-          return new MultivariateVectorialFunction() {
-            private static final long serialVersionUID = -5562016064510078300L;
-            public double[] value(double[] point) {
-                  return jacobian(point)[i];
-              }
-          };
-      }
-
       public MultivariateMatrixFunction jacobian() {
           return new MultivariateMatrixFunction() {
             private static final long serialVersionUID = -2435076097232923678L;



Mime
View raw message