# HG changeset patch # User John W. Eaton # Date 1218086210 14400 # Node ID dca99c4921348857c8fc69c649d02a123f21494d # Parent 30629059b72dcc86a8ea614e7f37de8c462b6165 fsolve.cc: make override_options work diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2008-08-07 John W. Eaton + + * DLD-FUNCTIONS/fsolve.cc (override_options): Don't fail if + options_map does not contain an expected keyword. + Fix typo in warning identifier. + (make_unimplemented_options): Use CamelCase names here. + 2008-08-06 Soren Hauberg * error.cc (Ferror): Update format of error messages in exmple. diff --git a/src/DLD-FUNCTIONS/fsolve.cc b/src/DLD-FUNCTIONS/fsolve.cc --- a/src/DLD-FUNCTIONS/fsolve.cc +++ b/src/DLD-FUNCTIONS/fsolve.cc @@ -209,28 +209,28 @@ { initialized = true; - options.insert ("largescale"); - options.insert ("derivativecheck"); - options.insert ("diagnostics"); - options.insert ("diffmaxchange"); - options.insert ("diffminchange"); - options.insert ("display"); - options.insert ("funvalcheck"); - options.insert ("jacobian"); - options.insert ("maxfunevals"); - options.insert ("maxiter"); - options.insert ("outputfcn"); - options.insert ("plotfcns"); - options.insert ("tolfun"); - options.insert ("tolx"); - options.insert ("typicalx"); - options.insert ("jacobmult"); - options.insert ("jacobpattern"); - options.insert ("maxpcgiter"); - options.insert ("precondbandwidth"); - options.insert ("tolpcg"); - options.insert ("nonleqnalgorithm"); - options.insert ("linesearchtype"); + options.insert ("Largescale"); + options.insert ("DerivativeCheck"); + options.insert ("Diagnostics"); + options.insert ("DiffMaxChange"); + options.insert ("DiffMinChange"); + options.insert ("Display"); + options.insert ("FunValCheck"); + options.insert ("Jacobian"); + options.insert ("MaxFunEvals"); + options.insert ("MaxIter"); + options.insert ("OutputFcn"); + options.insert ("PlotFcns"); + options.insert ("TolFun"); + options.insert ("TolX"); + options.insert ("TypicalX"); + options.insert ("JacobMult"); + options.insert ("JacobPattern"); + options.insert ("MaxPCGIter"); + options.insert ("PrecondBandwidth"); + options.insert ("TolPCG"); + options.insert ("NonlEqnAlgorithm"); + options.insert ("LineSearchType"); } return options; @@ -244,28 +244,32 @@ for (octave_idx_type i = 0; i < keys.length (); i++) { std::string key = keys(i); - std::transform (key.begin (), key.end (), key.begin (), tolower); - if (key == "tolx") + // FIXME -- we should be using case-insensitive comparisons. + + if (key == "TolX") { - Cell c = option_map.contents (key); + if (option_map.contains (key)) + { + Cell c = option_map.contents (key); - if (c.numel () == 1) - { - octave_value val = c(0); + if (c.numel () == 1) + { + octave_value val = c(0); - if (! val.is_empty ()) - { - double dval = val.double_value (); + if (! val.is_empty ()) + { + double dval = val.double_value (); - if (! error_state) - opts.set_tolerance (dval); - else - gripe_wrong_type_arg ("fsolve", val); + if (! error_state) + opts.set_tolerance (dval); + else + gripe_wrong_type_arg ("fsolve", val); + } } + else + error ("fsolve: invalid value for %s option", key.c_str ()); } - else - error ("fsolve: invalid value for %s option", key.c_str ()); } else { @@ -274,16 +278,19 @@ if (unimplemented_options.find (key) != unimplemented_options.end ()) { - Cell c = option_map.contents (key); - - if (c.numel () == 1) + if (option_map.contains (key)) { - octave_value val = c(0); + Cell c = option_map.contents (key); + + if (c.numel () == 1) + { + octave_value val = c(0); - if (! val.is_empty ()) - warning_with_id ("Octave:fsolve-unimplemented option", - "fsolve: option `%s' not implemented", - key.c_str ()); + if (! val.is_empty ()) + warning_with_id ("Octave:fsolve-unimplemented-option", + "fsolve: option `%s' not implemented", + key.c_str ()); + } } } }