bugGNU Octave - Bugs: bug #57199, [octave forge] (optim) lsqnonlin...

 
 

bug #57199: [octave forge] (optim) lsqnonlin in version 1.6.0 fails with Octave 6.0

Submitter:  None
Submitted:  Sun 10 Nov 2019 11:34:55 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  JZimmer Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 13 Jun 2020 09:05:23 AM UTC, comment #9: 

Bug #58519 was already fixed by JWE before I filed it, I didn't test with the last version of Octave devel.

So the current report is closed as fixed, too.

Olaf Till <i7tiol>
Group Member
Sun 07 Jun 2020 11:12:21 AM UTC, comment #8: 

The underlying problem could be triggered so:

octave:9> fieldname = "a";
octave:10> structure = struct (fieldname, 1);
octave:11> anonfunc = @ () structure.(fieldname);
octave:12> anonfunc ()
error: 'fieldname' undefined near line 1, column 1
error: called from
    @<anonymous> at line 1 column 18
octave:13>

This is now filed as bug #58519.

> The lsqnonlin error in Dev Octave is due to Octave becoming
> more restrictive in parsing anonymous functions
> (cf. bug #57255 and bug #57392).


There was no assignment, but rather a non-preserved variable, so I don't see a relation with the fix resulting from bug #57255.

> One way to fix it is to wrap the anonymous function code in
> eval to do the parsing.


This workaround would be rather intrusive, and I don't see why it works and so can't see under which conditions it would work. So I wouldn't apply it, but rather wait for a fix or explanation of the newly filed bug #58519.

Olaf Till <i7tiol>
Group Member
Tue 28 Jan 2020 10:19:11 PM UTC, comment #7: 

The lsqnonlin error in Dev Octave is due to Octave becoming more restrictive in parsing anonymous functions (cf. bug #57255 and bug #57392).

One way to fix it is to wrap the anonymous function code in eval to do the parsing. This entails replacing lines 119-131 of _jacobian_constants_.m  with


eval (['f.(fname) = @ (p, varargin) f.' fname ' (p, varargin{1:end-1}, cell2fields ({v_opts{:}, o.plabels, assign(o.jac_fixed, o.nonfixed, varargin{end}.fixed), o.cstep, o.parallel_local,  o.parallel_net, true}, {names_j{:}, "plabels", "fixed", "h", "parallel_local", "parallel_net", "__check_first_call__"}, 2, varargin{end}));'])


This lets the example and tests run correctly. I don't know if there's a better way.

Nir Krakauer <nir_krakauer>
Tue 28 Jan 2020 04:25:31 PM UTC, comment #6: 

OP here, following up on my last comment: we tried to install optim-1.5.2 for the Octave dev as of 26th January, but that installation now fails:

pkg install optim-1.5.2.tar.gz
warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead
In file included from error-helpers.cc:22:
error-helpers.h:26:22: error: 'octave_execution_exception' does not name a type; did you mean 'octave_exec_exception'?
   26 | void c_verror (const octave_execution_exception&, const char *, ...);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                      octave_exec_exception
error-helpers.cc:36:17: error: 'octave_execution_exception' does not name a type; did you mean 'octave_exec_exception'?
   36 | c_verror (const octave_execution_exception&, const char *fmt, ...)
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 octave_exec_exception
make: *** [Makefile:74: error-helpers.o] Error 1
make: Entering directory '/c/Users/JZimmer/AppData/Local/Temp/oct-QZ12OO/optim-1.5.2/src'
CXXFLAGS="-g -O2 -Wno-deprecated-declarations" C:/Octave/OCTAVE~2.0/mingw64/bin/mkoctfile-6.0.0.exe -c error-helpers.cc
make: Leaving directory '/c/Users/JZimmer/AppData/Local/Temp/oct-QZ12OO/optim-1.5.2/src'

error: pkg: error running 'make' for the optim package.
error: called from
    configure_make at line 105 column 9
    install at line 196 column 7
    pkg at line 482 column 9

The error I encountered when I tried to install optim-1.5.3 is also still present, just as well as the original problem with optim-1.6.0.
To recap: with the latest dev as of January 2020, there is no functional optim package as of the lastest 4 versions.

Anonymous
Mon 11 Nov 2019 07:09:33 AM UTC, comment #5: 

OP here, I tried a workaround because I actually need the Octave dev version, but would also like a working optim package ... I installed optim 1.5.2 and everything works just as expected, just FYI.
(I couldn't install optim 1.5.3 because during the installation I encountered an unexpected error in error-helpers.cc which pointed to the variables 'cerr' and 'errc' ... I also couldn't resolve this error in a timely manner so instead I tried to downgrade the package even more. Which unexpectedly worked out really well.)

Anonymous
Sun 10 Nov 2019 07:48:58 PM UTC, comment #4: 

@Olaf:
Your reasoning is fair enough.

I usually work with bleeding edge Octave so I have to keep the packages I maintain (io and mapping) working with dev Octave but that is a personal thing.

After a brief look it turned out the lsqnonlin.m code is too involved for me - I rarely if ever use the optim package anyway.
And no, I wouldn't know which change in core Octave can be pointed to.

So I wouldn't mind if you set status to "postponed".

Philip Nienhuis <philipnienhuis>
Group Member
Sun 10 Nov 2019 02:20:13 PM UTC, comment #3: 

For me, with Octave-5.1 and optim-1.6.0, 'test lsqnonlin' succeeds.

For what I know, 5.1 is the latest release of Octave. The development version is a moving target. What changeset do you mean by Octave-6.0?

Unless I've missed a feature freeze of octave-dev or a call to test with the packages, I'll probably have to put looking for the cause of this bug off for later -- the bug may well be due to a preliminary or incomplete change in octave-dev. Or are you aware of a certain change in m-code interpretation of octave-dev which inevitably will have to be cared for?


Olaf Till <i7tiol>
Group Member
Sun 10 Nov 2019 01:40:23 PM UTC, comment #2: 

cc'ing package maintainer

Philip Nienhuis <philipnienhuis>
Group Member
Sun 10 Nov 2019 01:33:13 PM UTC, comment #1: 

Confirmed:

I was going to ask for a use case to reproduce this bug, but just running the test gives:

> test lsqnonlin
***** test
 t = [0 .3 .8 1.1 1.6 2.3];
 y = [.82 .72 .63 .60 .55 .50];
 yhat = @(c,t) c(1) + c(2)*exp(-t);
 opt = optimset('TolFun',1e-10);
 [c,resnorm,residual] = lsqnonlin(@(c)yhat(c,t)-y,[1 1],[0 0],[],opt);
 assert (c, [ 0.47595; 0.34132], 1e-5)
 assert (resnorm, 3.2419e-004, 1e-8)
 assert(residual, [-2.7283e-003, 8.8079e-003, -6.8307e-004, -1.0432e-002, -5.1366e-003, 1.0172e-002], 1e-
5)
!!!!! test failed
'fname' undefined near line 121, column 121


Maybe this is an easy to fix bug.

Philip Nienhuis <philipnienhuis>
Group Member
Sun 10 Nov 2019 11:34:55 AM UTC, original submission:  

Hello,

I'm trying to call the function lsqnonlin() which belongs to the Optim package. Using code that used to work with an older release of Octave (5.1 & Optim package 1.5.3), I'm not getting any output but instead the following error:


error: 'fname' undefined near line 121, column 121
error: called from
    __jacobian_constants__>@<anonymous> at line 121 column 11
    __lm_svd__ at line 196 column 9
    __nonlin_residmin__ at line 452 column 25
    nonlin_residmin at line 98 column 25
    lsqnonlin at line 264 column 21


My current system looks like the following:


ver
----------------------------------------------------------------------
GNU Octave Version: 6.0.0 (hg id: 37f9eb2c05e0+)
GNU Octave License: GNU General Public License
Operating System: Linux 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct
10 10:36:02 UTC 2019 x86_64
----------------------------------------------------------------------
Package Name  | Version | Installation directory
--------------+---------+-----------------------
     control *|   3.2.0 | /home/IT/jzimmer/octave/control-3.2.0
       image *|  2.10.0 | /home/IT/jzimmer/octave/image-2.10.0
          io *|  2.4.13 | /home/IT/jzimmer/octave/io-2.4.13
       optim *|   1.6.0 | /home/IT/jzimmer/octave/optim-1.6.0
      signal *|   1.4.1 | /home/IT/jzimmer/octave/signal-1.4.1
  statistics *|   1.4.1 | /home/IT/jzimmer/octave/statistics-1.4.1
      struct *|  1.0.16 | /home/IT/jzimmer/octave/struct-1.0.16


I spotted some changes in a backend procedure/call/... involving "__lm_svd__" in the function nonlin_residmin in Optim 1.6.0 compared to 1.5.3, but I'm not entirely sure if that's really the root of the problem or if it's also got to do with the Octave 6.0 version.




Anonymous

 

(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 siko1056 (Updated the item)
  • -email is unavailable- added by nir_krakauer (Posted a comment)
  • -email is unavailable- added by i7tiol (Posted a comment)
  • -email is unavailable- added by philipnienhuis
  • -email is unavailable- added by None (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-04-28 siko1056 Summary[octave-forge] (optim) lsqnonlin in version 1.6.0 fails with Octave 6.0 [octave forge] (optim) lsqnonlin in version 1.6.0 fails with Octave 6.0
    2020-06-13 i7tiol StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2019-11-10 philipnienhuis Carbon-Copy- Added i7tiol
    2019-11-10 philipnienhuis StatusNone Confirmed
        Releasedev other
        Operating SystemGNU/Linux Any
        SummaryLsqnonlin (optim package version 1.6.0) fails with Octave 6.0 [octave-forge] (optim) lsqnonlin in version 1.6.0 fails with Octave 6.0

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code