Code covered by the BSD License  

Highlights from
slatec

from slatec by Ben Barrowes
The slatec library converted into matlab functions.

[n,wsave]=cffti(n,wsave);
function [n,wsave]=cffti(n,wsave);
persistent iw1 iw2 ; 

if isempty(iw1), iw1=0; end;
if isempty(iw2), iw2=0; end;
%***BEGIN PROLOGUE  CFFTI
%***SUBSIDIARY
%***PURPOSE  Initialize a work array for CFFTF and CFFTB.
%***LIBRARY   SLATEC (FFTPACK)
%***CATEGORY  J1A2
%***TYPE      COMPLEX (RFFTI-S, CFFTI-C)
%***KEYWORDS  FFTPACK, FOURIER TRANSFORM
%***AUTHOR  Swarztrauber, P. N., (NCAR)
%***DESCRIPTION
%
%  ********************************************************************
%  *   NOTICE   NOTICE   NOTICE   NOTICE   NOTICE   NOTICE   NOTICE   *
%  ********************************************************************
%  *                                                                  *
%  *   This routine uses non-standard Fortran 77 constructs and will  *
%  *   be removed from the library at a future date.  You are         *
%  *   requested to use CFFTI1.                                       *
%  *                                                                  *
%  ********************************************************************
%
%  subroutine CFFTI initializes the array WSAVE which is used in
%  both CFFTF and CFFTB.  The prime factorization of N together with
%  a tabulation of the trigonometric functions are computed and
%  stored in WSAVE.
%
%  Input Parameter
%
%  N       the length of the sequence to be transformed
%
%  Output Parameter
%
%  WSAVE   a work array which must be dimensioned at least 4*N+15.
%          The same work array can be used for both CFFTF and CFFTB
%          as long as N remains unchanged.  Different WSAVE arrays
%          are required for different values of N.  The contents of
%          WSAVE must not be changed between calls of CFFTF or CFFTB.
%
%***REFERENCES  P. N. Swarztrauber, Vectorizing the FFTs, in Parallel
%                 Computations (G. Rodrigue, ed.), Academic Press,
%                 1982, pp. 51-83.
%***ROUTINES CALLED  CFFTI1
%***REVISION HISTORY  (YYMMDD)
%   790601  DATE WRITTEN
%   830401  Modified to use SLATEC library source file format.
%   860115  Modified by Ron Boisvert to adhere to Fortran 77 by
%           changing dummy array size declarations (1) to (*).
%   861211  REVISION DATE from Version 3.2
%   881128  Modified by Dick Valent to meet prologue standards.
%   891214  Prologue converted to Version 4.0 format.  (BAB)
%   900131  Routine changed from user-callable to subsidiary
%           because of non-standard Fortran 77 arguments in the
%           call to CFFTB1.  (WRB)
%   920501  Reformatted the REFERENCES section.  (WRB)
%***end PROLOGUE  CFFTI
wsave_shape=size(wsave);wsave=reshape(wsave,1,[]);
%***FIRST EXECUTABLE STATEMENT  CFFTI
if( n==1 )
wsave_shape=zeros(wsave_shape);wsave_shape(:)=wsave(1:numel(wsave_shape));wsave=wsave_shape;
return;
end;
iw1 = fix(n + n + 1);
iw2 = fix(iw1 + n + n);
[n,dumvar2,dumvar3]=cffti1(n,wsave(sub2ind(size(wsave),max(iw1,1)):end),wsave(sub2ind(size(wsave),max(iw2,1)):end));   dumvar2i=find((wsave(sub2ind(size(wsave),max(iw1,1)):end))~=(dumvar2));dumvar3i=find((wsave(sub2ind(size(wsave),max(iw2,1)):end))~=(dumvar3));   wsave(iw1-1+dumvar2i)=dumvar2(dumvar2i); wsave(iw2-1+dumvar3i)=dumvar3(dumvar3i); 
wsave_shape=zeros(wsave_shape);wsave_shape(:)=wsave(1:numel(wsave_shape));wsave=wsave_shape;
end
%DECK CFOD

Contact us at files@mathworks.com