function [LP, codistr] = hFftnImpl(codistr, LP, fftSize, sym, isFFT)
% hFftnImpl: Implement an N-dimensional FFT for codistributor2dbc where N >=2

%   Copyright 2014 The MathWorks, Inc.

    % if the part of the matrix we're using is on the first worker, we do
    % the fftn locally there.  localSiz will be the dimensions of an empty
    % matrix on other workers.
    codistr = hGetNewForSize(codistr, fftSize);
    localSiz = hLocalSize(codistr);
    if isFFT
        LP = fftn(LP, localSiz);
    else
        LP = ifftn(LP, localSiz, sym);
    end
end