Do Octave functions have corresponding c functions?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Do Octave functions have corresponding c functions?

GoSim
I downloaded the octave source files and I was expecting to find
corresponding c-files to the functions in octave. So a function like plus()
would have a c-coded equivalent that octave calls. But when I make a file
search I don't find such files. How does it work? If I want to find the
c-code that is run by a function like plus() where do I look? Thanks in
advance.



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html

Reply | Threaded
Open this post in threaded view
|

Re: Do Octave functions have corresponding c functions?

Mike Miller-4
On Thu, Nov 21, 2019 at 16:20:31 -0600, GoSim wrote:
> I downloaded the octave source files and I was expecting to find
> corresponding c-files to the functions in octave. So a function like plus()
> would have a c-coded equivalent that octave calls. But when I make a file
> search I don't find such files. How does it work? If I want to find the
> c-code that is run by a function like plus() where do I look? Thanks in
> advance.

Yes, let's take plus as an example.

First, the which function will tell you where to look.

    >> which plus
    'plus' is a built-in function from the file libinterp/corefcn/data.cc

Look in that source file for a DEFUN named 'plus'. Line 6062 in the
current development branch

  https://hg.savannah.gnu.org/hgweb/octave/file/da163456abb3/libinterp/corefcn/data.cc#l6062

HTH,

--
mike

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Do Octave functions have corresponding c functions?

Gene Harvey
On Thu, Nov 21, 2019 at 4:41 PM Mike Miller <[hidden email]> wrote:

>
> On Thu, Nov 21, 2019 at 16:20:31 -0600, GoSim wrote:
> > I downloaded the octave source files and I was expecting to find
> > corresponding c-files to the functions in octave. So a function like plus()
> > would have a c-coded equivalent that octave calls. But when I make a file
> > search I don't find such files. How does it work? If I want to find the
> > c-code that is run by a function like plus() where do I look? Thanks in
> > advance.
>
> Yes, let's take plus as an example.
>
> First, the which function will tell you where to look.
>
>     >> which plus
>     'plus' is a built-in function from the file libinterp/corefcn/data.cc
>
> Look in that source file for a DEFUN named 'plus'. Line 6062 in the
> current development branch
>
>   https://hg.savannah.gnu.org/hgweb/octave/file/da163456abb3/libinterp/corefcn/data.cc#l6062

Additionally, you can find more information about the organization of the source files at