<< Chapter < Page | Chapter >> Page > |
The following programs print the program statements that carry out the operation
and
.
They are modeled after
kpi
in the text.
function kpi(d,g,r,c,n,Y,X,fid)
% kpi(d,g,r,c,n,Y,X,fid);% Kronecker Product : A(d(1)) kron ... kron A(d(n))
% g : permutation of 1,...,n% r : [r(1),...,r(n)]
% c : [c(1),..,c(n)]% r(i) : rows of A(d(i))
% c(i) : columns of A(d(i))% n : number of terms
for i = 1:na = 1;
for k = 1:(g(i)-1)if i>find(g==k)
a = a * r(k);else
a = a * c(k);end
endb = 1;
for k = (g(i)+1):nif i>find(g==k)
b = b * r(k);else
b = b * c(k);end
end% Y = (I(a) kron A(d(g(i))) kron I(b)) * X;
if i == 1S1 = sprintf([Y,' = ID%dI(%d,%d,',X,'); '],d(g(i)),a,b);S2 = sprintf(['%% ',Y,' = (I(%d) kron D%d kron I(%d)) * ',X],a,d(g(i)),b);fprintf(fid,'%-35s%s\n',S1,S2);
elseif d(g(i)) ~= 1S1 = sprintf([Y,' = ID%dI(%d,%d,',Y,'); '],d(g(i)),a,b);S2 = sprintf(['%% ',Y,' = (I(%d) kron D%d kron I(%d)) * ',Y],a,d(g(i)),b);fprintf(fid,'%-35s%s\n',S1,S2);
endend
function kpit(d,g,r,c,n,Y,X,fid)
% kpit(g,r,c,n,Y,X,fid);% (transpose)
% Kronecker Product : A(d(1))' kron ... kron A(d(n))'% g : permutation of 1,...,n
% r : [r(1),...,r(n)]% c : [c(1),..,c(n)]
% r(i) : rows of A(d(i))'% c(i) : columns of A(d(i))'
% n : number of termsfor i = 1:n
a = 1;for k = 1:(g(i)-1)
if i>find(g==k)
a = a * r(k);else
a = a * c(k);end
endb = 1;
for k = (g(i)+1):nif i>find(g==k)
b = b * r(k);else
b = b * c(k);end
end% x = (I(a) kron A(d(g(i)))'' kron I(b)) * x;
if i == nS1 = sprintf([Y,' = ID%dtI(%d,%d,',X,'); '],d(g(i)),a,b);S2 = sprintf(['%% ',Y,' = (I(%d) kron D%d'' kron I(%d)) * ',X],a,d(g(i)),b);fprintf(fid,'%-35s%s\n',S1,S2);
elseif d(g(i)) ~= 1S1 = sprintf([X,' = ID%dtI(%d,%d,',X,'); '],d(g(i)),a,b);S2 = sprintf(['%% ',X,' = (I(%d) kron D%d'' kron I(%d)) * ',X],a,d(g(i)),b);fprintf(fid,'%-35s%s\n',S1,S2);
endend
The following programs carry out the operation of where is the reconstruction matrix in a linear convolution algorithm. See the appendix, `Bilinear Forms for Linear Convolution.'
function u = KFt(f,r,c,u)
% u = (F^t kron ... kron F^t)*u% (transpose)
% f = [f(1),...,f(K)]% r : r(i) = rows of F(i)
% c : c(i) = columns of F(i)% u : length(u) = prod(c);
K = length(f);for i = 1:K
m = prod(c(1:i-1));n = prod(r(i+1:K));
u = IFtI(f(i),r(i),c(i),m,n,u);end
function y = IFtI(s,r,c,m,n,x);
% y = (I(m) kron F(s)^t kron I(n))*x% (transpose)
% r : rows of F(s)% c : columns of F(s)
v = 0:n:n*(c-1);u = 0:n:n*(r-1);
for i = 0:m-1for j = 0:n-1
y(v+i*c*n+j+1) = Ftop(s,x(u+i*r*n+j+1));end
end
function y = Ftop(k,x)
if k == 1, y = x;elseif k == 2, y = F2t(x);
elseif k == 3, y = F3t(x);elseif k == 4, y = F4t(x);
elseif k == 6, y = F6t(x);elseif k == 8, y = F8t(x);
elseif k == 18, y = F18t(x);end
The following programs carry out the operation of were is given by Equation 13 and Equation 14 from Bilinear Forms for Circular Convolution .
Notification Switch
Would you like to follow the 'Automatic generation of prime length fft programs' conversation and receive update notifications?