[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Accessing passed parameters in an oct file
From: |
mpender |
Subject: |
Accessing passed parameters in an oct file |
Date: |
Wed, 1 Jan 2014 13:38:26 -0800 (PST) |
I'm new to using mkoctfile to integrate C++ with Octave and I'm struggling to
figure out how to access the parameters passed in a call to the C program.
I make a call from Octave like this:
reservememory (dimensionone, dimensiontwo);
and then in the file reservememory.cc I've tried to access the passed
parameters like:
int parm1, parm2;
parm1 = floor(args(0).floor());
parm2 = floor(args(1).floor());
Matrix tmp1 (parm1, parm2);
Matrix tmp2 (parm1, parm2);
set_global_value("P1", tmp1);
set_global_value("N1", tmp2);
I think the parameters are actually passed as doubles or arrays of doubles
and I can't find the right member function to just extract the values as
scalar integers. I want integers so I can use the numbers as array indices,
but even working with doubles would be a significant step forward at this
point.
The array indices are then used to reserve the memory in the C code instead
of within Octave. I understand there is some sort of Octave local memory
reserve function available for this, but this code is a bridge I'm using to
move from a completely Octave implementation to an NVIDIA-CUDA
implementation.
Thanks, Mike
--
View this message in context:
http://octave.1599824.n4.nabble.com/Accessing-passed-parameters-in-an-oct-file-tp4660504.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Accessing passed parameters in an oct file,
mpender <=