function enorm = GetEnorm(q, weight_decay)
%% compute l1 and l2 norm error of construction with params = q

%%
weights         = ((q.w~=0)./(abs(q.w))).^weight_decay';
weights(q.w==0) = 1;
% --- initialise L1 and L2 errors ---
enorm.L2 = zeros(q.N/4-1,1);
enorm.L1 = zeros(q.N/4-1,1);
% --- keep track of all approximations and errors? ---
Approx   = zeros(q.len_w, q.N/4-1);
Err      = zeros(q.len_w, q.N/4-1);

for n1 = 1:q.N/4-1
    x_try = zeros(q.N,1);
    x_try(  q.N/4 - n1) = 1;
    x_try(  q.N/4 + n1) = 1;
    x_try(3*q.N/4 - n1) = 1;
    x_try(3*q.N/4 + n1) = 1;

    approx = q.N/pi * q.Wp * x_try .* pi/4 ./ sin(2*pi.*n1/q.N);
    Approx(:,n1) = approx;

    err = q.exact - approx;     
    Err(:,n1) = err;
        
    err = weights.*err;                   
    enorm.L1(n1) = sum(abs(err).^1);         
    enorm.L2(n1) = sqrt(sum(abs(err).^2));   
end