bugGNU Octave - Bugs: bug #38999, optimset("Disp",...

 
 

bug #38999: optimset("Disp", "off") not accepted

Submitter:  Muhali <muhali>
Submitted:  Wed 15 May 2013 02:20:30 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 25 Jun 2013 09:57:55 AM UTC, comment #4: 

So how would one do


optimset ("objf", "foo")


without getting a warning? - You'd have to rename almost half of the optim-package options to become unique then.

Muhali <muhali>
Fri 24 May 2013 12:51:46 PM UTC, comment #3: 

We warn for many things that Matlab does not. The code still runs and produces the desired result, doesn't it? You should clean up your code if it relies on behaviours such as division by zero or the braindead Matlab short-circuiting. It seems reasonable to me to also warn if you are using ambiguous options, since this might be an unintended error.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Fri 24 May 2013 07:10:09 AM UTC, comment #2: 

Is the warning about ambiguous options actually necessary? It is different from ML and causes a lot of noise.

Muhali <muhali>
Fri 17 May 2013 04:58:08 PM UTC, comment #1: 

Thanks for the patch.  I checked in a slightly different solution using strncmpi.  I also fixed optimget in a similar way and added some tests.

http://hg.savannah.gnu.org/hgweb/octave/rev/bc79ac595a05

John W. Eaton <jwe>
Group administrator
Wed 15 May 2013 02:20:30 PM UTC, original submission:  

octave warns and does not accept


optimset("Disp", "off")


while ML accepts "Disp" as long as it remains unambiguous (which I would prefer).

Here is a patch that fixes it (using the deprecated strmatch which I found easier to handle).


--- old/optimset.m
+++ new/optimset.m
@@ -135,11 +135,14 @@
     for [val, key] = new
       if (validation)
         ## Case insensitive lookup in all options.
-        i = lookup (lopts, tolower (key));
+        i = strmatch(tolower (key), lopts) ;
         ## Validate option.
-        if (i > 0 && strcmpi (opts{i}, key))
+        if (length(i) == 1)
           ## Use correct case.
           key = opts{i};
+        elseif (length(i) > 1)
+          fmt = [" (" repmat("%s, ", 1, length(i)-1) "%s)"] ;
+          warning (["ambiguous option: %s" fmt], key, opts{i});
         else
           warning ("unrecognized option: %s", key);
         endif


Muhali <muhali>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by jordigh (Updated the item)
  • -email is unavailable- added by muhali (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-05-17 jwe CategoryNone Octave Function
        StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2013-05-15 jordigh StatusNone Patch Submitted
        Summaryoptimset(&quot;Disp&quot;, &quot;off&quot;) optimset("Disp", "off") not accepted

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code