Calculation of DST_IV using DST_II (alternative)

Contents

Definitions

Result of transform is y=x*T, where y, x are row-vectors T is transform matrix

DST_IV matrix definition

N=8;
DST4=sin(pi/N*[(0:N-1)+1/2]'*[(0:N-1)+1/2])
DST4 =
    0.0980    0.2903    0.4714    0.6344    0.7730    0.8819    0.9569    0.9952
    0.2903    0.7730    0.9952    0.8819    0.4714   -0.0980   -0.6344   -0.9569
    0.4714    0.9952    0.6344   -0.2903   -0.9569   -0.7730    0.0980    0.8819
    0.6344    0.8819   -0.2903   -0.9952   -0.0980    0.9569    0.4714   -0.7730
    0.7730    0.4714   -0.9569   -0.0980    0.9952   -0.2903   -0.8819    0.6344
    0.8819   -0.0980   -0.7730    0.9569   -0.2903   -0.6344    0.9952   -0.4714
    0.9569   -0.6344    0.0980    0.4714   -0.8819    0.9952   -0.7730    0.2903
    0.9952   -0.9569    0.8819   -0.7730    0.6344   -0.4714    0.2903   -0.0980

DST_II matrix definition

DST2=sin(pi/N*((0:N-1)+1)'*((0:N-1)+1/2))
DST2 =
    0.1951    0.5556    0.8315    0.9808    0.9808    0.8315    0.5556    0.1951
    0.3827    0.9239    0.9239    0.3827   -0.3827   -0.9239   -0.9239   -0.3827
    0.5556    0.9808    0.1951   -0.8315   -0.8315    0.1951    0.9808    0.5556
    0.7071    0.7071   -0.7071   -0.7071    0.7071    0.7071   -0.7071   -0.7071
    0.8315    0.1951   -0.9808    0.5556    0.5556   -0.9808    0.1951    0.8315
    0.9239   -0.3827   -0.3827    0.9239   -0.9239    0.3827    0.3827   -0.9239
    0.9808   -0.8315    0.5556   -0.1951   -0.1951    0.5556   -0.8315    0.9808
    1.0000   -1.0000    1.0000   -1.0000    1.0000   -1.0000    1.0000   -1.0000

Finding relations

We will base our derivation on already existing alternative relations between DST_IV and DST_III transforms

where

Applying relation between DST_III and DST_II matrix

we will get

B=diag(ones(1,N))+diag(ones(1,N-1),1);
B(1,1)=2; B=B/2;
D=diag(cos(pi/2/N*([0:N-1]+1/2)));
% K=diag((-1).^(0:N-1));
J=rot90(eye(N));

Check expression of DST_II through DST_IV

Check DSTII matrix

J*B'*J*DST4*inv(D)
ans =
    0.1951    0.5556    0.8315    0.9808    0.9808    0.8315    0.5556    0.1951
    0.3827    0.9239    0.9239    0.3827   -0.3827   -0.9239   -0.9239   -0.3827
    0.5556    0.9808    0.1951   -0.8315   -0.8315    0.1951    0.9808    0.5556
    0.7071    0.7071   -0.7071   -0.7071    0.7071    0.7071   -0.7071   -0.7071
    0.8315    0.1951   -0.9808    0.5556    0.5556   -0.9808    0.1951    0.8315
    0.9239   -0.3827   -0.3827    0.9239   -0.9239    0.3827    0.3827   -0.9239
    0.9808   -0.8315    0.5556   -0.1951   -0.1951    0.5556   -0.8315    0.9808
    1.0000   -1.0000    1.0000   -1.0000    1.0000   -1.0000    1.0000   -1.0000

Check computation of DSTII transform

x=randn(1,N)
y=x*DST2                 % true result
y1=x*J*B'*J*DST4*inv(D)  % compute DSTII using DSTIV transform
x =
   -1.6041    0.2573   -1.0565    1.4151   -0.8051    0.5287    0.2193   -0.9219
y =
   -0.6885   -0.3088   -2.5156   -0.6767   -1.6931    1.2588   -4.2247   -2.0199
y1 =
   -0.6885   -0.3088   -2.5156   -0.6767   -1.6931    1.2588   -4.2247   -2.0199

Check expression of DST_IV through DST_II

J*inv(B')*J*DST2*D
ans =
    0.0980    0.2903    0.4714    0.6344    0.7730    0.8819    0.9569    0.9952
    0.2903    0.7730    0.9952    0.8819    0.4714   -0.0980   -0.6344   -0.9569
    0.4714    0.9952    0.6344   -0.2903   -0.9569   -0.7730    0.0980    0.8819
    0.6344    0.8819   -0.2903   -0.9952   -0.0980    0.9569    0.4714   -0.7730
    0.7730    0.4714   -0.9569   -0.0980    0.9952   -0.2903   -0.8819    0.6344
    0.8819   -0.0980   -0.7730    0.9569   -0.2903   -0.6344    0.9952   -0.4714
    0.9569   -0.6344    0.0980    0.4714   -0.8819    0.9952   -0.7730    0.2903
    0.9952   -0.9569    0.8819   -0.7730    0.6344   -0.4714    0.2903   -0.0980

Check computation of DSTIV transform

y=x*DST4                 % true result
y1=x*J*inv(B')*J*DST2*D  % compute DSTIV using DSTII transform
y =
   -0.5464    0.2416   -2.0110   -0.4914   -1.9794    1.2821   -0.3356   -4.4742
y1 =
   -0.5464    0.2416   -2.0110   -0.4914   -1.9794    1.2821   -0.3356   -4.4742

Reference

[1] Markus Pueschel, Jose M.F. Moura. The Algebraic Approach to the Discrete Cosine and Sine Transforms and their Fast Algorithms SIAM Journal of Computing 2003, Vol. 32, No. 5, pp. 1280-1316.