主要内容

coder.fftw.StandaloneFFTW3Interface.getPlanMethod

类: coder.fftw.StandaloneFFTW3Interface
命名空间: coder.fftw

返回 FFTW 规划方法

语法

coder.fftw.StandaloneFFTW3Interface.getPlanMethod()

说明

coder.fftw.StandaloneFFTW3Interface.getPlanMethod() 返回生成的独立代码中的 FFTW 库调用的 FFTW 规划方法。

当您定义从 coder.fftw.StandaloneFFTW3Interface 类派生的 FFTW 库回调类时,您不必实现 getPlanMethod 方法。默认情况下,规划方法为 FFTW_ESTIMATE。要使用不同方法,请实现 getPlanMethod 方法。指定在 FFTW 网站的规划部分中所述的规划方法之一。

示例

全部展开

在从 coder.fftw.StandaloneFFTW3Interface 派生的 FFTW 库回调类中的 getPlanMethod 方法中指定 FFTW_MEASURE 规划方法。

% 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

版本历史记录

在 R2017b 中推出