changeset 31498:e7bf202a2c89

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 21 Nov 2022 18:21:52 +0100
parents 3ccd6628a6f4 (current diff) 55f0173e4f08 (diff)
children 6bd338605fd3
files
diffstat 2 files changed, 36 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/dMatrix.cc	Mon Nov 21 11:01:06 2022 -0500
+++ b/liboctave/array/dMatrix.cc	Mon Nov 21 18:21:52 2022 +0100
@@ -596,19 +596,24 @@
     info = -1;
   else if (calc_cond)
     {
-      F77_INT dgecon_info = 0;
-
-      // Now calculate the condition number for non-singular matrix.
-      char job = '1';
-      Array<F77_INT> iz (dim_vector (nc, 1));
-      F77_INT *piz = iz.fortran_vec ();
-      F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
-                                 nc, tmp_data, nr, anorm,
-                                 rcon, pz, piz, dgecon_info
-                                 F77_CHAR_ARG_LEN (1)));
-
-      if (dgecon_info != 0)
-        info = -1;
+      if (octave::math::isnan (anorm))
+        rcon = octave::numeric_limits<double>::NaN ();
+      else
+        {
+          F77_INT dgecon_info = 0;
+
+          // Now calculate the condition number for non-singular matrix.
+          char job = '1';
+          Array<F77_INT> iz (dim_vector (nc, 1));
+          F77_INT *piz = iz.fortran_vec ();
+          F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
+                                     nc, tmp_data, nr, anorm,
+                                     rcon, pz, piz, dgecon_info
+                                     F77_CHAR_ARG_LEN (1)));
+
+          if (dgecon_info != 0)
+            info = -1;
+        }
     }
 
   if (info == -1 && ! force)
--- a/liboctave/array/fMatrix.cc	Mon Nov 21 11:01:06 2022 -0500
+++ b/liboctave/array/fMatrix.cc	Mon Nov 21 18:21:52 2022 +0100
@@ -602,19 +602,24 @@
     info = -1;
   else if (calc_cond)
     {
-      F77_INT sgecon_info = 0;
-
-      // Now calculate the condition number for non-singular matrix.
-      char job = '1';
-      Array<F77_INT> iz (dim_vector (nc, 1));
-      F77_INT *piz = iz.fortran_vec ();
-      F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
-                                 nc, tmp_data, nr, anorm,
-                                 rcon, pz, piz, sgecon_info
-                                 F77_CHAR_ARG_LEN (1)));
-
-      if (sgecon_info != 0)
-        info = -1;
+      if (octave::math::isnan (anorm))
+        rcon = octave::numeric_limits<float>::NaN ();
+      else
+        {
+          F77_INT sgecon_info = 0;
+
+          // Now calculate the condition number for non-singular matrix.
+          char job = '1';
+          Array<F77_INT> iz (dim_vector (nc, 1));
+          F77_INT *piz = iz.fortran_vec ();
+          F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
+                                     nc, tmp_data, nr, anorm,
+                                     rcon, pz, piz, sgecon_info
+                                     F77_CHAR_ARG_LEN (1)));
+
+          if (sgecon_info != 0)
+            info = -1;
+        }
     }
 
   if (info == -1 && ! force)