# HG changeset patch # User Ken Marek # Date 1665087470 14400 # Node ID 33d5c1c41bbc2cecc8f11416f2b20d6117acd5b5 # Parent 00e2eafd1c0f73c39cfd9c1a1e863a5e21881723 Clean up unused portions of runge_kutta_interpolate (bug #63162) * runge_kutta_interpolate.m: Eliminate unnecessary call to FCN (the stepper function, called prior to runge_kutta_interpolate, has already done that). Eliminate unnecessary DT, FCN, and ARGS arguments. * integrate_adaptive.m: Update calls to runge_kutta_interpolate. diff -r 00e2eafd1c0f -r 33d5c1c41bbc scripts/ode/private/integrate_adaptive.m --- a/scripts/ode/private/integrate_adaptive.m Thu Nov 10 18:52:19 2022 +0100 +++ b/scripts/ode/private/integrate_adaptive.m Thu Oct 06 16:17:50 2022 -0400 @@ -193,8 +193,7 @@ iout = max (t_caught); output_x(:, t_caught) = ... runge_kutta_interpolate (order, [t_old t_new], [x_old x_new], ... - output_t(t_caught), new_k_vals, dt, ... - fcn, options.funarguments); + output_t(t_caught), new_k_vals); endif ## Add a possible additional output value if we found a terminal Event if ((terminal_event == true) && ... @@ -210,8 +209,7 @@ tadd = tadd(2:end); output_x(:, iout + (1:iadd)) = ... runge_kutta_interpolate (order, [t_old t_new], [x_old x_new], ... - tadd, new_k_vals, dt, fcn, ... - options.funarguments); + tadd, new_k_vals); output_t(iout + (1:iadd)) = tadd; iout = length (output_t); else # refine = 1 diff -r 00e2eafd1c0f -r 33d5c1c41bbc scripts/ode/private/runge_kutta_interpolate.m --- a/scripts/ode/private/runge_kutta_interpolate.m Thu Nov 10 18:52:19 2022 +0100 +++ b/scripts/ode/private/runge_kutta_interpolate.m Thu Oct 06 16:17:50 2022 -0400 @@ -23,22 +23,21 @@ ## ######################################################################## -function u_interp = runge_kutta_interpolate (order, z, u, t, k_vals, dt, fcn, args) +function u_interp = runge_kutta_interpolate (order, z, u, t, k_vals) switch (order) case 1 + ## Unused u_interp = interp1 (z, u.', t, "linear"); case 2 - if (! isempty (k_vals)) - der = k_vals(:,1); - else - der = feval (fcn, z(1) , u(:,1), args); - endif + ## ode23s with Rosenbrock scheme: + der = k_vals(:,1); u_interp = quadratic_interpolation (z, u, der, t); case 3 + ## ode23 with Bogacki-Shampine scheme: u_interp = hermite_cubic_interpolation (z, u, k_vals, t); case 5 @@ -46,11 +45,10 @@ u_interp = hermite_quartic_interpolation (z, u, k_vals, t); otherwise - warning (["High order interpolation not yet implemented: ", ... - "using cubic interpolation instead"]); - der(:,1) = feval (fcn, z(1), u(:,1), args); - der(:,2) = feval (fcn, z(2), u(:,2), args); - u_interp = hermite_cubic_interpolation (z, u, der, t); + ## This should never happen + warning (["Invalid/unimplemented interpolation order: ", ... + "using linear interpolation instead"]); + u_interp = interp1 (z, u.', t, "linear"); endswitch