Relations between DCTV and DSTVI

Definitions

Transform matrix is defined for operating on column-vectors y=T*x, where y, x are column-vectors, T is transform matrix

DCTV matrix definition

N1=9; N=N1;
k=0:N1-1;  l=0:N1-1;
DCT5=cos(pi/(N-1/2)*k'*l)       % display DCTV matrix

DCT5 =
Columns 1 through 7
1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000
1.0000    0.9325    0.7390    0.4457    0.0923   -0.2737   -0.6026
1.0000    0.7390    0.0923   -0.6026   -0.9830   -0.8502   -0.2737
1.0000    0.4457   -0.6026   -0.9830   -0.2737    0.7390    0.9325
1.0000    0.0923   -0.9830   -0.2737    0.9325    0.4457   -0.8502
1.0000   -0.2737   -0.8502    0.7390    0.4457   -0.9830    0.0923
1.0000   -0.6026   -0.2737    0.9325   -0.8502    0.0923    0.7390
1.0000   -0.8502    0.4457    0.0923   -0.6026    0.9325   -0.9830
1.0000   -0.9830    0.9325   -0.8502    0.7390   -0.6026    0.4457
Columns 8 through 9
1.0000    1.0000
-0.8502   -0.9830
0.4457    0.9325
0.0923   -0.8502
-0.6026    0.7390
0.9325   -0.6026
-0.9830    0.4457
0.7390   -0.2737
-0.2737    0.0923


DCTV in terms of Tschebyshev polynomials

The DCTV matrix can be expressed in terms of Tschebyshev polynomials [1]

where

are roots of polynomial

alpha=sort([roots(TschebyshevW(N-1)); 1],'descend');
DCT5t=zeros(N1);
for l=0:N1-1,
DCT5t(:,l+1)=polyval(TschebyshevT(l),alpha)';
end
Da5=diag(cos(0*pi/(N-1/2)*k));
DCT5t=Da5*DCT5t                    % display DCTV matrix

% compare DCT5 and DCT5t matrices (show that both definitions above are equivalent)
max(max(abs(DCT5-DCT5t)))

DCT5t =
Columns 1 through 7
1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000
1.0000    0.9325    0.7390    0.4457    0.0923   -0.2737   -0.6026
1.0000    0.7390    0.0923   -0.6026   -0.9830   -0.8502   -0.2737
1.0000    0.4457   -0.6026   -0.9830   -0.2737    0.7390    0.9325
1.0000    0.0923   -0.9830   -0.2737    0.9325    0.4457   -0.8502
1.0000   -0.2737   -0.8502    0.7390    0.4457   -0.9830    0.0923
1.0000   -0.6026   -0.2737    0.9325   -0.8502    0.0923    0.7390
1.0000   -0.8502    0.4457    0.0923   -0.6026    0.9325   -0.9830
1.0000   -0.9830    0.9325   -0.8502    0.7390   -0.6026    0.4457
Columns 8 through 9
1.0000    1.0000
-0.8502   -0.9830
0.4457    0.9325
0.0923   -0.8502
-0.6026    0.7390
0.9325   -0.6026
-0.9830    0.4457
0.7390   -0.2737
-0.2737    0.0923
ans =
2.5746e-13


DSTVI matrix definition

N2=8; N=N2;
k=0:N2-1;  l=0:N2-1;
DST6=sin(pi/(N+1/2)*(k+1)'*(l+1/2))       % display DCTV matrix

DST6 =
Columns 1 through 7
0.1837    0.5264    0.7980    0.9618    0.9957    0.8952    0.6737
0.3612    0.8952    0.9618    0.5264   -0.1837   -0.7980   -0.9957
0.5264    0.9957    0.3612   -0.6737   -0.9618   -0.1837    0.7980
0.6737    0.7980   -0.5264   -0.8952    0.3612    0.9618   -0.1837
0.7980    0.3612   -0.9957    0.1837    0.8952   -0.6737   -0.5264
0.8952   -0.1837   -0.6737    0.9957   -0.5264   -0.3612    0.9618
0.9618   -0.6737    0.1837    0.3612   -0.7980    0.9957   -0.8952
0.9957   -0.9618    0.8952   -0.7980    0.6737   -0.5264    0.3612
Column 8
0.3612
-0.6737
0.8952
-0.9957
0.9618
-0.7980
0.5264
-0.1837


DSTVI in terms of Tschebyshev polynomials

The DSTVI matrix can be expressed in terms of Tschebyshev polynomials [1]

where

are roots of polynomial

beta=sort([roots(TschebyshevW(N))],'descend');
DST6t=zeros(N);
for l=0:N2-1,
DST6t(:,l+1)=polyval(TschebyshevW(l),beta)';
end
Db6=diag(sin(1/2*pi/(N+1/2)*(k+1)));
DST6t=Db6*DST6t                    % display DCTV matrix

% compare DST6 and DST6t matrices (show that both definitions above are equivalent)
max(max(abs(DST6-DST6t)))

DST6t =
Columns 1 through 7
0.1837    0.5264    0.7980    0.9618    0.9957    0.8952    0.6737
0.3612    0.8952    0.9618    0.5264   -0.1837   -0.7980   -0.9957
0.5264    0.9957    0.3612   -0.6737   -0.9618   -0.1837    0.7980
0.6737    0.7980   -0.5264   -0.8952    0.3612    0.9618   -0.1837
0.7980    0.3612   -0.9957    0.1837    0.8952   -0.6737   -0.5264
0.8952   -0.1837   -0.6737    0.9957   -0.5264   -0.3612    0.9618
0.9618   -0.6737    0.1837    0.3612   -0.7980    0.9957   -0.8952
0.9957   -0.9618    0.8952   -0.7980    0.6737   -0.5264    0.3612
Column 8
0.3612
-0.6737
0.8952
-0.9957
0.9618
-0.7980
0.5264
-0.1837
ans =
2.3470e-13


Finding relations

Because there exist relation

and

we can express DCTV through DSTVI

where

B=toeplitz([0.5 zeros(1,N-1)]',[0.5        -0.5 zeros(1,N-length([0.5        -0.5]))]);
B(1,1)=1;
B=[B [0; B(1:end-1,end)]];
B=[ones(1,size(B,2)); B];


Check expression of DCTV through DSTVI

DCT5a=Da5*blkdiag(1,inv(Db6)*DST6)*B
% compare DCT5 and DCT5a matrices (show correctness of representation of DCTV through DSTVI)
max(max(abs(DCT5-DCT5a)))

DCT5a =
Columns 1 through 7
1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000
1.0000    0.9325    0.7390    0.4457    0.0923   -0.2737   -0.6026
1.0000    0.7390    0.0923   -0.6026   -0.9830   -0.8502   -0.2737
1.0000    0.4457   -0.6026   -0.9830   -0.2737    0.7390    0.9325
1.0000    0.0923   -0.9830   -0.2737    0.9325    0.4457   -0.8502
1.0000   -0.2737   -0.8502    0.7390    0.4457   -0.9830    0.0923
1.0000   -0.6026   -0.2737    0.9325   -0.8502    0.0923    0.7390
1.0000   -0.8502    0.4457    0.0923   -0.6026    0.9325   -0.9830
1.0000   -0.9830    0.9325   -0.8502    0.7390   -0.6026    0.4457
Columns 8 through 9
1.0000    1.0000
-0.8502   -0.9830
0.4457    0.9325
0.0923   -0.8502
-0.6026    0.7390
0.9325   -0.6026
-0.9830    0.4457
0.7390   -0.2737
-0.2737    0.0923
ans =
1.6653e-15


Check expression of DSTVI through DCTV

DST6a=blkdiag(1,Db6)*inv(Da5)*DCT5*inv(B);
DST6a=DST6a(2:end,2:end)
% compare DST6 and DST6a matrices (show correctness of representation of DSTVI through DCTV)
max(max(abs(DST6-DST6a)))

DST6a =
Columns 1 through 7
0.1837    0.5264    0.7980    0.9618    0.9957    0.8952    0.6737
0.3612    0.8952    0.9618    0.5264   -0.1837   -0.7980   -0.9957
0.5264    0.9957    0.3612   -0.6737   -0.9618   -0.1837    0.7980
0.6737    0.7980   -0.5264   -0.8952    0.3612    0.9618   -0.1837
0.7980    0.3612   -0.9957    0.1837    0.8952   -0.6737   -0.5264
0.8952   -0.1837   -0.6737    0.9957   -0.5264   -0.3612    0.9618
0.9618   -0.6737    0.1837    0.3612   -0.7980    0.9957   -0.8952
0.9957   -0.9618    0.8952   -0.7980    0.6737   -0.5264    0.3612
Column 8
0.3612
-0.6737
0.8952
-0.9957
0.9618
-0.7980
0.5264
-0.1837
ans =
3.1086e-15


Check computation of DCTV transform

x=randn(N1,1);
disp('x''=');disp(x');
y=DCT5*x;                      % true result
disp('y''=');disp(y');
y1=Da5*blkdiag(1,inv(Db6)*DST6)*B*x;            % compute DCTV using DSTVI transform
disp('y1''=');disp(y1');

x'=
Columns 1 through 7
-0.8095   -2.9443    1.4384    0.3252   -0.7549    1.3703   -1.7115
Columns 8 through 9
-0.1022   -0.2414
y'=
Columns 1 through 7
-3.4300   -1.4360   -3.2739   -3.4892   -1.3389   -2.7776    0.3708
Columns 8 through 9
5.7705    1.0085
y1'=
Columns 1 through 7
-3.4300   -1.4360   -3.2739   -3.4892   -1.3389   -2.7776    0.3708
Columns 8 through 9
5.7705    1.0085


Check computation of DSTVI transform

x=randn(N2,1);
disp('x''=');disp(x');
y=DST6*x;                      % true result
disp('y''=');disp(y');
y1=blkdiag(1,Db6)*inv(Da5)*DCT5*inv(B)*[0;x];            % compute DSTVI using DCTV transform
disp('y1''=');disp(y1');
% Reference

x'=
Columns 1 through 7
0.3192    0.3129   -0.8649   -0.0301   -0.1649    0.6277    1.0933
Column 8
1.1093
y'=
Columns 1 through 7
1.0392   -2.7589    2.0960    0.1857    1.1443    0.8074    0.2884
Column 8
-0.9837
y1'=
Columns 1 through 7
0.0000    1.0392   -2.7589    2.0960    0.1857    1.1443    0.8074
Columns 8 through 9
0.2884   -0.9837