help-octave
[Top][All Lists]
Advanced

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

Re: Techniques in using liboctave and liboctinterp from C++ program


From: dbateman
Subject: Re: Techniques in using liboctave and liboctinterp from C++ program
Date: Thu, 26 Jun 2008 10:56:25 -0700 (PDT)



John Swensen wrote:
> 
> I have started using the datatypes and operations of Octave from C++  
> for my research and have a few questions.
> 
> 1) Can builtin functions and DLD-FUNCTIONS (e.g. find, eig, conv2,  
> etc) be used directly from C++?
> 

You can always use feval to call an m-file or oct-file. You can't really
call an oct-file directly from C++. What you can have for example is if the
oct-file calls another C++ function, you might declare that function extern
and call it as well, though the oct-file would have to be loaded first



> 2) In the documentation, is there a list of overloaded operators for  
> octave_value objects of different types?  For example, I was trying to  
> do the following:
> Matrix A(768,1024);
> Matrix B(1,1);
> Matric C = A*B;
> This, however, didn't work.  Instead, I had to declare B as a scalar  
> double as follows:
> Matrix A(768,1024);
> double b;
> Matrix C = A*B;
> This isn't necessarily a problem, but it would be nice if there was a  
> list of possible overloads somewhere.
> 

That's not so easy for two reasons. Firstly someone has to do the work of
documenting them. However, the second reason is harder. Having documented
these functions they then define an API to the internals of Octave,
something that has never really been stable. Therefore some thought needs to
go into this process of what functionality to document in an API.



> 3) I often do image thresholding after I have processed it a bit.  In  
> the Octave interpreter I can simply type 'im2 = im1>0.5'.  I tried  
> doing the following, but it didn't work:
> Matrix A(768,1024);
> double B = 0.5;
> Matrix C = A>B;
> If I could find out where that bit of the interpreter was implemented,  
> I could figure it out, but I searched through the sources a bit and  
> couldn't find anything.
> 

I don't have a copy of Octave with me, but check the file
src/OPERATORS/op-m-m.cc for the gt function and see what it does.

D.
-- 
View this message in context: 
http://www.nabble.com/Techniques-in-using-liboctave-and-liboctinterp-from-C%2B%2B-program-tp18137086p18139690.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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