Code covered by the BSD License  

Highlights from
slatec

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

[ido,l1,cc,ch,wa1]=passf2(ido,l1,cc,ch,wa1);
function [ido,l1,cc,ch,wa1]=passf2(ido,l1,cc,ch,wa1);
persistent i k ti2 tr2 ; 

if isempty(ti2), ti2=0; end;
if isempty(tr2), tr2=0; end;
if isempty(i), i=0; end;
if isempty(k), k=0; end;
%***BEGIN PROLOGUE  PASSF2
%***SUBSIDIARY
%***PURPOSE  Calculate the fast Fourier transform of subvectors of
%            length two.
%***LIBRARY   SLATEC (FFTPACK)
%***TYPE      SINGLE PRECISION (PASSF2-S)
%***AUTHOR  Swarztrauber, P. N., (NCAR)
%***ROUTINES CALLED  (NONE)
%***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 (*).
%   881128  Modified by Dick Valent to meet prologue standards.
%   890831  Modified array declarations.  (WRB)
%   891214  Prologue converted to Version 4.0 format.  (BAB)
%   900402  Added TYPE section.  (WRB)
%***end PROLOGUE  PASSF2
cc_shape=size(cc);cc=reshape([cc(:).',zeros(1,ceil(numel(cc)./prod([ido,2])).*prod([ido,2])-numel(cc))],ido,2,[]);
ch_orig=ch;ch_shape=[ido,l1,2];ch=reshape([ch_orig(1:min(prod(ch_shape),numel(ch_orig))),zeros(1,max(0,prod(ch_shape)-numel(ch_orig)))],ch_shape);
wa1_shape=size(wa1);wa1=reshape(wa1,1,[]);
%***FIRST EXECUTABLE STATEMENT  PASSF2
if( ido<=2 )
for k = 1 : l1;
ch(1,k,1) = cc(1,1,k) + cc(1,2,k);
ch(1,k,2) = cc(1,1,k) - cc(1,2,k);
ch(2,k,1) = cc(2,1,k) + cc(2,2,k);
ch(2,k,2) = cc(2,1,k) - cc(2,2,k);
end; k = fix(l1+1);
cc_shape=zeros(cc_shape);cc_shape(:)=cc(1:numel(cc_shape));cc=cc_shape;
ch_orig(1:prod(ch_shape))=ch;ch=ch_orig;
wa1_shape=zeros(wa1_shape);wa1_shape(:)=wa1(1:numel(wa1_shape));wa1=wa1_shape;
return;
elseif( fix(ido./2)<l1 ) ;
for i = 2 : 2: ido ;
%DIR$ IVDEP
for k = 1 : l1;
ch(i-1,k,1) = cc(i-1,1,k) + cc(i-1,2,k);
tr2 = cc(i-1,1,k) - cc(i-1,2,k);
ch(i,k,1) = cc(i,1,k) + cc(i,2,k);
ti2 = cc(i,1,k) - cc(i,2,k);
ch(i,k,2) = wa1(i-1).*ti2 - wa1(i).*tr2;
ch(i-1,k,2) = wa1(i-1).*tr2 + wa1(i).*ti2;
end; k = fix(l1+1);
end; i = fix(ido +1);
else;
for k = 1 : l1;
%DIR$ IVDEP
for i = 2 : 2: ido ;
ch(i-1,k,1) = cc(i-1,1,k) + cc(i-1,2,k);
tr2 = cc(i-1,1,k) - cc(i-1,2,k);
ch(i,k,1) = cc(i,1,k) + cc(i,2,k);
ti2 = cc(i,1,k) - cc(i,2,k);
ch(i,k,2) = wa1(i-1).*ti2 - wa1(i).*tr2;
ch(i-1,k,2) = wa1(i-1).*tr2 + wa1(i).*ti2;
end; i = fix(ido +1);
end; k = fix(l1+1);
cc_shape=zeros(cc_shape);cc_shape(:)=cc(1:numel(cc_shape));cc=cc_shape;
ch_orig(1:prod(ch_shape))=ch;ch=ch_orig;
wa1_shape=zeros(wa1_shape);wa1_shape(:)=wa1(1:numel(wa1_shape));wa1=wa1_shape;
return;
end;
cc_shape=zeros(cc_shape);cc_shape(:)=cc(1:numel(cc_shape));cc=cc_shape;
ch_orig(1:prod(ch_shape))=ch;ch=ch_orig;
wa1_shape=zeros(wa1_shape);wa1_shape(:)=wa1(1:numel(wa1_shape));wa1=wa1_shape;
end
%DECK PASSF3

Contact us