Main Content

coder.fftw.StandaloneFFTW3Interface.getPlanMethod

Class: coder.fftw.StandaloneFFTW3Interface
Package: coder.fftw

Return FFTW planning method

Syntax

coder.fftw.StandaloneFFTW3Interface.getPlanMethod()

Description

coder.fftw.StandaloneFFTW3Interface.getPlanMethod() returns the FFTW planning method for FFTW library calls in generated standalone code.

When you define an FFTW library callback class that derives from a coder.fftw.StandaloneFFTW3Interface class, you do not have to implement a getPlanMethod method. By default, the planning method is FFTW_ESTIMATE. To use a different method, implement the getPlanMethod method. Specify one of the planning methods described in the planning section of the FFTW website.

Examples

expand all

Specify the FFTW_MEASURE planning method in a getPlanMethod method in an FFTW library callback class that derives from coder.fftw.StandaloneFFTW3Interface.

% 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 me = getPlanMethod
            coder.inline('always');
            me = coder.const(coder.opaque('int', 'FFTW_MEASURE'));
        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
Introduced in R2017b