fminunc with a one-variable function

Jaroslav Hajek highegg at gmail.com
Fri Jul 24 23:15:51 CDT 2009


On Fri, Jul 24, 2009 at 9:55 PM, Jonathan Stickel<jjstickel at vcn.com> wrote:
> Jaroslav Hajek wrote:
>>
>> On Fri, Jul 24, 2009 at 7:34 PM, Jonathan Stickel<jjstickel at vcn.com>
>> wrote:
>>>
>>> Jaroslav Hajek wrote:
>>>>
>>>> On Thu, Jul 23, 2009 at 5:32 PM, Jonathan Stickel<jjstickel at vcn.com>
>>>> wrote:
>>>>>
>>>>> I see the following when I use fminunc to minimize a function of just
>>>>> one
>>>>> variable:
>>>>>
>>>>>  function F = theF(x)
>>>>>  F = x.^2 + exp(x);
>>>>>  endfunction
>>>>>  x0 = 1;
>>>>>  [xmin,fmin] = fminunc(@theF,x0)
>>>>>
>>>>> error: Invalid call to cholupdate.  Correct usage is:
>>>>>
>>>>>  -- Loadable Function: [R1, INFO] = cholupdate (R, U, OP)
>>>>>
>>>>>
>>>>> I know that there are other minimization functions that can be used for
>>>>> single-variable functions, but fminunc should work too.
>>>>>
>>>>> Thanks,
>>>>> Jonathan
>>>>>
>>>> Please try
>>>> http://hg.savannah.gnu.org/hgweb/octave/rev/5fcf008c7c41
>>>>
>>> OK, I managed to compile chol.cc (thanks to jwe) from the indicated
>>> changeset and put it in my path:
>>>
>>> octave:6> which chol
>>> `chol' is a function from the file
>>> /Users/jstickel/programming/octave/local/chol.oct
>>>
>>> However, I still see the same error as reported above.
>>>
>>
>> Of course you do. The error was in cholupdate et al., so you need also
>> to override the autoloads. Or just replace the chol.oct file in
>> Octave's directory.
>>
>
> You are making assumptions about my competencies here!

Sorry. I only had seconds left to write the message (hurrying for a bus).

> Most of the time I
> work in m-file land, where I think I do very well.  However, I know just
> enough about compiled programming to fumble my way around, provided I have
> some good instructions or examples to look at.
>
> I would prefer not to overwrite the installed chol.oct since it is under the
> control of my system's package management.

Normally, this is not a problem. I've done this several times and
never encountered any problem when uninstalling or updating (Ubuntu,
OpenSUSE) the package. I wouldn't probably do it with a "vital"
package.

> What are these "autoloads" that
> you mention and how do I override them?
>

Autoloads are the way multiple functions from a single .oct file are
handled. Type "help autoload" for more info. You should do something
like:
autoload ("cholupdate", "path/to/your/compiled/chol.oct");
replacing cholupdate should be enough to fix your problem, but
cholinsert, choldelete and cholshift also suffer from the bug.

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



More information about the Bug-octave mailing list