[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do you pass two Octave functions to an .oct function?
From: |
babelproofreader |
Subject: |
Re: How do you pass two Octave functions to an .oct function? |
Date: |
Thu, 15 Oct 2009 06:40:53 -0700 (PDT) |
>Please be more specific and show some code if possible...
My code so far is
#include <octave/oct.h>
#include <octave/dColVector.h>
#include <octave/parse.h>
DEFUN_DLD (rollingfft, args, , "Help String")
{
octave_value_list retval;
octave_value_list fft_result_vector;
octave_value_list ifft_result_vector;
octave_value_list real_result_vector;
octave_function *fcn1 = args(0).function_value (); // supply Octave "fft"
function
octave_function *fcn2 = args(1).function_value (); // supply Octave "ifft"
function
octave_function *fcn3 = args(2).function_value (); // supply Octave "real"
function
ColumnVector input_vector = args(3).column_vector_value ();
ColumnVector output_vector = args(3).column_vector_value ();
OCTAVE_LOCAL_BUFFER( double , rolling_vector , 32 );
for (octave_idx_type ii (31); ii<input_vector.length (); ii++)
{
for (octave_idx_type jj (0); jj<(32); jj++)
{
rolling_vector(jj) = input_vector(ii - (ii - jj));
}
// detrend rolling vector code here
fft_result_vector = feval( fcn1 , rolling_vector );
// fft_result_vector frequency filter code here
ifft_result_vector = feval( fcn2 , fft_result_vector );
real_result_vector = feval( fcn3 , ifft_result_vector );
// real_result_vector retrend code here
output_vector(ii) = real_result_vector(31);
}
retval = output_vector;
return retval;
}
but it fails on compile with
octave:1> mkoctfile rollingfft.cc
rollingfft.cc: In function ‘octave_value_list Frollingfft(const
octave_value_list&, int)’:
rollingfft.cc:27: error: call of overloaded ‘feval(octave_function*&,
double*&)’ is ambiguous
/usr/include/octave-3.0.1/octave/parse.h:123: note: candidates are:
octave_value_list feval(octave_function*, const octave_value_list&, int)
<near match>
/usr/include/octave-3.0.1/octave/parse.h:126: note:
octave_value_list feval(const octave_value_list&, int) <near match>
rollingfft.cc:36: error: cannot convert ‘octave_value’ to ‘double’ in
assignment
rollingfft.cc:40: error: no match for ‘operator=’ in ‘retval =
output_vector’
/usr/include/octave-3.0.1/octave/oct-obj.h:75: note: candidates are:
octave_value_list& octave_value_list::operator=(const octave_value_list&)
What I am attempting to do is to smooth a time series by moving a window
across the series, and using fft to lowpass filter in the frequency domain.
--
View this message in context:
http://www.nabble.com/How-do-you-pass-two-Octave-functions-to-an-.oct-function--tp25870717p25908820.html
Sent from the Octave - General mailing list archive at Nabble.com.
- How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/13
- Re: How do you pass two Octave functions to an .oct function?, Jaroslav Hajek, 2009/10/14
- Re: How do you pass two Octave functions to an .oct function?,
babelproofreader <=
- Re: How do you pass two Octave functions to an .oct function?, Jaroslav Hajek, 2009/10/16
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/16
- Re: How do you pass two Octave functions to an .oct function?, David Grundberg, 2009/10/18
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/20
- Re: How do you pass two Octave functions to an .oct function?, Jaroslav Hajek, 2009/10/20
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/21
- Re: How do you pass two Octave functions to an .oct function?, Jaroslav Hajek, 2009/10/22
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/25
- Re: How do you pass two Octave functions to an .oct function?, David Grundberg, 2009/10/25
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/26