Author: luc
Date: Tue Mar 24 22:06:39 2009
New Revision: 758047
URL: http://svn.apache.org/viewvc?rev=758047&view=rev
Log:
removed spurious exception in optimization
Removed:
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/ObjectiveException.java
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java?rev=758047&r1=758046&r2=758047&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java
Tue Mar 24 22:06:39 2009
@@ -16,6 +16,8 @@
*/
package org.apache.commons.math;
+import org.apache.commons.math.linear.RealVectorImpl;
+
/**
* Exception thrown when an error occurs evaluating a function.
* <p>
@@ -27,10 +29,10 @@
public class FunctionEvaluationException extends MathException {
/** Serializable version identifier. */
- private static final long serialVersionUID = -7267500407292949362L;
+ private static final long serialVersionUID = -4305020489115478365L;
/** Argument causing function evaluation failure */
- private double argument = Double.NaN;
+ private double[] argument;
/**
* Construct an exception indicating the argument value
@@ -39,8 +41,20 @@
* @param argument the failing function argument
*/
public FunctionEvaluationException(double argument) {
- super("Evaluation failed for argument = {0}",
Double.valueOf(argument));
- this.argument = argument;
+ super("evaluation failed for argument = {0}", argument);
+ this.argument = new double[] { argument };
+ }
+
+ /**
+ * Construct an exception indicating the argument value
+ * that caused the function evaluation to fail.
+ *
+ * @param argument the failing function argument
+ * @since 2.0
+ */
+ public FunctionEvaluationException(double[] argument) {
+ super("evaluation failed for argument = {0}", new
RealVectorImpl(argument));
+ this.argument = argument.clone();
}
/**
@@ -54,7 +68,21 @@
public FunctionEvaluationException(double argument,
String pattern, Object ... arguments) {
super(pattern, arguments);
- this.argument = argument;
+ this.argument = new double[] { argument };
+ }
+
+ /**
+ * Constructs an exception with specified formatted detail message.
+ * Message formatting is delegated to {...@link java.text.MessageFormat}.
+ * @param argument the failing function argument
+ * @param pattern format specifier
+ * @param arguments format arguments
+ * @since 2.0
+ */
+ public FunctionEvaluationException(double[] argument,
+ String pattern, Object ... arguments) {
+ super(pattern, arguments);
+ this.argument = argument.clone();
}
/**
@@ -66,7 +94,19 @@
*/
public FunctionEvaluationException(Throwable cause, double argument) {
super(cause);
- this.argument = argument;
+ this.argument = new double[] { argument };
+ }
+
+ /**
+ * Constructs an exception with specified root cause.
+ * Message formatting is delegated to {...@link java.text.MessageFormat}.
+ * @param cause the exception or error that caused this exception to be
thrown
+ * @param argument the failing function argument
+ * @since 2.0
+ */
+ public FunctionEvaluationException(Throwable cause, double[] argument) {
+ super(cause);
+ this.argument = argument.clone();
}
/**
@@ -82,7 +122,23 @@
double argument, String pattern,
Object ... arguments) {
super(cause, pattern, arguments);
- this.argument = argument;
+ this.argument = new double[] { argument };
+ }
+
+ /**
+ * Constructs an exception with specified formatted detail message and
root cause.
+ * Message formatting is delegated to {...@link java.text.MessageFormat}.
+ * @param cause the exception or error that caused this exception to be
thrown
+ * @param argument the failing function argument
+ * @param pattern format specifier
+ * @param arguments format arguments
+ * @since 2.0
+ */
+ public FunctionEvaluationException(Throwable cause,
+ double[] argument, String pattern,
+ Object ... arguments) {
+ super(cause, pattern, arguments);
+ this.argument = argument.clone();
}
/**
@@ -90,8 +146,8 @@
*
* @return argument that caused function evaluation to fail
*/
- public double getArgument() {
- return this.argument;
+ public double[] getArgument() {
+ return argument.clone();
}
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java?rev=758047&r1=758046&r2=758047&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
Tue Mar 24 22:06:39 2009
@@ -49,8 +49,8 @@
"d\u00e9passement de capacit\u00e9 : le PGCD de {0} et {1} vaut 2^31" },
// org.apache.commons.math.FunctionEvaluationException
- { "Evaluation failed for argument = {0}",
- "Erreur d''\u00e9valuation pour l''argument {0}" },
+ { "evaluation failed for argument = {0}",
+ "erreur d''\u00e9valuation pour l''argument {0}" },
// org.apache.commons.math.DuplicateSampleAbscissaException
{ "Abscissa {0} is duplicated at both indices {1} and {2}",
@@ -142,6 +142,10 @@
{ "unable to perform Q.R decomposition on the {0}x{1} jacobian matrix",
"impossible de calculer la factorisation Q.R de la matrice jacobienne
{0}x{1}" },
+ //
org.apache.commons.math.optimization.general.NonLinearConjugateGradientOptimizer
+ { "unable to bracket optimum in line search",
+ "impossible d''encadrer l''optimum lors de la recherche lin\u00e9aire" },
+
// org.apache.commons.math.geometry.CardanEulerSingularityException
{ "Cardan angles singularity",
"singularit\u00e9 d''angles de Cardan" },