[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to use fft in c++

From: Kire Pudsje
Subject: Re: how to use fft in c++
Date: Fri, 9 Jun 2017 21:15:13 +0200

On Fri, Jun 9, 2017 at 8:19 PM, Progressive <address@hidden> wrote:
At first thank you!

What do you mean by "DEFUN is defining a function"?

Do I have to replace   DEFUN_DLD(testfft, args, nargout, "\testfft\n ")   to
something like   fft(testfft, args, nargout, "\testfft\n ")    ?

I want to call octave from a cpp-file. Matrices and so on work fine but
calling funtctions does not. Now I'm confused anyway..  DEFUN is not a
function I can call?

DEFUN_DLD is a macro that takes care of all the stuff to be able to call a function from octave. You can just use it to define a function and it will do all the necessary stuff without needing to think about it.
However as you just need to call it from C++ and not from octave, you do not need all the extras.
The example that has been given before, that I think is confusing you (sorry I am too lazy to look up the reference to the mail), was to show that when fft is called from octave and Ffft is called from C, they both give the same results. To check this (and this is the part that confuses you, I think), he needed to call this C function from octave, to get the results and compare them.

FYI from the manual:
Included by oct.h is a definition for the macro DEFUN_DLD which creates a dynamically loaded function. This macro takes four arguments:
  1. The function name as it will be seen in Octave,
  2. The list of arguments to the function of type octave_value_list,
  3. The number of output arguments, which can and often is omitted if not used, and
  4. The string to use for the help text of the function.
The return type of functions defined with DEFUN_DLD is always octave_value_list

reply via email to

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