diff --git a/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java b/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java index 8de5878b2..eb708c831 100644 --- a/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java +++ b/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java @@ -17,7 +17,7 @@ package org.apache.commons.math.analysis.integration; import org.apache.commons.math.analysis.UnivariateFunction; -import org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils; +import org.apache.commons.math.analysis.solvers.UnivariateSolverUtils; import org.apache.commons.math.exception.MathIllegalArgumentException; import org.apache.commons.math.exception.MaxCountExceededException; import org.apache.commons.math.exception.NotStrictlyPositiveException; @@ -226,7 +226,7 @@ public abstract class UnivariateRealIntegratorImpl implements UnivariateRealInte // Checks. MathUtils.checkNotNull(f); - UnivariateRealSolverUtils.verifyInterval(lower, upper); + UnivariateSolverUtils.verifyInterval(lower, upper); // Reset. this.min = lower; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/AbstractDifferentiableUnivariateRealSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/AbstractDifferentiableUnivariateSolver.java similarity index 87% rename from src/main/java/org/apache/commons/math/analysis/solvers/AbstractDifferentiableUnivariateRealSolver.java rename to src/main/java/org/apache/commons/math/analysis/solvers/AbstractDifferentiableUnivariateSolver.java index 3cf675a41..f7b6ebcdb 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/AbstractDifferentiableUnivariateRealSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/AbstractDifferentiableUnivariateSolver.java @@ -27,9 +27,9 @@ import org.apache.commons.math.analysis.UnivariateFunction; * @version $Id$ * @since 3.0 */ -public abstract class AbstractDifferentiableUnivariateRealSolver - extends BaseAbstractUnivariateRealSolver - implements DifferentiableUnivariateRealSolver { +public abstract class AbstractDifferentiableUnivariateSolver + extends BaseAbstractUnivariateSolver + implements DifferentiableUnivariateSolver { /** Derivative of the function to solve. */ private UnivariateFunction functionDerivative; @@ -38,7 +38,7 @@ public abstract class AbstractDifferentiableUnivariateRealSolver * * @param absoluteAccuracy Maximum absolute error. */ - protected AbstractDifferentiableUnivariateRealSolver(final double absoluteAccuracy) { + protected AbstractDifferentiableUnivariateSolver(final double absoluteAccuracy) { super(absoluteAccuracy); } @@ -49,7 +49,7 @@ public abstract class AbstractDifferentiableUnivariateRealSolver * @param absoluteAccuracy Maximum absolute error. * @param functionValueAccuracy Maximum function value error. */ - protected AbstractDifferentiableUnivariateRealSolver(final double relativeAccuracy, + protected AbstractDifferentiableUnivariateSolver(final double relativeAccuracy, final double absoluteAccuracy, final double functionValueAccuracy) { super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy); diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/AbstractPolynomialSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/AbstractPolynomialSolver.java index be3faf1b7..197a19a2f 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/AbstractPolynomialSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/AbstractPolynomialSolver.java @@ -26,7 +26,7 @@ import org.apache.commons.math.analysis.polynomials.PolynomialFunction; * @since 3.0 */ public abstract class AbstractPolynomialSolver - extends BaseAbstractUnivariateRealSolver + extends BaseAbstractUnivariateSolver implements PolynomialSolver { /** Function. */ private PolynomialFunction polynomialFunction; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/AbstractUnivariateRealSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/AbstractUnivariateSolver.java similarity index 83% rename from src/main/java/org/apache/commons/math/analysis/solvers/AbstractUnivariateRealSolver.java rename to src/main/java/org/apache/commons/math/analysis/solvers/AbstractUnivariateSolver.java index 9947bc082..55776c4e9 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/AbstractUnivariateRealSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/AbstractUnivariateSolver.java @@ -25,15 +25,15 @@ import org.apache.commons.math.analysis.UnivariateFunction; * @version $Id$ * @since 3.0 */ -public abstract class AbstractUnivariateRealSolver - extends BaseAbstractUnivariateRealSolver - implements UnivariateRealSolver { +public abstract class AbstractUnivariateSolver + extends BaseAbstractUnivariateSolver + implements UnivariateSolver { /** * Construct a solver with given absolute accuracy. * * @param absoluteAccuracy Maximum absolute error. */ - protected AbstractUnivariateRealSolver(final double absoluteAccuracy) { + protected AbstractUnivariateSolver(final double absoluteAccuracy) { super(absoluteAccuracy); } /** @@ -42,7 +42,7 @@ public abstract class AbstractUnivariateRealSolver * @param relativeAccuracy Maximum relative error. * @param absoluteAccuracy Maximum absolute error. */ - protected AbstractUnivariateRealSolver(final double relativeAccuracy, + protected AbstractUnivariateSolver(final double relativeAccuracy, final double absoluteAccuracy) { super(relativeAccuracy, absoluteAccuracy); } @@ -53,7 +53,7 @@ public abstract class AbstractUnivariateRealSolver * @param absoluteAccuracy Maximum absolute error. * @param functionValueAccuracy Maximum function value error. */ - protected AbstractUnivariateRealSolver(final double relativeAccuracy, + protected AbstractUnivariateSolver(final double relativeAccuracy, final double absoluteAccuracy, final double functionValueAccuracy) { super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy); diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java b/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java index 985f35b83..e3a9b6c2b 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/AllowedSolution.java @@ -18,7 +18,7 @@ package org.apache.commons.math.analysis.solvers; -/** The kinds of solutions that a {@link BracketedUnivariateRealSolver +/** The kinds of solutions that a {@link BracketedUnivariateSolver * (bracketed univariate real) root-finding algorithm} may accept as solutions. * This basically controls whether or not under-approximations and * over-approximations are allowed. @@ -34,7 +34,7 @@ package org.apache.commons.math.analysis.solvers; * may be necessary to guarantee that a solution is returned that lies on a * specific side the solution.

