commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MATH-1297) multistep integrator start failure triggers NPE
Date Mon, 14 Dec 2015 14:09:46 GMT
Luc Maisonobe created MATH-1297:
-----------------------------------

             Summary: multistep integrator start failure triggers NPE
                 Key: MATH-1297
                 URL: https://issues.apache.org/jira/browse/MATH-1297
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.5
            Reporter: Luc Maisonobe
            Assignee: Luc Maisonobe
             Fix For: 3.6


Multistep ODE integrators like Adams-Bashforth and Adams-Moulton require a starter procedure.
If the starter integrator is not configured properly, it will not create the necessary number
of initial points and the multistep integrator will not be initialized correctly. This results
in NullPointErException when the scaling array is referenced later on.

The following test case (with an intentionally wrong starter configuration) shows the problem.

{code}
@Test
public void testStartFailure() {

     TestProblem1 pb = new TestProblem1();
      double minStep = 0.0001 * (pb.getFinalTime() - pb.getInitialTime());
      double maxStep = pb.getFinalTime() - pb.getInitialTime();
      double scalAbsoluteTolerance = 1.0e-6;
      double scalRelativeTolerance = 1.0e-7;

      MultistepIntegrator integ =
          new AdamsBashforthIntegrator(4, minStep, maxStep,
                                                            scalAbsoluteTolerance,
                                                            scalRelativeTolerance);
      integ.setStarterIntegrator(new DormandPrince853Integrator(0.2 * (pb.getFinalTime() -
pb.getInitialTime()),
                                                                pb.getFinalTime() - pb.getInitialTime(),
                                                                0.1, 0.1));
      TestProblemHandler handler = new TestProblemHandler(pb, integ);
      integ.addStepHandler(handler);
      integ.integrate(pb,
                             pb.getInitialTime(), pb.getInitialState(),
                             pb.getFinalTime(), new double[pb.getDimension()]);

    }
{code}

Failure to start the integrator should be detected and an appropriate exception should be
triggered.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message