
function test_dctII
% Here we create the familiar DCT type II transformation
% matrix by just using the SEO and GDFT

% ------- test_dctII.m -------------------------------------
% Marios Athineos, marios@ee.columbia.edu
% http://www.ee.columbia.edu/~marios/
% Copyright (c) 2004-2005 by Columbia University.
% All rights reserved.
% ----------------------------------------------------------

% Test matrix for a sequence of length N
N = 6;

% Assume that our initial signal is length N symmetrized
% to length 2*N and generate the appropriate SEO
% (page 1043 in Mart94]
E  = seo(N,'HSHS');         % Dim 12x6

% Now the right GDFT is (for length 12)
G  = gdft(eye(2*N),0,1/2);   % Dim 12x12

% The DCT type II is the first half of the product
D1 = G*E;                   % Dim 12x6
D1 = D1(1:N,:);             % Dim 6x6
D1 = full(D1);              % SEO is sparse so make it full

% Now the DCT type II can also be generated using Matlab's
% internal function
D2 = dct(eye(N));           % Dim 6x6

% Notice the difference on the first row.  The normalizing
% factor on D2 makes it orthogonal.  D1 isn't orthogonal and
% this is explained in Mart94 page 1050.  The rest are the same
