[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem creating complied oct file
From: |
babelproofreader |
Subject: |
Problem creating complied oct file |
Date: |
Sat, 3 Oct 2009 03:52:34 -0700 (PDT) |
I have written a function that by necessity uses a loop for recursive
calculations and also has loops within the main loop and as a result it is
very slow. Despite much investigation I have not been able to find out how
to vectorise this function and so have decided to compile an oct file as I
believe the loop structures can be easily written in c++. However I am
having problems just passing arguments to the function and retrieving the
output value. My code so far, in a file called "loop.cc", is
#include <octave/oct.h>
#include <octave/dColVector.h>
DEFUN_DLD (loop, args, , "Help String")
{
octave_value retval;
double numbers = args(0);
// Do something
octave_stdout << "The input values are " << numbers << "\n";
retval = numbers;
return retval;
}
The input, args(0), is a column vector of values, but when I try compiling I
get the error message
loop.cc: In function ‘octave_value_list Floop(const octave_value_list&,
int)’:
loop.cc:7: error: cannot convert ‘octave_value’ to ‘double’ in
initialization
Can anyone suggest how I can pass a column vector of values (consisting of
positive and negative numbers with up to 6 decimal places) as an argument to
the function? Also, in anticipation of problems in returning calculated
values, what would be the correct syntax for the function to return 2
separate column vectors after calculations based on the input?
--
View this message in context:
http://www.nabble.com/Problem-creating-complied-oct-file-tp25727690p25727690.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Problem creating complied oct file,
babelproofreader <=