# HG changeset patch # User Markus Mützel # Date 1669145915 -3600 # Node ID fb123529131bcdc65514b87c173af98f898dd970 # Parent d006285b7509e8bd5428876897c8a9a7981a6a85# Parent ec973756cb3a81f45b541ef4e8a9380ae7af7e32 maint: Merge stable to default. diff -r d006285b7509 -r fb123529131b liboctave/array/CMatrix.cc --- a/liboctave/array/CMatrix.cc Tue Nov 22 08:23:44 2022 -0800 +++ b/liboctave/array/CMatrix.cc Tue Nov 22 20:38:35 2022 +0100 @@ -890,19 +890,24 @@ info = -1; else if (calc_cond) { - F77_INT zgecon_info = 0; - - // Now calculate the condition number for non-singular matrix. - char job = '1'; - Array rz (dim_vector (2 * nc, 1)); - double *prz = rz.fortran_vec (); - F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, F77_DBLE_CMPLX_ARG (tmp_data), nr, anorm, - rcon, F77_DBLE_CMPLX_ARG (pz), prz, zgecon_info - F77_CHAR_ARG_LEN (1))); - - if (zgecon_info != 0) - info = -1; + if (octave::math::isnan (anorm)) + rcon = octave::numeric_limits::NaN (); + else + { + F77_INT zgecon_info = 0; + + // Now calculate the condition number for non-singular matrix. + char job = '1'; + Array rz (dim_vector (2 * nc, 1)); + double *prz = rz.fortran_vec (); + F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), + nc, F77_DBLE_CMPLX_ARG (tmp_data), nr, + anorm, rcon, F77_DBLE_CMPLX_ARG (pz), prz, + zgecon_info F77_CHAR_ARG_LEN (1))); + + if (zgecon_info != 0) + info = -1; + } } if ((info == -1 && ! force) diff -r d006285b7509 -r fb123529131b liboctave/array/fCMatrix.cc --- a/liboctave/array/fCMatrix.cc Tue Nov 22 08:23:44 2022 -0800 +++ b/liboctave/array/fCMatrix.cc Tue Nov 22 20:38:35 2022 +0100 @@ -893,19 +893,24 @@ info = -1; else if (calc_cond) { - F77_INT cgecon_info = 0; - - // Now calculate the condition number for non-singular matrix. - char job = '1'; - Array rz (dim_vector (2 * nc, 1)); - float *prz = rz.fortran_vec (); - F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, F77_CMPLX_ARG (tmp_data), nr, anorm, - rcon, F77_CMPLX_ARG (pz), prz, cgecon_info - F77_CHAR_ARG_LEN (1))); - - if (cgecon_info != 0) - info = -1; + if (octave::math::isnan (anorm)) + rcon = octave::numeric_limits::NaN (); + else + { + F77_INT cgecon_info = 0; + + // Now calculate the condition number for non-singular matrix. + char job = '1'; + Array rz (dim_vector (2 * nc, 1)); + float *prz = rz.fortran_vec (); + F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1), + nc, F77_CMPLX_ARG (tmp_data), nr, anorm, + rcon, F77_CMPLX_ARG (pz), prz, cgecon_info + F77_CHAR_ARG_LEN (1))); + + if (cgecon_info != 0) + info = -1; + } } if ((info == -1 && ! force) diff -r d006285b7509 -r fb123529131b scripts/ode/ode23.m --- a/scripts/ode/ode23.m Tue Nov 22 08:23:44 2022 -0800 +++ b/scripts/ode/ode23.m Tue Nov 22 20:38:35 2022 +0100 @@ -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); diff -r d006285b7509 -r fb123529131b scripts/ode/ode23s.m --- a/scripts/ode/ode23s.m Tue Nov 22 08:23:44 2022 -0800 +++ b/scripts/ode/ode23s.m Tue Nov 22 20:38:35 2022 +0100 @@ -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); diff -r d006285b7509 -r fb123529131b scripts/ode/ode45.m --- a/scripts/ode/ode45.m Tue Nov 22 08:23:44 2022 -0800 +++ b/scripts/ode/ode45.m Tue Nov 22 20:38:35 2022 +0100 @@ -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));