% alg 3.1 p. 37 in nocedal/wright book
% not clear how to set c and rho
function alpha=backtracking_line_search(A,b,tau,sigma,xn,p)
    alpha = 1;
    c = 0.01;
    rho = 0.5;

    F1 = evalF(A,b,tau,sigma,xn + alpha*p);
    F2 = evalF(A,b,tau,sigma,xn);
    gradxn = gradF(A,b,tau,sigma,xn);

    while F1 > F2 + c*alpha*dot(gradxn,p)
        alpha = rho*alpha;
        F1 = evalF(A,b,tau,sigma,xn + alpha*p);
    end
end
