bugGNU Octave - Bugs: bug #65526, (optim) ‘class...

 
 

bug #65526: (optim) ‘class octave::tree_parameter_list’ has no member named ‘length’

Submitter:  Dmitri A. Sergatskov <dasergatskov>
Submitted:  Thu 28 Mar 2024 06:22:21 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  10.3.0 Planned Release:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Jump to the original submission

Thu 07 Aug 2025 08:11:43 PM UTC, comment #12: 

The link I provided doesn't work, lost a character after pasting. Here it is again:

https://sourcefor ... d79f4a8caa9830d1/

Olaf Till <i7tiol>
Group Member
Thu 07 Aug 2025 08:09:12 PM UTC, comment #11: 

Fixed in repository:

https://sourcefor ... d79f4a8caa9830d1/

Sorry, I did this without looking at the posts, so I didn't see the patch by Dmitri, which was identical except for the comment...

But I checked that size() works with older octave version, too, see comment in patch.

Olaf

Olaf Till <i7tiol>
Group Member
Sun 03 Aug 2025 03:23:50 AM UTC, comment #10: 

Is this package still actively maintained?

Orion Poplawski <opoplawski>
Fri 25 Apr 2025 01:59:33 AM UTC, comment #9: 

The attached (file _max_nargin_optim_.m) works for me as replacement of _max_nargin_optim_.cc.

I would put it in "inst/private" directory since the functions that use this are there.

One needs to remove reference to _max_nargin_optim_.oct from the Makefile.in:

--- a/src/Makefile.in   Sun Jul 09 14:11:23 2023 +0200
+++ b/src/Makefile.in   Thu Apr 24 21:58:16 2025 -0400
@@ -50,8 +50,7 @@
 TEXIFILE := $(addsuffix .texi,$(basename $(INFOFILE)))
 TXIFILE := $(addsuffix .txi,$(basename $(INFOFILE)))
 HTMLDIR := ../doc/html/
-OCTFILES := __bfgsmin.oct numgradient.oct numhessian.oct __disna_optim__.oct \
-            __max_nargin_optim__.oct
+OCTFILES := __bfgsmin.oct numgradient.oct numhessian.oct __disna_optim__.oct

 OCTSOURCEFILES := $(addsuffix .cc,$(basename $(OCTFILES)))
 DSFILES := $(addsuffix .docstrings,$(OCTSOURCEFILES))


And remove _max_nargin_optim_.cc itself.

Dmitri.
--


(file #57168)

Dmitri A. Sergatskov <dasergatskov>
Wed 23 Apr 2025 11:12:11 PM UTC, comment #8: 

But it also does not seem to work for build-in functions / mex functions:


octave:1> mex setround.c
octave:2> pkg load optim
octave:3> __max_nargin_optim__ (@setround)
error: octave_base_value::user_function_value(): wrong type argument 'mex function'
octave:4> __max_nargin_optim__ (@sin)
error: octave_base_value::user_function_value(): wrong type argument 'built-in function'
octave:5> __max_nargin_optim__ (@numgradient)
error: octave_base_value::user_function_value(): wrong type argument 'dynamically-linked function'


So it looks like this function can be replaced by calls to "nargin".

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 23 Apr 2025 10:45:35 PM UTC, comment #7: 


comment #2:

> That patch may avoid the error, but I really think there has to be a better solution here.  Very little code outside of Octave core should need access to the parse tree.  What is the intent of this code?


I think this is a kind-of "nargin" function replacement that works on compiled functions ?!

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Tue 18 Mar 2025 08:35:34 PM UTC, comment #6: 

Hellow on Octave 10.0.90 is same error "no member named length". Solution given https://savannah. ... u.org/bugs/?65295 good solution.

Anonymous
Fri 24 Jan 2025 12:49:08 PM UTC, comment #5: 

Me too same problem. How to apply patch to optim package?

Anonymous
Sun 17 Nov 2024 03:26:44 PM UTC, comment #4: 

I'd like to bump it for visibility. Octave 10 to be released soon, so, perhaps an imperfect fix is still better than no fix.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 28 Mar 2024 06:41:01 PM UTC, comment #3: 

Adding the package maintainer to the CC list.

Markus Mützel <mmuetzel>
Group administrator
Thu 28 Mar 2024 06:35:04 PM UTC, comment #2: 

That patch may avoid the error, but I really think there has to be a better solution here.  Very little code outside of Octave core should need access to the parse tree.  What is the intent of this code?

John W. Eaton <jwe>
Group administrator
Thu 28 Mar 2024 06:26:21 PM UTC, comment #1: 

See also bug #65295

A.R. Burgers <arb>
Thu 28 Mar 2024 06:22:21 PM UTC, original submission:  

Due to some changes in Octave 10 (dev), optim package failed to compile with:

g++ -std=gnu++17 -c  -fPIC -I/usr/local/include/octave-10.0.0/octave/.. -I/usr/local/include/octave-10.0.0/octave -I/usr/local/include  -pthread -fopenmp -ggdb3 -O2 -march=native -mtune=native -mavx -mavx2 -flto=auto -Wall -Wno-deprecated-declarations    __disna_optim__.cc -o /tmp/oct-Xze0Ro.o
__max_nargin_optim__.cc: In function ‘octave_value_list F__max_nargin_optim__(const octave_value_list&, int)’:
__max_nargin_optim__.cc:74:55: error: ‘class octave::tree_parameter_list’ has no member named ‘length’
   74 |       (fcn.user_function_value ()->parameter_list ()->length ());
      |                                                       ^~~~~~
make[1]: *** [Makefile:78: __max_nargin_optim__.oct] Error 1


The patch from mxe-octave fixes that:
https://hg.octave ... ptim-2-list.patch


+

diff -r d5e565611871 -r 2254b71b9c11 src/__max_nargin_optim__.cc
--- a/src/__max_nargin_optim__.cc        Sun Jul 09 14:11:23 2023 +0200
+++ b/src/__max_nargin_optim__.cc        Wed Feb 07 20:30:33 2024 +0100
@@ -71,7 +71,7 @@
   else {

     retval = octave_value
-      (fcn.user_function_value ()->parameter_list ()->length ());
+      (fcn.user_function_value ()->parameter_list ()->size ());
   }

   return retval;


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>

 

Attached Files

Attached Files
file #57168:  __max_nargin_optim__.m added by dasergatskov (293B - text/x-objcsrc)

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

Digest:
   bug dependencies.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by arungiridhar (Updated the item)
  • -email is unavailable- added by i7tiol (Posted a comment)
  • -email is unavailable- added by opoplawski (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by mmuetzel
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by arb (Posted a comment)
  • -email is unavailable- added by dasergatskov (Submitted the item)
  •  

    Votes

    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.

     

    History

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-08-09 arungiridhar Open/ClosedOpen Closed
    2025-08-07 i7tiol StatusNone Fixed
        Fixed ReleaseNone 10.3.0
    2025-06-04 mmuetzel Dependencies- bugs #67189 is dependent
    2025-04-25 dasergatskov Attached File- Added _max_nargin_optim_.m, #57168
    2024-03-28 mmuetzel Carbon-Copy- Added i7tiol

    Back to the top

    Powered by Savane 3.16-ed84.
    Corresponding source code