function rs_example
% (15, 9) reed-solomon
%input
m = 4; % Number of bits per symbol
n = 2^m-1; k = 9; % Word lengths for code
msg = gf([10 4 8 3 1 12 5 15 2],m); % Two rows of m-bit symbols
code = rsenc(msg,n,k);
err = gf([0 15 0 2 0 1 0 0 0 0 0 0 0 0 0], m);
rcv = code + err;
%decoding:

% why alpha = 2H
% convenient for programming
% remember in most of the textbooks, 1 is 2^{n-1}

% define 0, 1, alpha and alpha powers in GF
zero = gf(0, m);
one = gf(1, m);
alpha = gf(2, m);

% alpha table
% 0, 1, 2, ..., n-1
alpha_tbl = [];
for i = 1:n-1
    alpha_tbl = [alpha_tbl alpha^i];
end
%step1: get syndromes:
%for 

dec = rsdec(rcv, n, k) 