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

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

[Octave-bug-tracker] [bug #66642] cellfun & arrayfun return zero values


From: Fernando
Subject: [Octave-bug-tracker] [bug #66642] cellfun & arrayfun return zero values if function returns fewer outputs than expected
Date: Fri, 10 Jan 2025 12:17:13 -0500 (EST)

Follow-up Comment #8, bug #66642 (group octave):

[comment #7 comment #7:]
> It would be useful to me to better understand why the call to f within
> cellfun fails to generate the error that occurs when it's called alone, and
> whether something is being missed there that should be addressed.

When function f is called alone, the error is generated by the instruction
where f is called. E.g. if we have a multi-assignment:
[a,b]=f(x)
the error happens when copying the function output to the lvalues a, b. This
is in pt-assign.cc (tree_multi_assignment::evaluate_n), line 291:

                      octave_value tmp = rhs_val(k);

                      if (tmp.is_undefined ())
                        error ("element number %" OCTAVE_IDX_TYPE_FORMAT
                               " undefined in return list", k+1);


If the instruction is a simple assignment, the error is generated in
pt-assign.cc (tree_simple_assignment::evaluate), line 103:

          if (rhs_val.is_undefined ())
            error ("value on right hand side of assignment is undefined");


So, this is done case by case, depending on the instruction. That's why we
have to consider that also in cellfun and arrayfun.


    _______________________________________________________

Reply to this item at:

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

_______________________________________________
Mensaje enviado vía Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

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