Mercurial > octave
view scripts/ode/private/AbsRel_Norm.m @ 20631:00caf63edcdf
maint: Remove obsolete ODE options from odeset/odeget/ode45.
* odepkg_structure_check.m: Deleted file, replaced in code with
ode_struct_value_check()
* scripts/ode/module.mk: Remove odepkg_structure_check.m from build system.
* ode45.m: Just print_usage(), rather than displaying help, if incorrect
number of arguments supplied. Replace calls to odepkg_structure_check()
with calls to ode_struct_value_check(). Use error ID
"Octave:invalid-input-arg" rather than "OdePkg:InvalidArgument".
Use local variables TimeStepNumber and TimeStepSize since these are no
longer a default part of an ODE options structure. Remove options that
are no longer a part of ODE options structure.
* odeget.m: Remove unused options. Allow unknown options through, but
display a warning.
* odeset.m: Remove unused options. Allow unknown options through, but
dispaly a warning. Use special for loop over structure to simplify code.
Add BIST tests for custom user-defined options and for input validation.
* ode_struct_value_check.m: Rewrite docstring. Return input ode_struct
as output so that function can replace odepk_structure_check. Use
meaningful input variable name ode_struct rather than arg. Use special
for loop syntax over structure to simplify code. Remove checking for
obsolete, non-Matlab options. Use error ID "Octave:invalid-input-arg" rather
than "OdePkg:InvalidArgument". Preface all error and warning messages
with the name of the calling function.
* AbsRel_Norm.m, integrate_const.m, integrate_n_steps.m: Use error ID
"Octave:invalid-input-arg" rather than "OdePkg:InvalidArgument".
* odepkg_event_handle.m: Rephrase sentence in docstring.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 16 Oct 2015 10:31:02 -0700 |
parents | b92f8e148936 |
children | 80e630b37ba1 |
line wrap: on
line source
## Copyright (C) 2014-15 Jacopo Corno <jacopo.corno@gmail.com> ## Copyright (C) 2013 Roberto Porcu' <roberto.porcu@polimi.it> ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 3 of the License, or (at ## your option) any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, see ## <http://www.gnu.org/licenses/>. function retval = AbsRel_Norm (x, x_old, AbsTol, RelTol, normcontrol, y) n = length (x); if (nargin == 5) y = zeros (size (x)); endif if (length (x_old) != n || length (y) != n) error ("Octave:invalid-input-arg", "invalid dimensions of input arguments"); endif if ((length (AbsTol) != 1 && length (AbsTol) != n) || (length (RelTol) != 1 && length (RelTol) != n)) error ("Octave:invalid-input-arg", "invalid dimensions of input arguments"); endif sc = AbsTol + max (abs (x), abs (x_old)) .* RelTol; if (normcontrol) retval = max (abs (x - y) ./ sc); else retval = sqrt ((1 / n) * sumsq ((x - y) ./ sc)); endif endfunction