function [y_even, y_odd] = nMatMV(v)
% by Paolo Bientinesi
    
n = length(v);
if mod(n, 2) == 0,
    fprintf('Error: size(v) is even')
    return
else
    m = (n+1)/2;
end

if n == 1
    y_even = v;
    y_odd  = v;
else
    y_TL =  [n-1:-2:2]' .* v(1:m-1);
    y_TM =  [0 [n-2:-2:3]]' .* v(m);
    y_TR = -[n-1:-2:2]' .* v(end:-1:m+1);

    y_Mid  = [0 [n-2:-2:3] 1 [3:2:n-2] 0] * v;      

    y_BL = -flip(y_TL);
    y_BM =  flip(y_TM);
    y_BR = -flip(y_TR);
    
        
    y_even = [ y_TL + y_TM + y_TR;
                      y_Mid      ;
               y_BL + y_BM + y_BR];
    
    y_odd = y_even;
    
    y_odd(1) = y_odd(1) + n * v(m);
    y_odd(n) = y_odd(n) + n * v(m);                          
    y_odd(m) = [n y_odd(m) n] * [  v(1)  ;     ... 
                                     1   ;     ...   
                                  v(end) ];    
end

end
