Line minimization

From stats++ wiki
Jump to: navigation, search

stats++

In stats++, a line search is accomplished with the LineSearchMethod class:

class LineSearchMethod
{
 
public:
 
    LineSearchMethod();
    ~LineSearchMethod();
 
    std::tuple<int,
               Vector<double>,
               double> line_minimize(std::function<double(const Vector<double> &)> f,
                                     const Vector<double> &x,
                                     const Vector<double> &d);
 
};

In code, it functions as follows:

LineSearchMethod line_search;
 
int info;
Vector<double> x = ...;
double fx;
std::tie(info, x, fx) = line_search.line_minimize(f, df, x);

Example

IGNORE