
From:  Shamika Mohanan 
Subject:  Re: Passing matrices using Octave API 
Date:  Thu, 6 Oct 2016 10:40:57 +0530 
On Tue, Oct 04, 2016 at 14:18:17 +0530, Shamika Mohanan wrote:
> Hello,
>
> I'm using Octave API functions in cpp code. I have two doubts.
>
> 1. Is it possible to pass a 2D/hyper matrix from one function to another
> function. I need to perform operations in c++ code similar to the code
> given below
>
> foo1(iRows,iCols)
> {
>
> ComplexMatrix matrix_double_complex = ComplexMatrix (iRows,iCols);
> //Perform calculations
> return matrix_double_complex;
> }
>
> foo2(matrix_double_complex)
> {
> octave_value _list in(1)=octave_value (matrix_double_complex);
> }
>
> 2. Is it possible to pass the entries of an octave value list from one
> function to another?
> Something like this
>
> foo1()
> {
> return octave_value_list in;
> }
>
> foo2(octave_value_list in)
> {
> a=in(1);
> //Perform calculations
> }
>
> Can this be done using pointers? Any help would be appreciated.
Could you include a more complete example of what you are trying to do?
How are the functions foo1 and foo2 called? Does one of them call the
other? Are they both internal functions or are they DEFUNs for the
interpreter to call?
Lacking that information, all I can is yes it is possible to pass
matrices and octave value lists from one function to another, and there
are numerous examples in the Octave code base itself.

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