help-octave
[Top][All Lists]
Advanced

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

Include Fortran Code which Returns Arrays of Dynamic/Unknown Size


From: John W. Eaton
Subject: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size
Date: Wed, 08 Oct 2008 14:19:39 -0400

On  8-Oct-2008, Marco2008 wrote:

| 
| Hello!
| 
| I would like to use some fortran subroutines from within octave. With the
| documentation from the octave-homepage it works fine with an example of the
| form:
| 
| ... 
| octave_value_list retval;
| Matrix M1 = Matrix(4,3);
| F77_XFCN (function, FUNCTION, ( M1.fortran_vec() ) );
| retval(0) = M1;
| ...
| 
| Here, I the size of the matrix M1 is fixed. But in some cases I do not know
| before the call of the fortran subroutine what size the return value M1 has
| because this size is computed inside the fortran subroutine. I tried
| something like 
| 
| ...
| octave_value_list retval;
| Matrix M1;
| F77_XFCN (function, FUNCTION, ( M1.fortran_vec() );
| retval(0) = M1;
| ...
| 
| but it does not work. Therefor, I would like to know if and possibly how
| that can be realized. 
| It should be possible by defining a very large matrix M1 in the c++-wrapper
| and return additionally the actually needed size from the fortran subroutine
| by an integer variable. The return value M1 then has to be resized. 
| But I would like to avoid this solution, because you never know what "very
| large" means.
| 
| If someone had an idea, I would be very glad.

I think we need to know more details about precisely how your function
does what you claim it does.  Perhaps you could post a simple example
that has all the relevant features (i.e., some Fortran function that
allocates a matrix and returns it as a parameter).  Exactly how does
your Fortran function allocate the data?  How would you call your
fucntion in a program written purely in Fortran?

jwe


reply via email to

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