coder.fftw.StandaloneFFTW3Interface - Abstract class for specifying an FFTW library for FFTW calls in generated

     code - MATLAB ([original](https://www.mathworks.com/help/coder/ref/coder.fftw.standalonefftw3interface-class.html)) ([raw](?raw))

Namespace: coder.fftw

Abstract class for specifying an FFTW library for FFTW calls in generated code

Description

coder.fftw.StandaloneFFTW3Interface is an abstract class for defining an FFT library callback class. An FFT library callback class specifies an FFT library to use for C/C++ code generated for MATLAB® fast Fourier transform functions. To define an FFT callback class for the FFTW library, version 3.2 or later, use the coder.fftw.StandaloneFFTW3Interface class. For example, to define an FFT library callback class with the name useMyFFTW, make this line the first line of your class definition file:

classdef useMyFFTW < coder.fftw.StandaloneFFTW3Interface

For information about the FFTW library, see www.fftw.org.

MATLAB fast Fourier transform functions include fft, fft2, fftn, ifft, ifft2, and ifftn. The code generator produces FFTW library calls for these functions when all of these conditions are true:

You must implement the updateBuildInfo andgetNumThreads methods.

Optionally, you can implement these methods:

All methods are static.

Examples

collapse all

Write an FFT Library Callback Class for an FFTW Library

Specify a specific installed FFTW library in an FFT library callback class.

Use this example FFT library callback class as a template.

% copyright 2017 The MathWorks, Inc.

classdef useMyFFTW < coder.fftw.StandaloneFFTW3Interface

methods (Static)
    function th = getNumThreads
        coder.inline('always');
        th = int32(coder.const(1));
    end
            
    function updateBuildInfo(buildInfo, ctx)
        fftwLocation = '/usr/lib/fftw';
        includePath = fullfile(fftwLocation, 'include');
        buildInfo.addIncludePaths(includePath);
        libPath = fullfile(fftwLocation, 'lib');
        
        %Double
        libName1 = 'libfftw3-3';
        [~, libExt] = ctx.getStdLibInfo();
        libName1 = [libName1 libExt];
        addLinkObjects(buildInfo, libName1, libPath, 1000, true, true);
        
        %Single
         libName2 = 'libfftw3f-3';
        [~, libExt] = ctx.getStdLibInfo();
        libName2 = [libName2 libExt];
        addLinkObjects(buildInfo, libName2, libPath, 1000, true, true);
    end
end           

end

Modify the template.

Version History

Introduced in R2017b

See Also

Topics