octave-maintainers
[Top][All Lists]
Advanced

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

Re: more help needed with function handles


From: John W. Eaton
Subject: Re: more help needed with function handles
Date: Wed, 25 Mar 2020 15:11:45 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 3/25/20 2:42 PM, "Markus Mützel" wrote:

It is surprisingly hard to find a built-in function that accepts a double input 
that is not implemented as a class method.
I finally tried with "isstr" (diary5). I hope that helps.

We could also try with an argument that is something other than double.

And another one without the "clear functions" (diary6).

I don't see any difference between those last two cases other than the "clear functions" command (which is fine).

I think I see what's happening now.  Thanks.

It's interesting that functions (@sin) shows an empty "file" field but functions (@isstr) says "MATLAB built-in function". Also, sin is shown as being a builtin in @double, but isstr is not in an '@' directory (not that they are actually there, I suppose it is just a convention for marking built-in functions with the classes they accept).

Octave already has a way to mark built-in functions with the classes they accept but only a few functions are tagged so far. For example, in libinterp/corefcn/svd.cc:


  DEFUN (svd, args, nargout,
         classes: double single
         doc: /* -*- texinfo -*-
         ...

the "classes:" line is used to insert the "double" and "single" class names in a table that is later used when searching for functions. The "sin" function in Octave is not marked this way. So if you execute the original test in Octave, it will do something different from Matlab, but if you change the test to use svd instead of sin, it will be closer to (I think maybe the same as) what Matlab does.

jwe



reply via email to

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