%===============================================================================
% E. Boutillon, June 2024
% Projet ANR AI4CODE
% Lab-STICC UMR 6284
% Université Bretagne Sud
%==========================================================================
% Method to build a C4-sequence from seed vectors s.
% The size of the obtained constellation is q = 4*length(s).
% Input : vector s of number between [0, q].
%         c = 1 indicates a clock wise C4-sequence, 
%         c = -1 indicates an anti-clockwise C4-sequence. 
%==========================================================================
function x = build_C4(s, c)

q = 4*length(s);
E = sqrt(4*q)*exp(2*pi*1i*s/q);
m = [0 (1-c)/2 0 (1+c)/2];    % [0 0 0 1] if c = 1, [0 1 0 0] if c = -1. 
x = ifft( kron( exp(2*pi*s*1i/q), m));
