Mercurial > octave
changeset 31499:e7b51b5b33f8 stable
maint: Use more Octave coding conventions in cset c05ef94a2bbc.
* ode23.m, ode23s.m, ode45.m: Use parentheses around CONDITION in
if statement. Use at least two spaces between code and start
of inline comment.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 21 Nov 2022 09:25:29 -0800 |
parents | 55f0173e4f08 |
children | ec973756cb3a |
files | scripts/ode/ode23.m scripts/ode/ode23s.m scripts/ode/ode45.m |
diffstat | 3 files changed, 19 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ode/ode23.m Mon Nov 21 18:15:03 2022 +0100 +++ b/scripts/ode/ode23.m Mon Nov 21 09:25:29 2022 -0800 @@ -370,23 +370,23 @@ %! ## x == 2: select y(2) %! ## x == 3: select y([1,2]) %! persistent y_last -%! if strcmp (flag, "init") +%! if (strcmp (flag, "init")) %! y_last = y; -%! if ((x == 1) || (x == 2)) +%! if (x == 1 || x == 2) %! assert (length (y) == 1); %! elseif (x == 3) %! assert (length (y) == 2); %! endif -%! elseif strcmp (flag, "done") +%! elseif (strcmp (flag, "done")) %! y_exp = fref ().'; %! if (x < 3) %! assert (y_last, y_exp(x), 5e-4); %! else %! assert (y_last, y_exp, 5e-4); %! endif -%! else # flag == "" +%! else # flag == "" %! y_last = y(:, end); -%! if ((x == 1) || (x == 2)) +%! if (x == 1 || x == 2) %! assert (length (t) == length (y)); %! else %! assert (2 * length (t) == length (y(:))); @@ -459,7 +459,7 @@ %! opt = odeset ("AbsTol", 1e-8, "RelTol", 1e-8); %! sol = ode23 (@fpol, [0 2], [2 0], opt); %! assert ([sol.x(end); sol.y(:,end)], [2; fref'], 1e-3); -%!test # hermite_cubic_interpolation +%!test # hermite_cubic_interpolation %! opt = odeset ("RelTol", 1e-8, "NormControl", "on"); %! [t,sol] = ode23(@(t,x)[x(2);x(1)],linspace(0,1),[1;0],opt); %! assert (max (abs (sol(:,1)-cosh (t))),0,1e-6); @@ -538,7 +538,7 @@ ## "MvPattern" ## "Vectorized" -%!test # Check that imaginary part of solution does not get inverted +%!test # Check that imaginary part of solution does not get inverted %! sol = ode23 (@(x,y) 1, [0 1], 1i); %! assert (imag (sol.y), ones (size (sol.y))); %! [x, y] = ode23 (@(x,y) 1, [0 1], 1i);
--- a/scripts/ode/ode23s.m Mon Nov 21 18:15:03 2022 +0100 +++ b/scripts/ode/ode23s.m Mon Nov 21 09:25:29 2022 -0800 @@ -404,23 +404,23 @@ %! ## x == 2: select y(2) %! ## x == 3: select y([1,2]) %! persistent y_last -%! if strcmp (flag, "init") +%! if (strcmp (flag, "init")) %! y_last = y; -%! if ((x == 1) || (x == 2)) +%! if (x == 1 || x == 2) %! assert (length (y) == 1); %! elseif (x == 3) %! assert (length (y) == 2); %! endif -%! elseif strcmp (flag, "done") +%! elseif (strcmp (flag, "done")) %! y_exp = fref ().'; %! if (x < 3) %! assert (y_last, y_exp(x), 1e-4); %! else %! assert (y_last, y_exp, 1e-4); %! endif -%! else # flag == "" +%! else # flag == "" %! y_last = y(:,end); -%! if ((x == 1) || (x == 2)) +%! if (x == 1 || x == 2) %! assert (length (t) == length (y)); %! else %! assert (2 * length (t) == length (y(:))); @@ -547,7 +547,7 @@ ## "MvPattern" ## "NonNegative" -%!test # Check that imaginary part of solution does not get inverted +%!test # Check that imaginary part of solution does not get inverted %! sol = ode23s (@(x,y) 1, [0 1], 1i); %! assert (imag (sol.y), ones (size (sol.y))); %! [x, y] = ode23s (@(x,y) 1, [0 1], 1i);
--- a/scripts/ode/ode45.m Mon Nov 21 18:15:03 2022 +0100 +++ b/scripts/ode/ode45.m Mon Nov 21 09:25:29 2022 -0800 @@ -369,23 +369,23 @@ %! ## x == 2: select y(2) %! ## x == 3: select y([1,2]) %! persistent y_last -%! if strcmp (flag, "init") +%! if (strcmp (flag, "init")) %! y_last = y; -%! if ((x == 1) || (x == 2)) +%! if (x == 1 || x == 2) %! assert (length (y) == 1); %! elseif (x == 3) %! assert (length (y) == 2); %! endif -%! elseif strcmp (flag, "done") +%! elseif (strcmp (flag, "done")) %! y_exp = fref ().'; %! if (x < 3) %! assert (y_last, y_exp(x), 1e-4); %! else %! assert (y_last, y_exp, 1e-4); %! endif -%! else # flag == "" +%! else # flag == "" %! y_last = y(:,end); -%! if ((x == 1) || (x == 2)) +%! if (x == 1 || x == 2) %! assert (length (t) == length (y)); %! else %! assert (2 * length (t) == length (y(:))); @@ -550,7 +550,7 @@ ## "MvPattern" ## "Vectorized" -%!test # Check that imaginary part of solution does not get inverted +%!test # Check that imaginary part of solution does not get inverted %! sol = ode45 (@(x,y) 1, [0 1], 1i); %! assert (imag (sol.y), ones (size (sol.y))); %! [x, y] = ode45 (@(x,y) 1, [0 1], 1i, odeset ("Refine", 1));