octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54952] optimset (old, new) uses empty fields


From: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #54952] optimset (old, new) uses empty fields from 'new'
Date: Sat, 24 Nov 2018 19:27:12 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36

Update of bug #54952 (project octave):

                  Status:                   Fixed => None                   
             Open/Closed:                  Closed => Open                   

    _______________________________________________________

Follow-up Comment #3:

Sorry for opening this one again, but it triggered bug #55089.

The reason is a strange recursive interplay by
"scripts/optimization/__all_options__" and "scripts/optimization/optimset". 
It took me some time to understand it to 95% yet.

__all_options__ contains a persistent variable "save_names" [1] that gets
filled by calling a Matlab compatible feature of "optimset" [2,3], but [2]
does not make it very obvious that a call like


optimset ('fsolve')


is fully legitimate.  This call invokes


fsolve ('defaults')


which in turn calls "optimset" with, guess what, EMPTY VALUES! [4]  Pure
horror ^^

So my solution out of this misery was to change all instances in
"scripts/optimization" like [4] to return pure structs.  I think the recursive
output validation by optimset is not necessary and I support the changes made
so far with the non-emptiness check, which is also R2018b compatible.

This way both calls return the correct values:


>> optimset ('fsolve')
>> fsolve ('defaults')
ans =

  scalar structure containing the fields:

    AutoScaling = off
    ComplexEqn = off
    FunValCheck = off
    FinDiffType = forward
    Jacobian = off
    MaxFunEvals = [](0x0)
    MaxIter =  400
    OutputFcn = [](0x0)
    Updating = off
    TolFun =  0.0000010000
    TolX =  0.0000010000
    TypicalX = [](0x0)



The only thing I did not find out yet was, when does this persistent variable
gets filled?  Because at every start of Octave it contains the right values?!

[1]
https://hg.savannah.gnu.org/hgweb/octave/file/c197655f9d28/scripts/optimization/__all_opts__.m#l29

[2]
https://hg.savannah.gnu.org/hgweb/octave/file/c197655f9d28/scripts/optimization/optimset.m#l31

[3]
https://hg.savannah.gnu.org/hgweb/octave/file/c197655f9d28/scripts/optimization/optimset.m#l133

[4]
https://hg.savannah.gnu.org/hgweb/octave/file/c197655f9d28/scripts/optimization/fsolve.m#l175

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54952>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]