* - * @see BracketedUnivariateRealSolver + * @see BracketedUnivariateSolver * @since 3.0 * @version $Id$ */ diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/BaseAbstractUnivariateRealSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/BaseAbstractUnivariateSolver.java similarity index 92% rename from src/main/java/org/apache/commons/math/analysis/solvers/BaseAbstractUnivariateRealSolver.java rename to src/main/java/org/apache/commons/math/analysis/solvers/BaseAbstractUnivariateSolver.java index 39a332ce0..2630cfb21 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/BaseAbstractUnivariateRealSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/BaseAbstractUnivariateSolver.java @@ -33,8 +33,8 @@ import org.apache.commons.math.util.MathUtils; * @version $Id$ * @since 2.0 */ -public abstract class BaseAbstractUnivariateRealSolver - implements BaseUnivariateRealSolver { +public abstract class BaseAbstractUnivariateSolver + implements BaseUnivariateSolver { /** Default relative accuracy. */ private static final double DEFAULT_RELATIVE_ACCURACY = 1e-14; /** Default function value accuracy. */ @@ -61,7 +61,7 @@ public abstract class BaseAbstractUnivariateRealSolver { + extends AbstractUnivariateSolver + implements BracketedUnivariateSolver { /** Default absolute accuracy. */ protected static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/BaseUnivariateRealSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/BaseUnivariateSolver.java similarity index 95% rename from src/main/java/org/apache/commons/math/analysis/solvers/BaseUnivariateRealSolver.java rename to src/main/java/org/apache/commons/math/analysis/solvers/BaseUnivariateSolver.java index 251fa667a..3419f7a6d 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/BaseUnivariateRealSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/BaseUnivariateSolver.java @@ -25,17 +25,17 @@ import org.apache.commons.math.analysis.UnivariateFunction; * * This class is not intended for use outside of the Apache Commons Math * library, regular user should rely on more specific interfaces like - * {@link UnivariateRealSolver}, {@link PolynomialSolver} or {@link - * DifferentiableUnivariateRealSolver}. + * {@link UnivariateSolver}, {@link PolynomialSolver} or {@link + * DifferentiableUnivariateSolver}. * @param Type of function to solve. * * @version $Id$ * @since 3.0 - * @see UnivariateRealSolver + * @see UnivariateSolver * @see PolynomialSolver - * @see DifferentiableUnivariateRealSolver + * @see DifferentiableUnivariateSolver */ -public interface BaseUnivariateRealSolver { +public interface BaseUnivariateSolver { /** * Get the maximum number of function evaluations. * diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java index 0b224a36e..b9fc936f3 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java @@ -26,7 +26,7 @@ import org.apache.commons.math.util.FastMath; * * @version $Id$ */ -public class BisectionSolver extends AbstractUnivariateRealSolver { +public class BisectionSolver extends AbstractUnivariateSolver { /** Default absolute accuracy. */ private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; @@ -69,7 +69,7 @@ public class BisectionSolver extends AbstractUnivariateRealSolver { double fmin; while (true) { - m = UnivariateRealSolverUtils.midpoint(min, max); + m = UnivariateSolverUtils.midpoint(min, max); fmin = computeObjectiveValue(min); fm = computeObjectiveValue(m); @@ -82,7 +82,7 @@ public class BisectionSolver extends AbstractUnivariateRealSolver { } if (FastMath.abs(max - min) <= absoluteAccuracy) { - m = UnivariateRealSolverUtils.midpoint(min, max); + m = UnivariateSolverUtils.midpoint(min, max); return m; } } diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateRealSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateSolver.java similarity index 95% rename from src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateRealSolver.java rename to src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateSolver.java index 1b2088821..fd3693fe8 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateRealSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/BracketedUnivariateSolver.java @@ -19,7 +19,7 @@ package org.apache.commons.math.analysis.solvers; import org.apache.commons.math.analysis.UnivariateFunction; -/** Interface for {@link UnivariateRealSolver (univariate real) root-finding +/** Interface for {@link UnivariateSolver (univariate real) root-finding * algorithms} that maintain a bracketed solution. There are several advantages * to having such root-finding algorithms: *
    @@ -44,8 +44,8 @@ import org.apache.commons.math.analysis.UnivariateFunction; * @since 3.0 * @version $Id$ */ -public interface BracketedUnivariateRealSolver - extends BaseUnivariateRealSolver { +public interface BracketedUnivariateSolver + extends BaseUnivariateSolver { /** * Solve for a zero in the given interval. diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java index 59dc4617b..cfa430706 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver.java @@ -41,8 +41,8 @@ import org.apache.commons.math.util.Precision; * @version $Id$ */ public class BracketingNthOrderBrentSolver - extends AbstractUnivariateRealSolver - implements BracketedUnivariateRealSolver { + extends AbstractUnivariateSolver + implements BracketedUnivariateSolver { /** Default absolute accuracy. */ private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java index 1eb0d8c71..9957af8cd 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java @@ -33,7 +33,7 @@ import org.apache.commons.math.util.Precision; * * @version $Id$ */ -public class BrentSolver extends AbstractUnivariateRealSolver { +public class BrentSolver extends AbstractUnivariateSolver { /** Default absolute accuracy. */ private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/DifferentiableUnivariateRealSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/DifferentiableUnivariateSolver.java similarity index 89% rename from src/main/java/org/apache/commons/math/analysis/solvers/DifferentiableUnivariateRealSolver.java rename to src/main/java/org/apache/commons/math/analysis/solvers/DifferentiableUnivariateSolver.java index db02b522d..fc4aab28e 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/DifferentiableUnivariateRealSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/DifferentiableUnivariateSolver.java @@ -25,5 +25,5 @@ import org.apache.commons.math.analysis.DifferentiableUnivariateFunction; * * @version $Id$ */ -public interface DifferentiableUnivariateRealSolver - extends BaseUnivariateRealSolver {} +public interface DifferentiableUnivariateSolver + extends BaseUnivariateSolver {} diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java index 4d8977544..080016630 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java @@ -44,7 +44,7 @@ import org.apache.commons.math.util.FastMath; * @since 1.2 * @see MullerSolver2 */ -public class MullerSolver extends AbstractUnivariateRealSolver { +public class MullerSolver extends AbstractUnivariateSolver { /** Default absolute accuracy. */ private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver2.java b/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver2.java index 04ab77d8c..5a26ce158 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver2.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver2.java @@ -45,7 +45,7 @@ import org.apache.commons.math.util.FastMath; * @since 1.2 * @see MullerSolver */ -public class MullerSolver2 extends AbstractUnivariateRealSolver { +public class MullerSolver2 extends AbstractUnivariateSolver { /** Default absolute accuracy. */ private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java index f7990286a..1098d1437 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java @@ -28,7 +28,7 @@ import org.apache.commons.math.util.FastMath; * * @version $Id$ */ -public class NewtonSolver extends AbstractDifferentiableUnivariateRealSolver { +public class NewtonSolver extends AbstractDifferentiableUnivariateSolver { /** Default absolute accuracy. */ private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; @@ -63,7 +63,7 @@ public class NewtonSolver extends AbstractDifferentiableUnivariateRealSolver { @Override public double solve(int maxEval, final DifferentiableUnivariateFunction f, final double min, final double max) { - return super.solve(maxEval, f, UnivariateRealSolverUtils.midpoint(min, max)); + return super.solve(maxEval, f, UnivariateSolverUtils.midpoint(min, max)); } /** diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/PolynomialSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/PolynomialSolver.java index ca58682f8..012f828a0 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/PolynomialSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/PolynomialSolver.java @@ -26,4 +26,4 @@ import org.apache.commons.math.analysis.polynomials.PolynomialFunction; * @since 3.0 */ public interface PolynomialSolver - extends BaseUnivariateRealSolver {} + extends BaseUnivariateSolver {} diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java index 664e10df6..8f229bafa 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java @@ -30,7 +30,7 @@ import org.apache.commons.math.util.FastMath; * @version $Id$ * @since 1.2 */ -public class RiddersSolver extends AbstractUnivariateRealSolver { +public class RiddersSolver extends AbstractUnivariateSolver { /** Default absolute accuracy. */ private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java index 363a8b3c7..aa46ec562 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java @@ -38,7 +38,7 @@ import org.apache.commons.math.util.FastMath; * * @version $Id$ */ -public class SecantSolver extends AbstractUnivariateRealSolver { +public class SecantSolver extends AbstractUnivariateSolver { /** Default absolute accuracy. */ protected static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6; diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java b/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateSolver.java similarity index 91% rename from src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java rename to src/main/java/org/apache/commons/math/analysis/solvers/UnivariateSolver.java index c7f02c567..0d4b24bfb 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateSolver.java @@ -25,5 +25,5 @@ import org.apache.commons.math.analysis.UnivariateFunction; * * @version $Id$ */ -public interface UnivariateRealSolver - extends BaseUnivariateRealSolver {} +public interface UnivariateSolver + extends BaseUnivariateSolver {} diff --git a/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java b/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateSolverUtils.java similarity index 97% rename from src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java rename to src/main/java/org/apache/commons/math/analysis/solvers/UnivariateSolverUtils.java index ee60aa15c..3e0e70241 100644 --- a/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java +++ b/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateSolverUtils.java @@ -25,15 +25,15 @@ import org.apache.commons.math.exception.util.LocalizedFormats; import org.apache.commons.math.util.FastMath; /** - * Utility routines for {@link UnivariateRealSolver} objects. + * Utility routines for {@link UnivariateSolver} objects. * * @version $Id$ */ -public class UnivariateRealSolverUtils { +public class UnivariateSolverUtils { /** * Class contains only static methods. */ - private UnivariateRealSolverUtils() {} + private UnivariateSolverUtils() {} /** * Convenience method to find a zero of a univariate real function. A default @@ -50,7 +50,7 @@ public class UnivariateRealSolverUtils { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } - final UnivariateRealSolver solver = new BrentSolver(); + final UnivariateSolver solver = new BrentSolver(); return solver.solve(Integer.MAX_VALUE, function, x0, x1); } @@ -73,7 +73,7 @@ public class UnivariateRealSolverUtils { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } - final UnivariateRealSolver solver = new BrentSolver(absoluteAccuracy); + final UnivariateSolver solver = new BrentSolver(absoluteAccuracy); return solver.solve(Integer.MAX_VALUE, function, x0, x1); } @@ -92,7 +92,7 @@ public class UnivariateRealSolverUtils { * @return a root approximation, on the specified side of the exact root */ public static double forceSide(final int maxEval, final UnivariateFunction f, - final BracketedUnivariateRealSolver bracketing, + final BracketedUnivariateSolver bracketing, final double baseRoot, final double min, final double max, final AllowedSolution allowedSolution) { diff --git a/src/main/java/org/apache/commons/math/distribution/AbstractRealDistribution.java b/src/main/java/org/apache/commons/math/distribution/AbstractRealDistribution.java index fb202eb2a..07686b603 100644 --- a/src/main/java/org/apache/commons/math/distribution/AbstractRealDistribution.java +++ b/src/main/java/org/apache/commons/math/distribution/AbstractRealDistribution.java @@ -19,7 +19,7 @@ package org.apache.commons.math.distribution; import java.io.Serializable; import org.apache.commons.math.analysis.UnivariateFunction; -import org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils; +import org.apache.commons.math.analysis.solvers.UnivariateSolverUtils; import org.apache.commons.math.exception.NotStrictlyPositiveException; import org.apache.commons.math.exception.NumberIsTooLargeException; import org.apache.commons.math.exception.OutOfRangeException; @@ -153,7 +153,7 @@ implements RealDistribution, Serializable { } }; - double x = UnivariateRealSolverUtils.solve(toSolve, + double x = UnivariateSolverUtils.solve(toSolve, lowerBound, upperBound, getSolverAbsoluteAccuracy()); diff --git a/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java b/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java index fe121c97d..9d38c2afc 100644 --- a/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java +++ b/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java @@ -27,7 +27,7 @@ import java.util.SortedSet; import java.util.TreeSet; import org.apache.commons.math.analysis.solvers.BracketingNthOrderBrentSolver; -import org.apache.commons.math.analysis.solvers.UnivariateRealSolver; +import org.apache.commons.math.analysis.solvers.UnivariateSolver; import org.apache.commons.math.exception.DimensionMismatchException; import org.apache.commons.math.exception.MathIllegalArgumentException; import org.apache.commons.math.exception.MathIllegalStateException; @@ -135,7 +135,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { final double maxCheckInterval, final double convergence, final int maxIterationCount, - final UnivariateRealSolver solver) { + final UnivariateSolver solver) { eventsStates.add(new EventState(handler, maxCheckInterval, convergence, maxIterationCount, solver)); } diff --git a/src/main/java/org/apache/commons/math/ode/ODEIntegrator.java b/src/main/java/org/apache/commons/math/ode/ODEIntegrator.java index 315d242b2..99acc3448 100644 --- a/src/main/java/org/apache/commons/math/ode/ODEIntegrator.java +++ b/src/main/java/org/apache/commons/math/ode/ODEIntegrator.java @@ -19,7 +19,7 @@ package org.apache.commons.math.ode; import java.util.Collection; -import org.apache.commons.math.analysis.solvers.UnivariateRealSolver; +import org.apache.commons.math.analysis.solvers.UnivariateSolver; import org.apache.commons.math.ode.events.EventHandler; import org.apache.commons.math.ode.sampling.StepHandler; @@ -64,7 +64,7 @@ public interface ODEIntegrator { void clearStepHandlers(); /** Add an event handler to the integrator. - * Uses a default {@link UnivariateRealSolver} + * Uses a default {@link UnivariateSolver} * with an absolute accuracy equal to the given convergence threshold, * as root-finding algorithm to detect the state events. * @param handler event handler @@ -95,7 +95,7 @@ public interface ODEIntegrator { */ void addEventHandler(EventHandler handler, double maxCheckInterval, double convergence, int maxIterationCount, - UnivariateRealSolver solver); + UnivariateSolver solver); /** Get all the event handlers that have been added to the integrator. * @return an unmodifiable collection of the added events handlers diff --git a/src/main/java/org/apache/commons/math/ode/events/EventState.java b/src/main/java/org/apache/commons/math/ode/events/EventState.java index 25b2876f3..c4bfca7b4 100644 --- a/src/main/java/org/apache/commons/math/ode/events/EventState.java +++ b/src/main/java/org/apache/commons/math/ode/events/EventState.java @@ -19,10 +19,10 @@ package org.apache.commons.math.ode.events; import org.apache.commons.math.analysis.UnivariateFunction; import org.apache.commons.math.analysis.solvers.AllowedSolution; -import org.apache.commons.math.analysis.solvers.BracketedUnivariateRealSolver; +import org.apache.commons.math.analysis.solvers.BracketedUnivariateSolver; import org.apache.commons.math.analysis.solvers.PegasusSolver; -import org.apache.commons.math.analysis.solvers.UnivariateRealSolver; -import org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils; +import org.apache.commons.math.analysis.solvers.UnivariateSolver; +import org.apache.commons.math.analysis.solvers.UnivariateSolverUtils; import org.apache.commons.math.exception.ConvergenceException; import org.apache.commons.math.ode.events.EventHandler; import org.apache.commons.math.ode.sampling.StepInterpolator; @@ -85,7 +85,7 @@ public class EventState { private EventHandler.Action nextAction; /** Root-finding algorithm to use to detect state events. */ - private final UnivariateRealSolver solver; + private final UnivariateSolver solver; /** Simple constructor. * @param handler event handler @@ -99,7 +99,7 @@ public class EventState { */ public EventState(final EventHandler handler, final double maxCheckInterval, final double convergence, final int maxIterationCount, - final UnivariateRealSolver solver) { + final UnivariateSolver solver) { this.handler = handler; this.maxCheckInterval = maxCheckInterval; this.convergence = FastMath.abs(convergence); @@ -222,10 +222,10 @@ public class EventState { // find the event time making sure we select a solution just at or past the exact root final double root; - if (solver instanceof BracketedUnivariateRealSolver) { + if (solver instanceof BracketedUnivariateSolver) { @SuppressWarnings("unchecked") - BracketedUnivariateRealSolver bracketing = - (BracketedUnivariateRealSolver) solver; + BracketedUnivariateSolver bracketing = + (BracketedUnivariateSolver) solver; root = forward ? bracketing.solve(maxIterationCount, f, ta, tb, AllowedSolution.RIGHT_SIDE) : bracketing.solve(maxIterationCount, f, tb, ta, AllowedSolution.LEFT_SIDE); @@ -234,12 +234,12 @@ public class EventState { solver.solve(maxIterationCount, f, ta, tb) : solver.solve(maxIterationCount, f, tb, ta); final int remainingEval = maxIterationCount - solver.getEvaluations(); - BracketedUnivariateRealSolver bracketing = + BracketedUnivariateSolver bracketing = new PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy()); root = forward ? - UnivariateRealSolverUtils.forceSide(remainingEval, f, bracketing, + UnivariateSolverUtils.forceSide(remainingEval, f, bracketing, baseRoot, ta, tb, AllowedSolution.RIGHT_SIDE) : - UnivariateRealSolverUtils.forceSide(remainingEval, f, bracketing, + UnivariateSolverUtils.forceSide(remainingEval, f, bracketing, baseRoot, tb, ta, AllowedSolution.LEFT_SIDE); } diff --git a/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java b/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java index 873f50ca0..8881a2ca3 100644 --- a/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java +++ b/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java @@ -17,7 +17,7 @@ package org.apache.commons.math.ode.nonstiff; -import org.apache.commons.math.analysis.solvers.UnivariateRealSolver; +import org.apache.commons.math.analysis.solvers.UnivariateSolver; import org.apache.commons.math.exception.MathIllegalArgumentException; import org.apache.commons.math.exception.MathIllegalStateException; import org.apache.commons.math.ode.ExpandableStatefulODE; @@ -348,7 +348,7 @@ public class GraggBulirschStoerIntegrator extends AdaptiveStepsizeIntegrator { final double maxCheckInterval, final double convergence, final int maxIterationCount, - final UnivariateRealSolver solver) { + final UnivariateSolver solver) { super.addEventHandler(function, maxCheckInterval, convergence, maxIterationCount, solver); diff --git a/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java b/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java index 6dfb9a8ec..9b75f3090 100644 --- a/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java +++ b/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java @@ -20,7 +20,7 @@ package org.apache.commons.math.optimization.general; import org.apache.commons.math.exception.MathIllegalStateException; import org.apache.commons.math.analysis.UnivariateFunction; import org.apache.commons.math.analysis.solvers.BrentSolver; -import org.apache.commons.math.analysis.solvers.UnivariateRealSolver; +import org.apache.commons.math.analysis.solvers.UnivariateSolver; import org.apache.commons.math.exception.util.LocalizedFormats; import org.apache.commons.math.optimization.GoalType; import org.apache.commons.math.optimization.RealPointValuePair; @@ -47,7 +47,7 @@ public class NonLinearConjugateGradientOptimizer /** Preconditioner (may be null). */ private final Preconditioner preconditioner; /** solver to use in the line search (may be null). */ - private final UnivariateRealSolver solver; + private final UnivariateSolver solver; /** Initial step used to bracket the optimum in line search. */ private double initialStep; /** Current point. */ @@ -96,7 +96,7 @@ public class NonLinearConjugateGradientOptimizer */ public NonLinearConjugateGradientOptimizer(final ConjugateGradientFormula updateFormula, ConvergenceChecker checker, - final UnivariateRealSolver lineSearchSolver) { + final UnivariateSolver lineSearchSolver) { this(updateFormula, checker, lineSearchSolver, @@ -113,7 +113,7 @@ public class NonLinearConjugateGradientOptimizer */ public NonLinearConjugateGradientOptimizer(final ConjugateGradientFormula updateFormula, ConvergenceChecker checker, - final UnivariateRealSolver lineSearchSolver, + final UnivariateSolver lineSearchSolver, final Preconditioner preconditioner) { super(checker); diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java index 29630f385..c5f4a1ca4 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java @@ -36,7 +36,7 @@ public abstract class BaseSecantSolverAbstractTest { /** Returns the solver to use to perform the tests. * @return the solver to use to perform the tests */ - protected abstract UnivariateRealSolver getSolver(); + protected abstract UnivariateSolver getSolver(); /** Returns the expected number of evaluations for the * {@link #testQuinticZero} unit test. A value of {@code -1} indicates that @@ -53,7 +53,7 @@ public abstract class BaseSecantSolverAbstractTest { // still converge quadratically. UnivariateFunction f = new SinFunction(); double result; - UnivariateRealSolver solver = getSolver(); + UnivariateSolver solver = getSolver(); result = solver.solve(100, f, 3, 4); //System.out.println( @@ -79,7 +79,7 @@ public abstract class BaseSecantSolverAbstractTest { // the solvers. UnivariateFunction f = new QuinticFunction(); double result; - UnivariateRealSolver solver = getSolver(); + UnivariateSolver solver = getSolver(); double atol = solver.getAbsoluteAccuracy(); int[] counts = getQuinticEvalCounts(); @@ -117,7 +117,7 @@ public abstract class BaseSecantSolverAbstractTest { @Test public void testRootEndpoints() { UnivariateFunction f = new XMinus5Function(); - UnivariateRealSolver solver = getSolver(); + UnivariateSolver solver = getSolver(); // End-point is root. This should be a special case in the solver, and // the initial end-point should be returned exactly. @@ -137,7 +137,7 @@ public abstract class BaseSecantSolverAbstractTest { @Test public void testBadEndpoints() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = getSolver(); + UnivariateSolver solver = getSolver(); try { // bad interval solver.solve(100, f, 1, -1); Assert.fail("Expecting NumberIsTooLargeException - bad interval"); @@ -161,7 +161,7 @@ public abstract class BaseSecantSolverAbstractTest { @Test public void testSolutionLeftSide() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = getSolver(); + UnivariateSolver solver = getSolver(); double left = -1.5; double right = 0.05; for(int i = 0; i < 10; i++) { @@ -180,7 +180,7 @@ public abstract class BaseSecantSolverAbstractTest { @Test public void testSolutionRightSide() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = getSolver(); + UnivariateSolver solver = getSolver(); double left = -1.5; double right = 0.05; for(int i = 0; i < 10; i++) { @@ -198,7 +198,7 @@ public abstract class BaseSecantSolverAbstractTest { @Test public void testSolutionBelowSide() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = getSolver(); + UnivariateSolver solver = getSolver(); double left = -1.5; double right = 0.05; for(int i = 0; i < 10; i++) { @@ -217,7 +217,7 @@ public abstract class BaseSecantSolverAbstractTest { @Test public void testSolutionAboveSide() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = getSolver(); + UnivariateSolver solver = getSolver(); double left = -1.5; double right = 0.05; for(int i = 0; i < 10; i++) { @@ -233,12 +233,12 @@ public abstract class BaseSecantSolverAbstractTest { } } - private double getSolution(UnivariateRealSolver solver, int maxEval, UnivariateFunction f, + private double getSolution(UnivariateSolver solver, int maxEval, UnivariateFunction f, double left, double right, AllowedSolution allowedSolution) { try { @SuppressWarnings("unchecked") - BracketedUnivariateRealSolver bracketing = - (BracketedUnivariateRealSolver) solver; + BracketedUnivariateSolver bracketing = + (BracketedUnivariateSolver) solver; return bracketing.solve(100, f, left, right, allowedSolution); } catch (ClassCastException cce) { double baseRoot = solver.solve(maxEval, f, left, right); @@ -249,7 +249,7 @@ public abstract class BaseSecantSolverAbstractTest { PegasusSolver bracketing = new PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy(), solver.getFunctionValueAccuracy()); - return UnivariateRealSolverUtils.forceSide(maxEval - solver.getEvaluations(), + return UnivariateSolverUtils.forceSide(maxEval - solver.getEvaluations(), f, bracketing, baseRoot, left, right, allowedSolution); } diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java index 13bd8f496..25eb5ed46 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolverTest.java @@ -34,7 +34,7 @@ import org.junit.Test; public final class BracketingNthOrderBrentSolverTest extends BaseSecantSolverAbstractTest { /** {@inheritDoc} */ @Override - protected UnivariateRealSolver getSolver() { + protected UnivariateSolver getSolver() { return new BracketingNthOrderBrentSolver(); } diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java index 9a03be4ef..a4474ec9d 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java @@ -46,7 +46,7 @@ public final class BrentSolverTest { // still converge quadratically. UnivariateFunction f = new SinFunction(); double result; - UnivariateRealSolver solver = new BrentSolver(); + UnivariateSolver solver = new BrentSolver(); // Somewhat benign interval. The function is monotone. result = solver.solve(100, f, 3, 4); // System.out.println( @@ -73,7 +73,7 @@ public final class BrentSolverTest { UnivariateFunction f = new QuinticFunction(); double result; // Brent-Dekker solver. - UnivariateRealSolver solver = new BrentSolver(); + UnivariateSolver solver = new BrentSolver(); // Symmetric bracket around 0. Test whether solvers can handle hitting // the root in the first iteration. result = solver.solve(100, f, -0.2, 0.2); diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/IllinoisSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/IllinoisSolverTest.java index 920efba1f..4af34a9ab 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/IllinoisSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/IllinoisSolverTest.java @@ -25,7 +25,7 @@ package org.apache.commons.math.analysis.solvers; public final class IllinoisSolverTest extends BaseSecantSolverAbstractTest { /** {@inheritDoc} */ @Override - protected UnivariateRealSolver getSolver() { + protected UnivariateSolver getSolver() { return new IllinoisSolver(); } diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolver2Test.java b/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolver2Test.java index e24c5055e..e852b753e 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolver2Test.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolver2Test.java @@ -46,7 +46,7 @@ public final class MullerSolver2Test { @Test public void testSinFunction() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = new MullerSolver2(); + UnivariateSolver solver = new MullerSolver2(); double min, max, expected, result, tolerance; min = 3.0; max = 4.0; expected = FastMath.PI; @@ -68,7 +68,7 @@ public final class MullerSolver2Test { @Test public void testQuinticFunction() { UnivariateFunction f = new QuinticFunction(); - UnivariateRealSolver solver = new MullerSolver2(); + UnivariateSolver solver = new MullerSolver2(); double min, max, expected, result, tolerance; min = -0.4; max = 0.2; expected = 0.0; @@ -98,7 +98,7 @@ public final class MullerSolver2Test { @Test public void testExpm1Function() { UnivariateFunction f = new Expm1Function(); - UnivariateRealSolver solver = new MullerSolver2(); + UnivariateSolver solver = new MullerSolver2(); double min, max, expected, result, tolerance; min = -1.0; max = 2.0; expected = 0.0; @@ -126,7 +126,7 @@ public final class MullerSolver2Test { @Test public void testParameters() throws Exception { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = new MullerSolver2(); + UnivariateSolver solver = new MullerSolver2(); try { // bad interval diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java index 37e22a2e7..ed534d8b1 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java @@ -46,7 +46,7 @@ public final class MullerSolverTest { @Test public void testSinFunction() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = new MullerSolver(); + UnivariateSolver solver = new MullerSolver(); double min, max, expected, result, tolerance; min = 3.0; max = 4.0; expected = FastMath.PI; @@ -68,7 +68,7 @@ public final class MullerSolverTest { @Test public void testQuinticFunction() { UnivariateFunction f = new QuinticFunction(); - UnivariateRealSolver solver = new MullerSolver(); + UnivariateSolver solver = new MullerSolver(); double min, max, expected, result, tolerance; min = -0.4; max = 0.2; expected = 0.0; @@ -100,7 +100,7 @@ public final class MullerSolverTest { @Test public void testExpm1Function() { UnivariateFunction f = new Expm1Function(); - UnivariateRealSolver solver = new MullerSolver(); + UnivariateSolver solver = new MullerSolver(); double min, max, expected, result, tolerance; min = -1.0; max = 2.0; expected = 0.0; @@ -128,7 +128,7 @@ public final class MullerSolverTest { @Test public void testParameters() throws Exception { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = new MullerSolver(); + UnivariateSolver solver = new MullerSolver(); try { // bad interval diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/PegasusSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/PegasusSolverTest.java index e355135ee..7996b975e 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/PegasusSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/PegasusSolverTest.java @@ -25,7 +25,7 @@ package org.apache.commons.math.analysis.solvers; public final class PegasusSolverTest extends BaseSecantSolverAbstractTest { /** {@inheritDoc} */ @Override - protected UnivariateRealSolver getSolver() { + protected UnivariateSolver getSolver() { return new PegasusSolver(); } diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolverTest.java index f10296722..0302c72ad 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolverTest.java @@ -30,7 +30,7 @@ import org.junit.Assert; public final class RegulaFalsiSolverTest extends BaseSecantSolverAbstractTest { /** {@inheritDoc} */ @Override - protected UnivariateRealSolver getSolver() { + protected UnivariateSolver getSolver() { return new RegulaFalsiSolver(); } @@ -52,7 +52,7 @@ public final class RegulaFalsiSolverTest extends BaseSecantSolverAbstractTest { } }; - final UnivariateRealSolver solver = new RegulaFalsiSolver(); + final UnivariateSolver solver = new RegulaFalsiSolver(); final double root = solver.solve(3624, f, 1, 10); Assert.assertEquals(3.4341896575482003, root, 1e-15); } diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java index 79d91f421..8de77e0b0 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java @@ -44,7 +44,7 @@ public final class RiddersSolverTest { @Test public void testSinFunction() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = new RiddersSolver(); + UnivariateSolver solver = new RiddersSolver(); double min, max, expected, result, tolerance; min = 3.0; max = 4.0; expected = FastMath.PI; @@ -66,7 +66,7 @@ public final class RiddersSolverTest { @Test public void testQuinticFunction() { UnivariateFunction f = new QuinticFunction(); - UnivariateRealSolver solver = new RiddersSolver(); + UnivariateSolver solver = new RiddersSolver(); double min, max, expected, result, tolerance; min = -0.4; max = 0.2; expected = 0.0; @@ -94,7 +94,7 @@ public final class RiddersSolverTest { @Test public void testExpm1Function() { UnivariateFunction f = new Expm1Function(); - UnivariateRealSolver solver = new RiddersSolver(); + UnivariateSolver solver = new RiddersSolver(); double min, max, expected, result, tolerance; min = -1.0; max = 2.0; expected = 0.0; @@ -122,7 +122,7 @@ public final class RiddersSolverTest { @Test public void testParameters() { UnivariateFunction f = new SinFunction(); - UnivariateRealSolver solver = new RiddersSolver(); + UnivariateSolver solver = new RiddersSolver(); try { // bad interval diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/SecantSolverTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/SecantSolverTest.java index 067eb6f9a..a7fa33da9 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/SecantSolverTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/SecantSolverTest.java @@ -25,7 +25,7 @@ package org.apache.commons.math.analysis.solvers; public final class SecantSolverTest extends BaseSecantSolverAbstractTest { /** {@inheritDoc} */ @Override - protected UnivariateRealSolver getSolver() { + protected UnivariateSolver getSolver() { return new SecantSolver(); } diff --git a/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java b/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateSolverUtilsTest.java similarity index 70% rename from src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java rename to src/test/java/org/apache/commons/math/analysis/solvers/UnivariateSolverUtilsTest.java index a42f1a346..594d08140 100644 --- a/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java +++ b/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateSolverUtilsTest.java @@ -28,25 +28,25 @@ import org.junit.Test; /** * @version $Id$ */ -public class UnivariateRealSolverUtilsTest { +public class UnivariateSolverUtilsTest { protected UnivariateFunction sin = new SinFunction(); @Test(expected=MathIllegalArgumentException.class) public void testSolveNull() { - UnivariateRealSolverUtils.solve(null, 0.0, 4.0); + UnivariateSolverUtils.solve(null, 0.0, 4.0); } @Test(expected=MathIllegalArgumentException.class) public void testSolveBadEndpoints() { - double root = UnivariateRealSolverUtils.solve(sin, 4.0, -0.1, 1e-6); + double root = UnivariateSolverUtils.solve(sin, 4.0, -0.1, 1e-6); System.out.println("root=" + root); } @Test public void testSolveBadAccuracy() { try { // bad accuracy - UnivariateRealSolverUtils.solve(sin, 0.0, 4.0, 0.0); + UnivariateSolverUtils.solve(sin, 0.0, 4.0, 0.0); // Assert.fail("Expecting MathIllegalArgumentException"); // TODO needs rework since convergence behaviour was changed } catch (MathIllegalArgumentException ex) { // expected @@ -55,32 +55,32 @@ public class UnivariateRealSolverUtilsTest { @Test public void testSolveSin() { - double x = UnivariateRealSolverUtils.solve(sin, 1.0, 4.0); + double x = UnivariateSolverUtils.solve(sin, 1.0, 4.0); Assert.assertEquals(FastMath.PI, x, 1.0e-4); } @Test(expected=MathIllegalArgumentException.class) public void testSolveAccuracyNull() { double accuracy = 1.0e-6; - UnivariateRealSolverUtils.solve(null, 0.0, 4.0, accuracy); + UnivariateSolverUtils.solve(null, 0.0, 4.0, accuracy); } @Test public void testSolveAccuracySin() { double accuracy = 1.0e-6; - double x = UnivariateRealSolverUtils.solve(sin, 1.0, + double x = UnivariateSolverUtils.solve(sin, 1.0, 4.0, accuracy); Assert.assertEquals(FastMath.PI, x, accuracy); } @Test(expected=MathIllegalArgumentException.class) public void testSolveNoRoot() { - UnivariateRealSolverUtils.solve(sin, 1.0, 1.5); + UnivariateSolverUtils.solve(sin, 1.0, 1.5); } @Test public void testBracketSin() { - double[] result = UnivariateRealSolverUtils.bracket(sin, + double[] result = UnivariateSolverUtils.bracket(sin, 0.0, -2.0, 2.0); Assert.assertTrue(sin.value(result[0]) < 0); Assert.assertTrue(sin.value(result[1]) > 0); @@ -88,31 +88,31 @@ public class UnivariateRealSolverUtilsTest { @Test public void testBracketEndpointRoot() { - double[] result = UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0); + double[] result = UnivariateSolverUtils.bracket(sin, 1.5, 0, 2.0); Assert.assertEquals(0.0, sin.value(result[0]), 1.0e-15); Assert.assertTrue(sin.value(result[1]) > 0); } @Test(expected=MathIllegalArgumentException.class) public void testNullFunction() { - UnivariateRealSolverUtils.bracket(null, 1.5, 0, 2.0); + UnivariateSolverUtils.bracket(null, 1.5, 0, 2.0); } @Test(expected=MathIllegalArgumentException.class) public void testBadInitial() { - UnivariateRealSolverUtils.bracket(sin, 2.5, 0, 2.0); + UnivariateSolverUtils.bracket(sin, 2.5, 0, 2.0); } @Test(expected=MathIllegalArgumentException.class) public void testBadEndpoints() { // endpoints not valid - UnivariateRealSolverUtils.bracket(sin, 1.5, 2.0, 1.0); + UnivariateSolverUtils.bracket(sin, 1.5, 2.0, 1.0); } @Test(expected=MathIllegalArgumentException.class) public void testBadMaximumIterations() { // bad maximum iterations - UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0, 0); + UnivariateSolverUtils.bracket(sin, 1.5, 0, 2.0, 0); } @Test @@ -120,27 +120,27 @@ public class UnivariateRealSolverUtilsTest { UnivariateFunction f = new QuinticFunction(); double result; // Static solve method - result = UnivariateRealSolverUtils.solve(f, -0.2, 0.2); + result = UnivariateSolverUtils.solve(f, -0.2, 0.2); Assert.assertEquals(result, 0, 1E-8); - result = UnivariateRealSolverUtils.solve(f, -0.1, 0.3); + result = UnivariateSolverUtils.solve(f, -0.1, 0.3); Assert.assertEquals(result, 0, 1E-8); - result = UnivariateRealSolverUtils.solve(f, -0.3, 0.45); + result = UnivariateSolverUtils.solve(f, -0.3, 0.45); Assert.assertEquals(result, 0, 1E-6); - result = UnivariateRealSolverUtils.solve(f, 0.3, 0.7); + result = UnivariateSolverUtils.solve(f, 0.3, 0.7); Assert.assertEquals(result, 0.5, 1E-6); - result = UnivariateRealSolverUtils.solve(f, 0.2, 0.6); + result = UnivariateSolverUtils.solve(f, 0.2, 0.6); Assert.assertEquals(result, 0.5, 1E-6); - result = UnivariateRealSolverUtils.solve(f, 0.05, 0.95); + result = UnivariateSolverUtils.solve(f, 0.05, 0.95); Assert.assertEquals(result, 0.5, 1E-6); - result = UnivariateRealSolverUtils.solve(f, 0.85, 1.25); + result = UnivariateSolverUtils.solve(f, 0.85, 1.25); Assert.assertEquals(result, 1.0, 1E-6); - result = UnivariateRealSolverUtils.solve(f, 0.8, 1.2); + result = UnivariateSolverUtils.solve(f, 0.8, 1.2); Assert.assertEquals(result, 1.0, 1E-6); - result = UnivariateRealSolverUtils.solve(f, 0.85, 1.75); + result = UnivariateSolverUtils.solve(f, 0.85, 1.75); Assert.assertEquals(result, 1.0, 1E-6); - result = UnivariateRealSolverUtils.solve(f, 0.55, 1.45); + result = UnivariateSolverUtils.solve(f, 0.55, 1.45); Assert.assertEquals(result, 1.0, 1E-6); - result = UnivariateRealSolverUtils.solve(f, 0.85, 5); + result = UnivariateSolverUtils.solve(f, 0.85, 5); Assert.assertEquals(result, 1.0, 1E-6); } }