Author: erans
Date: Sun Jul 31 21:27:39 2011
New Revision: 1152644
URL: http://svn.apache.org/viewvc?rev=1152644&view=rev
Log:
MATH-599
Renamed "AllowedSolutions" to "AllowedSolution".
Added:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java
- copied, changed from r1152638,
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolutions.java
Removed:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolutions.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateRealSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFP.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFPTest.java
Copied:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java
(from r1152638,
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolutions.java)
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolutions.java&r1=1152638&r2=1152644&rev=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolutions.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java
Sun Jul 31 21:27:39 2011
@@ -38,7 +38,7 @@ package org.apache.commons.math.analysis
* @since 3.0
* @version $Id$
*/
-public enum AllowedSolutions {
+public enum AllowedSolution {
/** There are no additional side restriction on the solutions for
* root-finding. That is, both under-approximations and over-approximations
* are allowed. So, if a function f(x) has a root at x = x0, then the
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java
Sun Jul 31 21:27:39 2011
@@ -53,7 +53,7 @@ public abstract class BaseSecantSolver
protected static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
/** The kinds of solutions that the algorithm may accept. */
- private AllowedSolutions allowed;
+ private AllowedSolution allowed;
/** The <em>Secant</em>-based root-finding method to use. */
private final Method method;
@@ -66,7 +66,7 @@ public abstract class BaseSecantSolver
*/
protected BaseSecantSolver(final double absoluteAccuracy, final Method
method) {
super(absoluteAccuracy);
- this.allowed = AllowedSolutions.ANY_SIDE;
+ this.allowed = AllowedSolution.ANY_SIDE;
this.method = method;
}
@@ -81,7 +81,7 @@ public abstract class BaseSecantSolver
final double absoluteAccuracy,
final Method method) {
super(relativeAccuracy, absoluteAccuracy);
- this.allowed = AllowedSolutions.ANY_SIDE;
+ this.allowed = AllowedSolution.ANY_SIDE;
this.method = method;
}
@@ -98,22 +98,22 @@ public abstract class BaseSecantSolver
final double functionValueAccuracy,
final Method method) {
super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
- this.allowed = AllowedSolutions.ANY_SIDE;
+ this.allowed = AllowedSolution.ANY_SIDE;
this.method = method;
}
/** {@inheritDoc} */
public double solve(final int maxEval, final UnivariateRealFunction f,
final double min, final double max,
- final AllowedSolutions allowedSolutions) {
- return solve(maxEval, f, min, max, min + 0.5 * (max - min),
allowedSolutions);
+ final AllowedSolution allowedSolution) {
+ return solve(maxEval, f, min, max, min + 0.5 * (max - min),
allowedSolution);
}
/** {@inheritDoc} */
public double solve(final int maxEval, final UnivariateRealFunction f,
final double min, final double max, final double
startValue,
- final AllowedSolutions allowedSolutions) {
- this.allowed = allowedSolutions;
+ final AllowedSolution allowedSolution) {
+ this.allowed = allowedSolution;
return super.solve(maxEval, f, min, max, startValue);
}
@@ -121,7 +121,7 @@ public abstract class BaseSecantSolver
@Override
public double solve(final int maxEval, final UnivariateRealFunction f,
final double min, final double max, final double
startValue) {
- return solve(maxEval, f, min, max, startValue,
AllowedSolutions.ANY_SIDE);
+ return solve(maxEval, f, min, max, startValue,
AllowedSolution.ANY_SIDE);
}
/** {@inheritDoc} */
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateRealSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateRealSolver.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateRealSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateRealSolver.java
Sun Jul 31 21:27:39 2011
@@ -30,17 +30,17 @@ import org.apache.commons.math.analysis.
* return roots that are greater than or equal to the actual root, or
* are less than or equal to the actual root. That is, we can control
* whether under-approximations and over-approximations are
- * {@link AllowedSolutions allowed solutions}. Other root-finding
+ * {@link AllowedSolution allowed solutions}. Other root-finding
* algorithms can usually only guarantee that the solution (the root that
* was found) is around the actual root.</li>
* </ul>
*
* <p>For backwards compatibility, all root-finding algorithms must have
- * {@link AllowedSolutions#ANY_SIDE ANY_SIDE} as default for the allowed
+ * {@link AllowedSolution#ANY_SIDE ANY_SIDE} as default for the allowed
* solutions.</p>
* @param <FUNC> Type of function to solve.
*
- * @see AllowedSolutions
+ * @see AllowedSolution
* @since 3.0
* @version $Id$
*/
@@ -57,7 +57,7 @@ public interface BracketedUnivariateReal
* @param f Function to solve.
* @param min Lower bound for the interval.
* @param max Upper bound for the interval.
- * @param allowedSolutions The kind of solutions that the root-finding
algorithm may
+ * @param allowedSolution The kind of solutions that the root-finding
algorithm may
* accept as solutions.
* @return A value where the function is zero.
* @throws org.apache.commons.math.exception.MathIllegalArgumentException
@@ -66,7 +66,7 @@ public interface BracketedUnivariateReal
* the allowed number of evaluations is exceeded.
*/
double solve(int maxEval, FUNC f, double min, double max,
- AllowedSolutions allowedSolutions);
+ AllowedSolution allowedSolution);
/**
* Solve for a zero in the given interval, start at {@code startValue}.
@@ -79,7 +79,7 @@ public interface BracketedUnivariateReal
* @param min Lower bound for the interval.
* @param max Upper bound for the interval.
* @param startValue Start value to use.
- * @param allowedSolutions The kind of solutions that the root-finding
algorithm may
+ * @param allowedSolution The kind of solutions that the root-finding
algorithm may
* accept as solutions.
* @return A value where the function is zero.
* @throws org.apache.commons.math.exception.MathIllegalArgumentException
@@ -88,6 +88,6 @@ public interface BracketedUnivariateReal
* the allowed number of evaluations is exceeded.
*/
double solve(int maxEval, FUNC f, double min, double max, double
startValue,
- AllowedSolutions allowedSolutions);
+ AllowedSolution allowedSolution);
}
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java
Sun Jul 31 21:27:39 2011
@@ -31,7 +31,7 @@ import org.apache.commons.math.util.Math
* The changes with respect to the original Brent algorithm are:
* <ul>
* <li>the returned value is chosen in the current interval according
- * to user specified {@link AllowedSolutions},</li>
+ * to user specified {@link AllowedSolution},</li>
* <li>the maximal order for the invert polynomial root search is
* user-specified instead of being invert quadratic only</li>
* </ul>
@@ -60,7 +60,7 @@ public class BracketingNthOrderBrentSolv
private final int maximalOrder;
/** The kinds of solutions that the algorithm may accept. */
- private AllowedSolutions allowed;
+ private AllowedSolution allowed;
/**
* Construct a solver with default accuracy and maximal order (1e-6 and 5
respectively)
@@ -84,7 +84,7 @@ public class BracketingNthOrderBrentSolv
throw new NumberIsTooSmallException(maximalOrder, 2, true);
}
this.maximalOrder = maximalOrder;
- this.allowed = AllowedSolutions.ANY_SIDE;
+ this.allowed = AllowedSolution.ANY_SIDE;
}
/**
@@ -104,7 +104,7 @@ public class BracketingNthOrderBrentSolv
throw new NumberIsTooSmallException(maximalOrder, 2, true);
}
this.maximalOrder = maximalOrder;
- this.allowed = AllowedSolutions.ANY_SIDE;
+ this.allowed = AllowedSolution.ANY_SIDE;
}
/**
@@ -126,7 +126,7 @@ public class BracketingNthOrderBrentSolv
throw new NumberIsTooSmallException(maximalOrder, 2, true);
}
this.maximalOrder = maximalOrder;
- this.allowed = AllowedSolutions.ANY_SIDE;
+ this.allowed = AllowedSolution.ANY_SIDE;
}
/** Get the maximal order.
@@ -381,16 +381,16 @@ public class BracketingNthOrderBrentSolv
/** {@inheritDoc} */
public double solve(int maxEval, UnivariateRealFunction f, double min,
- double max, AllowedSolutions allowedSolutions) {
- this.allowed = allowedSolutions;
+ double max, AllowedSolution allowedSolution) {
+ this.allowed = allowedSolution;
return super.solve(maxEval, f, min, max);
}
/** {@inheritDoc} */
public double solve(int maxEval, UnivariateRealFunction f, double min,
double max, double startValue,
- AllowedSolutions allowedSolutions) {
- this.allowed = allowedSolutions;
+ AllowedSolution allowedSolution) {
+ this.allowed = allowedSolution;
return super.solve(maxEval, f, min, max, startValue);
}
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java
Sun Jul 31 21:27:39 2011
@@ -87,16 +87,16 @@ public class UnivariateRealSolverUtils {
* @param baseRoot original root found by a previous non-bracketing solver
* @param min minimal bound of the search interval
* @param max maximal bound of the search interval
- * @param allowedSolutions the kind of solutions that the root-finding
algorithm may
+ * @param allowedSolution the kind of solutions that the root-finding
algorithm may
* accept as solutions.
* @return a root approximation, on the specified side of the exact root
*/
public static double forceSide(final int maxEval, final
UnivariateRealFunction f,
final
BracketedUnivariateRealSolver<UnivariateRealFunction> bracketing,
final double baseRoot, final double min,
final double max,
- final AllowedSolutions allowedSolutions) {
+ final AllowedSolution allowedSolution) {
- if (allowedSolutions == AllowedSolutions.ANY_SIDE) {
+ if (allowedSolution == AllowedSolution.ANY_SIDE) {
// no further bracketing required
return baseRoot;
}
@@ -113,7 +113,7 @@ public class UnivariateRealSolverUtils {
if ((fLo >= 0 && fHi <= 0) || (fLo <= 0 && fHi >= 0)) {
// compute the root on the selected side
- return bracketing.solve(remainingEval, f, xLo, xHi, baseRoot,
allowedSolutions);
+ return bracketing.solve(remainingEval, f, xLo, xHi, baseRoot,
allowedSolution);
}
// try increasing the interval
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFP.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFP.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFP.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFP.java
Sun Jul 31 21:27:39 2011
@@ -17,7 +17,7 @@
package org.apache.commons.math.dfp;
-import org.apache.commons.math.analysis.solvers.AllowedSolutions;
+import org.apache.commons.math.analysis.solvers.AllowedSolution;
import org.apache.commons.math.exception.MathInternalError;
import org.apache.commons.math.exception.NoBracketingException;
import org.apache.commons.math.exception.NumberIsTooSmallException;
@@ -31,7 +31,7 @@ import org.apache.commons.math.util.Math
* The changes with respect to the original Brent algorithm are:
* <ul>
* <li>the returned value is chosen in the current interval according
- * to user specified {@link AllowedSolutions},</li>
+ * to user specified {@link AllowedSolution},</li>
* <li>the maximal order for the invert polynomial root search is
* user-specified instead of being invert quadratic only</li>
* </ul>
@@ -145,7 +145,7 @@ public class BracketingNthOrderBrentSolv
* @param f Function to solve.
* @param min Lower bound for the interval.
* @param max Upper bound for the interval.
- * @param allowedSolutions The kind of solutions that the root-finding
algorithm may
+ * @param allowedSolution The kind of solutions that the root-finding
algorithm may
* accept as solutions.
* @return a value where the function is zero.
* @throws org.apache.commons.math.exception.MathIllegalArgumentException
@@ -154,8 +154,8 @@ public class BracketingNthOrderBrentSolv
* the allowed number of evaluations is exceeded.
*/
public Dfp solve(final int maxEval, final UnivariateDfpFunction f,
- final Dfp min, final Dfp max, final AllowedSolutions
allowedSolutions) {
- return solve(maxEval, f, min, max, min.add(max).divide(2),
allowedSolutions);
+ final Dfp min, final Dfp max, final AllowedSolution
allowedSolution) {
+ return solve(maxEval, f, min, max, min.add(max).divide(2),
allowedSolution);
}
/**
@@ -169,7 +169,7 @@ public class BracketingNthOrderBrentSolv
* @param min Lower bound for the interval.
* @param max Upper bound for the interval.
* @param startValue Start value to use.
- * @param allowedSolutions The kind of solutions that the root-finding
algorithm may
+ * @param allowedSolution The kind of solutions that the root-finding
algorithm may
* accept as solutions.
* @return a value where the function is zero.
* @throws org.apache.commons.math.exception.MathIllegalArgumentException
@@ -179,7 +179,7 @@ public class BracketingNthOrderBrentSolv
*/
public Dfp solve(final int maxEval, final UnivariateDfpFunction f,
final Dfp min, final Dfp max, final Dfp startValue,
- final AllowedSolutions allowedSolutions) {
+ final AllowedSolution allowedSolution) {
// Checks.
MathUtils.checkNotNull(f);
@@ -266,7 +266,7 @@ public class BracketingNthOrderBrentSolv
final Dfp xTol =
absoluteAccuracy.add(relativeAccuracy.multiply(maxX));
if (xB.subtract(xA).subtract(xTol).negativeOrNull() ||
maxY.lessThan(functionValueAccuracy)) {
- switch (allowedSolutions) {
+ switch (allowedSolution) {
case ANY_SIDE :
return absYA.lessThan(absYB) ? xA : xB;
case LEFT_SIDE :
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java
Sun Jul 31 21:27:39 2011
@@ -19,7 +19,7 @@ package org.apache.commons.math.ode.even
import org.apache.commons.math.ConvergenceException;
import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.analysis.solvers.AllowedSolutions;
+import org.apache.commons.math.analysis.solvers.AllowedSolution;
import org.apache.commons.math.analysis.solvers.BracketedUnivariateRealSolver;
import org.apache.commons.math.analysis.solvers.PegasusSolver;
import org.apache.commons.math.analysis.solvers.UnivariateRealSolver;
@@ -244,8 +244,8 @@ public class EventState {
BracketedUnivariateRealSolver<UnivariateRealFunction>
bracketing =
(BracketedUnivariateRealSolver<UnivariateRealFunction>) solver;
root = forward ?
- bracketing.solve(maxIterationCount, f, ta, tb,
AllowedSolutions.RIGHT_SIDE) :
- bracketing.solve(maxIterationCount, f, tb, ta,
AllowedSolutions.LEFT_SIDE);
+ bracketing.solve(maxIterationCount, f, ta, tb,
AllowedSolution.RIGHT_SIDE) :
+ bracketing.solve(maxIterationCount, f, tb, ta,
AllowedSolution.LEFT_SIDE);
} else {
final double baseRoot = forward ?
solver.solve(maxIterationCount, f, ta, tb) :
@@ -255,9 +255,9 @@ public class EventState {
new
PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy());
root = forward ?
UnivariateRealSolverUtils.forceSide(remainingEval, f, bracketing,
- baseRoot,
ta, tb, AllowedSolutions.RIGHT_SIDE) :
+ baseRoot,
ta, tb, AllowedSolution.RIGHT_SIDE) :
UnivariateRealSolverUtils.forceSide(remainingEval, f, bracketing,
- baseRoot,
tb, ta, AllowedSolutions.LEFT_SIDE);
+ baseRoot,
tb, ta, AllowedSolution.LEFT_SIDE);
}
if ((!Double.isNaN(previousEventTime)) &&
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java
Sun Jul 31 21:27:39 2011
@@ -166,7 +166,7 @@ public abstract class BaseSecantSolverAb
double right = 0.05;
for(int i = 0; i < 10; i++) {
// Test whether the allowed solutions are taken into account.
- double solution = getSolution(solver, 100, f, left, right,
AllowedSolutions.LEFT_SIDE);
+ double solution = getSolution(solver, 100, f, left, right,
AllowedSolution.LEFT_SIDE);
if (!Double.isNaN(solution)) {
Assert.assertTrue(solution <= 0.0);
}
@@ -185,7 +185,7 @@ public abstract class BaseSecantSolverAb
double right = 0.05;
for(int i = 0; i < 10; i++) {
// Test whether the allowed solutions are taken into account.
- double solution = getSolution(solver, 100, f, left, right,
AllowedSolutions.RIGHT_SIDE);
+ double solution = getSolution(solver, 100, f, left, right,
AllowedSolution.RIGHT_SIDE);
if (!Double.isNaN(solution)) {
Assert.assertTrue(solution >= 0.0);
}
@@ -203,7 +203,7 @@ public abstract class BaseSecantSolverAb
double right = 0.05;
for(int i = 0; i < 10; i++) {
// Test whether the allowed solutions are taken into account.
- double solution = getSolution(solver, 100, f, left, right,
AllowedSolutions.BELOW_SIDE);
+ double solution = getSolution(solver, 100, f, left, right,
AllowedSolution.BELOW_SIDE);
if (!Double.isNaN(solution)) {
Assert.assertTrue(f.value(solution) <= 0.0);
}
@@ -222,7 +222,7 @@ public abstract class BaseSecantSolverAb
double right = 0.05;
for(int i = 0; i < 10; i++) {
// Test whether the allowed solutions are taken into account.
- double solution = getSolution(solver, 100, f, left, right,
AllowedSolutions.ABOVE_SIDE);
+ double solution = getSolution(solver, 100, f, left, right,
AllowedSolution.ABOVE_SIDE);
if (!Double.isNaN(solution)) {
Assert.assertTrue(f.value(solution) >= 0.0);
}
@@ -234,12 +234,12 @@ public abstract class BaseSecantSolverAb
}
private double getSolution(UnivariateRealSolver solver, int maxEval,
UnivariateRealFunction f,
- double left, double right, AllowedSolutions
allowedSolutions) {
+ double left, double right, AllowedSolution
allowedSolution) {
try {
@SuppressWarnings("unchecked")
BracketedUnivariateRealSolver<UnivariateRealFunction> bracketing =
(BracketedUnivariateRealSolver<UnivariateRealFunction>) solver;
- return bracketing.solve(100, f, left, right, allowedSolutions);
+ return bracketing.solve(100, f, left, right, allowedSolution);
} catch (ClassCastException cce) {
double baseRoot = solver.solve(maxEval, f, left, right);
if ((baseRoot <= left) || (baseRoot >= right)) {
@@ -251,7 +251,7 @@ public abstract class BaseSecantSolverAb
solver.getFunctionValueAccuracy());
return UnivariateRealSolverUtils.forceSide(maxEval -
solver.getEvaluations(),
f, bracketing,
baseRoot, left, right,
- allowedSolutions);
+ allowedSolution);
}
}
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java
Sun Jul 31 21:27:39 2011
@@ -69,11 +69,11 @@ public final class BracketingNthOrderBre
BracketingNthOrderBrentSolver solver =
new BracketingNthOrderBrentSolver(1.0e-12, 1.0e-10, 0.001, 3);
QuinticFunction f = new QuinticFunction();
- double result = solver.solve(20, f, 0.2, 0.9, 0.4,
AllowedSolutions.BELOW_SIDE);
+ double result = solver.solve(20, f, 0.2, 0.9, 0.4,
AllowedSolution.BELOW_SIDE);
Assert.assertEquals(0, f.value(result),
solver.getFunctionValueAccuracy());
Assert.assertTrue(f.value(result) <= 0);
Assert.assertTrue(result - 0.5 > solver.getAbsoluteAccuracy());
- result = solver.solve(20, f, -0.9, -0.2, -0.4,
AllowedSolutions.ABOVE_SIDE);
+ result = solver.solve(20, f, -0.9, -0.2, -0.4,
AllowedSolution.ABOVE_SIDE);
Assert.assertEquals(0, f.value(result),
solver.getFunctionValueAccuracy());
Assert.assertTrue(f.value(result) >= 0);
Assert.assertTrue(result + 0.5 < -solver.getAbsoluteAccuracy());
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFPTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFPTest.java?rev=1152644&r1=1152643&r2=1152644&view=diff
==============================================================================
---
commons/proper/math/trunk/src/test/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFPTest.java
(original)
+++
commons/proper/math/trunk/src/test/java/org/apache/commons/math/dfp/BracketingNthOrderBrentSolverDFPTest.java
Sun Jul 31 21:27:39 2011
@@ -17,7 +17,7 @@
package org.apache.commons.math.dfp;
-import org.apache.commons.math.analysis.solvers.AllowedSolutions;
+import org.apache.commons.math.analysis.solvers.AllowedSolution;
import org.apache.commons.math.exception.MathInternalError;
import org.apache.commons.math.exception.NumberIsTooSmallException;
import org.junit.Assert;
@@ -63,12 +63,12 @@ public final class BracketingNthOrderBre
};
Dfp result = solver.solve(20, f, field.newDfp(0.2), field.newDfp(0.9),
- field.newDfp(0.4),
AllowedSolutions.BELOW_SIDE);
+ field.newDfp(0.4),
AllowedSolution.BELOW_SIDE);
Assert.assertTrue(f.value(result).abs().lessThan(solver.getFunctionValueAccuracy()));
Assert.assertTrue(f.value(result).negativeOrNull());
Assert.assertTrue(result.subtract(field.newDfp(0.5)).subtract(solver.getAbsoluteAccuracy()).positiveOrNull());
result = solver.solve(20, f, field.newDfp(-0.9), field.newDfp(-0.2),
- field.newDfp(-0.4), AllowedSolutions.ABOVE_SIDE);
+ field.newDfp(-0.4), AllowedSolution.ABOVE_SIDE);
Assert.assertTrue(f.value(result).abs().lessThan(solver.getFunctionValueAccuracy()));
Assert.assertTrue(f.value(result).positiveOrNull());
Assert.assertTrue(result.add(field.newDfp(0.5)).subtract(solver.getAbsoluteAccuracy()).negativeOrNull());
@@ -81,7 +81,7 @@ public final class BracketingNthOrderBre
// "Several New Methods for solving Equations"
// intern J. Computer Math Vol 23 pp 265-282
// available here:
http://www.math.nps.navy.mil/~bneta/SeveralNewMethods.PDF
- for (AllowedSolutions allowed : AllowedSolutions.values()) {
+ for (AllowedSolution allowed : AllowedSolution.values()) {
check(new UnivariateDfpFunction() {
public Dfp value(Dfp x) {
return DfpMath.sin(x).subtract(x.divide(2));
@@ -122,14 +122,14 @@ public final class BracketingNthOrderBre
}
private void check(UnivariateDfpFunction f, int maxEval, double min,
double max,
- AllowedSolutions allowedSolutions) {
+ AllowedSolution allowedSolution) {
BracketingNthOrderBrentSolverDFP solver =
new BracketingNthOrderBrentSolverDFP(relativeAccuracy,
absoluteAccuracy,
functionValueAccuracy,
20);
Dfp xResult = solver.solve(maxEval, f, field.newDfp(min),
field.newDfp(max),
- allowedSolutions);
+ allowedSolution);
Dfp yResult = f.value(xResult);
- switch (allowedSolutions) {
+ switch (allowedSolution) {
case ANY_SIDE :
Assert.assertTrue(yResult.abs().lessThan(functionValueAccuracy.multiply(2)));
break;