help-octave
[Top][All Lists]
Advanced

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

Re: vec() and trace() in the API


From: c.
Subject: Re: vec() and trace() in the API
Date: Tue, 31 Dec 2013 08:00:40 +0100

On 31 Dec 2013, at 06:50, Mike Puglia <address@hidden> wrote:

> I can't find where the functions vec (or (:)) and trace are implemented in 
> the C++ API.  I've checked all the matrix classes up to Array.h and the oct 
> files but couldn't find them.  Could anyone please point me to the right 
> place?
> 
> Thank you,
> 
> MTP

1) Typing "which vec" in a recent version of Octave I get:
'vec' is a built-in function from the file libinterp/corefcn/data.cc

The code for this function can be found here:
http://hg.savannah.gnu.org/hgweb/octave/file/0a248ef003f2/libinterp/corefcn/data.cc#l5064

If you need to use the same functionality in a C++ application you can use the 
'vec' builtin
directly as demonstrared in this example:
http://hg.savannah.gnu.org/hgweb/octave/file/0a248ef003f2/examples/standalonebuiltin.cc

or copy its implementation which consists of just a few lines.

2) 'trace' seems to be implemented as an m-file:

>> which trace
'trace' is a function from the file 
/usr/local/octave/3.8.0/share/octave/3.8.0/m/linear-algebra/trace.m

So, if you need it in a C++ application you can either invoke the interpreter 
as demonstrated here:
http://hg.savannah.gnu.org/hgweb/octave/file/0a248ef003f2/examples/embedded.cc

or you have to write your own C++ implementation.

HTH,
c.

reply via email to

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