octave-maintainers
[Top][All Lists]
Advanced

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

Re: [fem-fenics] Function evaluation


From: Eugenio Gianniti
Subject: Re: [fem-fenics] Function evaluation
Date: Thu, 26 Jun 2014 08:50:55 +0000


On 26 Jun 2014, at 09:14, Kai Torben Ohlhus <address@hidden> wrote:

On Wed, Jun 25, 2014 at 1:06 PM, Eugenio Gianniti <address@hidden> wrote:
The first one concerns the handling of output arguments: currently the function evaluation stops complaining about their wrong number if they are not as much as the values the function takes. Probably it is too strict, but I do not know if there is an expected behaviour for Octave functions in this aspect or any guidelines to follow.


Hi Eugenio,

Do you face the "variable number of return values" in the context of m-files or within C++ code?

In C++ code.

For the first one you should sort your return values by decreasing necessity and then check via "nargout" the number of them. Then you might be able to avoid computations, if the caller doesn't request certain values of the return list.

That is what I do with the nargout made available by DEFUN_DLD, but basically with this function evaluation all the return values are the same: if you are evaluating a vectorial field you will get two or three values, if it is scalar it will be only one. There is no meaningful ranking of importance, that is why I implemented a strict check in the first place.

Eugenio



reply via email to

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