% filename: armijo.m % author: Pascal F. Heiter % date: 16/05/2013 % last update: 15/10/2014 % description: calculate valid step size using Armijo's rule % parameters: f - function f % gradf - gradient of f % x - start point % d - search direction % s - initial step length % sigma - constant of Armijo rule % beta - constant of Armijo rule function t = armijo(f,gradf,x,d,s,sigma,beta) t = s; while ( f(x+t*d) > (f(x) + sigma*t*gradf(x)'*d) ) t = beta*t; end