[Top][All Lists]

[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

In one of them
(, you wrote:
"The data is not actually copied until you do A.fortran_vec() to access
the data for modification."

However, in the other
( 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());
    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

I have read 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:
How to fund new projects:
Subscription information:

reply via email to

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