changeset 11049:b0a9450d81c6

luinc.cc: use octave_scalar_map instead of Octave_map
author John W. Eaton <jwe@octave.org>
date Wed, 29 Sep 2010 04:12:58 -0400
parents 10c65e01f042
children b1ee705aef45
files src/ChangeLog src/DLD-FUNCTIONS/luinc.cc
diffstat 2 files changed, 47 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-29  John W. Eaton  <jwe@octave.org>
+
+	* DLD-FUNCTIONS/luinc.cc (Fluinc): Use octave_scalar_map
+	instead of Octave_map.
+
 2010-09-29  John W. Eaton  <jwe@octave.org>
 
 	* DLD-FUNCTIONS/__glpk__.cc (F__glpk__): Use octave_scalar_map
--- a/src/DLD-FUNCTIONS/luinc.cc
+++ b/src/DLD-FUNCTIONS/luinc.cc
@@ -121,36 +121,53 @@
         }
       else if (args(1).is_map ())
         {
-          Octave_map map = args(1).map_value ();
-
-          if (map.contains ("droptol"))
-            droptol = map.contents ("droptol")(0).double_value ();
+          octave_scalar_map map = args(1).scalar_map_value ();
 
-          if (map.contains ("milu"))
-            {
-              double tmp = map.contents ("milu")(0).double_value ();
-
-              milu = (tmp == 0. ? false : true);
-            }
-
-          if (map.contains ("udiag"))
+          if (! error_state)
             {
-              double tmp = map.contents ("udiag")(0).double_value ();
+              octave_value tmp;
+
+              tmp = map.contents ("droptol");
+              if (tmp.is_defined ())
+                droptol = tmp.double_value ();
+
+              tmp = map.contents ("milu");
+              if (tmp.is_defined ())
+                {
+                  double val = tmp.double_value ();
+
+                  milu = (val == 0. ? false : true);
+                }
+
+              tmp = map.contents ("udiag");
+              if (tmp.is_defined ())
+                {
+                  double val = tmp.double_value ();
 
-              udiag = (tmp == 0. ? false : true);
+                  udiag = (val == 0. ? false : true);
+                }
+
+              tmp = map.contents ("thresh");
+              if (tmp.is_defined ())
+                {
+                  thresh = tmp.matrix_value ();
+
+                  if (thresh.nelem () == 1)
+                    {
+                      thresh.resize(1,2);
+                      thresh(1) = thresh(0);
+                    }
+                  else if (thresh.nelem () != 2)
+                    {
+                      error ("luinc: expecting 2 element vector for thresh");
+                      return retval;
+                    }
+                }
             }
-
-          if (map.contains ("thresh"))
+          else
             {
-              thresh = map.contents ("thresh")(0).matrix_value ();
-
-              if (thresh.nelem () == 1)
-                {
-                  thresh.resize(1,2);
-                  thresh(1) = thresh(0);
-                }
-              else if (thresh.nelem () != 2)
-                error ("chol: expecting 2 element vector for thresh");
+              error ("luinc: options argument must be a scalar structure");
+              return retval;
             }
         }
       else