[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[] indexing of Array type.
From: |
Quentin Spencer |
Subject: |
[] indexing of Array type. |
Date: |
Mon, 21 Nov 2005 12:07:56 -0600 |
User-agent: |
Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) |
I'm writing a function in C that I would like to make available to an
other program without requiring the octave headers, so I'm writing an
octave wrapper around it. I'd like to be able to create an octave array
of the size I want, and then pass a pointer to the data within the array
to the external function so that the external function does not require
octave headers. I have been able to do something like this:
RowVector x(SIZE);
const double* y=x.data();
external_func(y);
However, this gives read-only access to the data (it won't compile
unless y is declared as a const double*). Suppose I want to create an
external_func(const double* y, double* z) that takes y as input, and
puts values in z. The only way I've successfully done this so far is by
creating the array and then copying the results into an octave Array
type in the wrapper function, which seems like unnecessary overhead. Is
there any way I can just access the pointer directly using the data
member function without making the declaration a const?
-Quentin
-------------------------------------------------------------
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
-------------------------------------------------------------
- [] indexing of Array type.,
Quentin Spencer <=