function y = a9_f1(x)
  y = (1:length(x))'.*x(end:-1:1); 
end

function y = a9_f2(x)
  y = x*x'*(1:length(x))';
end  
  
function y = a9_f3(x)
  n = length(x); y = []; 
  m = floor(n/2);
  for l=1:m, y = [y;x(l) - l*x(2*l)]; end
end

function y = a9_f4(x)
  n = length(x);
  y = (diag(x)+ones(n,1)*ones(1,n))*(n:-1:1)';
end
  
function y = a9_f5(x)
   n = length(x); 
   a = 2.^(0:n-1); a = [a,a,a];
   for l=1:n
     y(l) = 0;
     for k=1:n, y(l) = y(l) + x(k)*a(n-l+k); end
   end
end   
   
function y = a9_f6(x)
  n =length(x); 
  y = (1:n)*sparse([(1:n-1)';(1:n)';(2:n)'],...
                   [(2:n)';(1:n)';(1:n-1)'],...
                   [x(1:n-1);x;x(2:n)],n,n);
end
   