[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A bit puzzled...
From: |
Albert F. Niessner |
Subject: |
A bit puzzled... |
Date: |
18 Dec 2002 15:19:12 -0500 |
Thanks for your responses to my posts, but your replies have me a bit
puzzled.
In one of them
(http://www.octave.org/mailing-lists/help-octave/2002/1164), you wrote:
"The data is not actually copied until you do A.fortran_vec() to access
the data for modification."
However, in the other
(http://www.octave.org/mailing-lists/help-octave/2002/1163) you wrote:
"If the operation is not in place, or if you need a working vector,
allocate it beforehand:
octave_value_list retval;
const Matrix A(args(0).matrix_value());
const Matrix B(args(1).matrix_value());
Matrix C(A.rows(),B.columns());
F77_FUNC(f,F)(A.data(),B.data(),C.fortran_vec());
retval(0) = C;
return retval;"
But, if the data is being copied at the C.fortran_vec() routine, then
retval(0) = C cannot possibly contain the answer. In fact, this is
exactly what I am seeing. If I make changes to allow for a copy
operation taking place I get a segmentation fault. I think it is from
retval(0) = fvec where 'double *fvec = C.fortran_vec();'. I will walk
through the core dump when I get a chance, but it may take a while.
I then walked through some of the octave code and I saw in Array.h that
the template defines fortran_vec() as 'return data()' which is defined
as 'return rep->data' which I think is T *data. So, I am not sure why
your example does not work or why you suggest a copy operation takes
place.
I have read liboctave.ps and "Da Coda Al Fine" and did not find the
answers there either.
Al Niessner
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- A bit puzzled...,
Albert F. Niessner <=