[Top][All Lists]

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

Passing a "ColumnVector" to a Fortran subroutine

From: Eduardo Gallestey
Subject: Passing a "ColumnVector" to a Fortran subroutine
Date: Thu, 04 Nov 1999 15:16:51 +1100

Hi folks,

I have a fortran program, which I want to call from the "octave"
environment. Say


As far as I understand, the solution is to write a C++ function, which
would then call the Fortran subroutine. I have been able to do that and
it works correctly. 

However, the data transfer to and from FORTRAN is very  inefficient. The
reason is that FORTRAN doesn't understand the structures "Matrix",
"ColumnVector", etc., and I can not pass "ColumnVector" as an argument
to the FORTRAN part. 

Now I am doing loops to copy the data "ColumnVector" into a a C++
"array", acceptable for FORTRAN:


DEFUN_DLD (Test, args , , "")

/* Get data */
ColumnVector data=args(1).vector_value();

int N=data.length();
double x[N], y[N];

/* Horrible loop */

for (int i=0; i<N; i++)

/* useful action */


ColumnVector retval[N];

/* Horrible loop */

for (int i=0; i<N; i++)

and "retval" is returned to "octave" in the usual way.


I wonder if there is a way to avoid the "horrible loops" above. For
example, do I have access to the pointer, which "points" to the
numerical values contained in "ColumnVector"? It must be somewhere,
isn't it?

Sorry for the long formulation of the question.

Thanks in advance,

Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see
Instructions for unsubscribing:

reply via email to

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