help-octave
[Top][All Lists]
Advanced

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

Re: Passing matrices using Octave API


From: Mike Miller
Subject: Re: Passing matrices using Octave API
Date: Wed, 5 Oct 2016 12:04:13 -0700
User-agent: NeoMutt/20160916 (1.7.0)

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



reply via email to

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