Mercurial > octave
changeset 22935:c9344df03da5
Allow case-insensitive option argument 'on' to ode solvers (bug #49918).
* ode15i.m, ode15s.m: Change strcmp to strcmpi for test of odeopts 'Stats.
* ode23.m, ode45.m: Change strcmp to strcmpi for tests of odeopts 'Stats' and
'NormControl'.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 23 Dec 2016 09:26:16 -0800 |
parents | bb452f84a299 |
children | f2a1fc90a903 |
files | scripts/ode/ode15i.m scripts/ode/ode15s.m scripts/ode/ode23.m scripts/ode/ode45.m |
diffstat | 4 files changed, 8 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ode/ode15i.m Fri Dec 23 10:08:51 2016 +0100 +++ b/scripts/ode/ode15i.m Fri Dec 23 09:26:16 2016 -0800 @@ -232,10 +232,7 @@ endif ## Stats - options.havestats = false; - if (strcmp (options.Stats, "on")) - options.havestats = true; - endif + options.havestats = strcmpi (options.Stats, "on"); ## Don't use Refine when the output is a structure if (nargout == 1)
--- a/scripts/ode/ode15s.m Fri Dec 23 10:08:51 2016 +0100 +++ b/scripts/ode/ode15s.m Fri Dec 23 09:26:16 2016 -0800 @@ -288,10 +288,7 @@ endif ## Stats - options.havestats = false; - if (strcmp (options.Stats, "on")) - options.havestats = true; - endif + options.havestats = strcmpi (options.Stats, "on"); ## Don't use Refine when the output is a structure if (nargout == 1)
--- a/scripts/ode/ode23.m Fri Dec 23 10:08:51 2016 +0100 +++ b/scripts/ode/ode23.m Fri Dec 23 09:26:16 2016 -0800 @@ -151,7 +151,6 @@ "ode23: FUN must be a valid function handle"); endif - ## Start preprocessing, have a look which options are set in odeopts, ## check if an invalid or unused option is set. [defaults, classes, attributes] = odedefaults (numel (init), @@ -194,7 +193,7 @@ odeopts.InitialStep = odeopts.direction * ... starting_stepsize (order, fun, trange(1), init, odeopts.AbsTol, odeopts.RelTol, - strcmp (odeopts.NormControl, "on"), + strcmpi (odeopts.NormControl, "on"), odeopts.funarguments); endif @@ -244,7 +243,7 @@ endif ## Print additional information if option Stats is set - if (strcmp (odeopts.Stats, "on")) + if (strcmpi (odeopts.Stats, "on")) nsteps = solution.cntloop; # cntloop from 2..end nfailed = solution.cntcycles - nsteps; # cntcycl from 1..end nfevals = 3 * solution.cntcycles + 1; # number of ode evaluations @@ -269,7 +268,7 @@ varargout{1}.xe = solution.event{3}; # Time info when an event occurred varargout{1}.ye = solution.event{4}; # Results when an event occurred endif - if (strcmp (odeopts.Stats, "on")) + if (strcmpi (odeopts.Stats, "on")) varargout{1}.stats = struct (); varargout{1}.stats.nsteps = nsteps; varargout{1}.stats.nfailed = nfailed;
--- a/scripts/ode/ode45.m Fri Dec 23 10:08:51 2016 +0100 +++ b/scripts/ode/ode45.m Fri Dec 23 09:26:16 2016 -0800 @@ -187,7 +187,7 @@ odeopts.InitialStep = odeopts.direction * ... starting_stepsize (order, fun, trange(1), init, odeopts.AbsTol, odeopts.RelTol, - strcmp (odeopts.NormControl, "on"), + strcmpi (odeopts.NormControl, "on"), odeopts.funarguments); endif @@ -237,7 +237,7 @@ endif ## Print additional information if option Stats is set - if (strcmp (odeopts.Stats, "on")) + if (strcmpi (odeopts.Stats, "on")) nsteps = solution.cntloop; # cntloop from 2..end nfailed = solution.cntcycles - nsteps; # cntcycl from 1..end nfevals = 6 * solution.cntcycles + 1; # number of ode evaluations @@ -262,7 +262,7 @@ varargout{1}.xe = solution.event{3}; # Time info when an event occurred varargout{1}.ye = solution.event{4}; # Results when an event occurred endif - if (strcmp (odeopts.Stats, "on")) + if (strcmpi (odeopts.Stats, "on")) varargout{1}.stats = struct (); varargout{1}.stats.nsteps = nsteps; varargout{1}.stats.nfailed = nfailed;