x = rand(2,1); cof = 1e2;
tic, [j1_m,grad_m] = rosenbrock(x,cof); toc
% C-routine must be precompiled before use: mex -O rosenbrock_c.c 
tic, [j1_c,grad_c] = rosenbrock_c(x,cof); toc
norm(j1_m-j1_c), norm(grad_m-grad_c)
