You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: inufft.m
    path of file: ./repos/chebfun/@chebfun
    
    the code of the file until where you have to start completion: function [c, p] = inufft( f, x, type, tol)
%CHEBFUN.INUFFT   Inverse nonuniform fast Fourier transform
%   [C, P]= CHEBFUN.INUFFT(F) is the same as ifft( F ). F must be a column
%   vector. C = P(F) is a planned version of the fast transform.
%
%   C = CHEBFUN.INUFFT(F, X) is an inverse nonuniform fast Fourier transform
%   of type 2, which computes C = A\F, where
%        A_{jk} = exp(-2*pi*1i*X(j)*k), 0<=j,K<=N-1.
%   F and X must be column vectors of the same length.
%
%   C = CHEBFUN.INUFFT(F, X, 2) is the same as CHEBFUN.INUFFT(F, X).
%
%   C = CHEBFUN.INUFFT(F, OMEGA, 1) is an inverse nonuniform fast Fourier
%   transform of type 1, which computes C=A\F, where

    
function [c, p] = inufft( f, x, type, tol)
%CHEBFUN.INUFFT   Inverse nonuniform fast Fourier transform
%   [C, P]= CHEBFUN.INUFFT(F) is the same as ifft( F ). F must be a column
%   vector. C = P(F) is a planned version of the fast transform.
%
%   C = CHEBFUN.INUFFT(F, X) is an inverse nonuniform fast Fourier transform
%   of type 2, which computes C = A\F, where
%        A_{jk} = exp(-2*pi*1i*X(j)*k), 0<=j,K<=N-1.
%   F and X must be column vectors of the same length.
%
%   C = CHEBFUN.INUFFT(F, X, 2) is the same as CHEBFUN.INUFFT(F, X).
%
%   C = CHEBFUN.INUFFT(F, OMEGA, 1) is an inverse nonuniform fast Fourier
%   transform of type 1, which computes C=A\F, where
%        A_{jk} = exp(-2*pi*1i*j/N*OMEGA(k)), 0<=j,K<=N-1.
%
%   C = CHEBFUN.INUFFT(F, X, 1, TOL), C = CHEBFUN.INUFFT(F, OMEGA, 2, TOL),
%   and C = CHEBFUN.INUFFT(F, X, OMEGA, TOL) are the same as above but with
%   a tolerance of TOL. By default, TOL = eps.
%
%   The algorithm in this MATLAB script is based on the paper:
%    [1] D. Ruiz-Antoln and A. Townsend