# TaoSetLineSearch

Set the line search routine for algorithms that require one.

## Synopsis

    #include "tao_solver.h"
    int TaoSetLineSearch(TAO_SOLVER tao,
                        int (*setup)(TAO_SOLVER,void*),
                        int (*options)(TAO_SOLVER,void*),
                        int (*line)(TAO_SOLVER,TaoVec*,TaoVec*,TaoVec*,TaoVec*,
                                  double*,double*,int*,void*),
                        int (*viewit)(TAO_SOLVER,void*),
                        int (*destroy)(TAO_SOLVER,void*),
                        void *ctx)

Collective on TAO_SOLVER

## Input Parameter

| tao | - the TAO_SOLVER solver context
| setup | - setup routine (or TAO_NULL)
| options | - set line search options (or TAO_NULL)
| line | - the line search routine
| viewit | - routine that views the linesearch (or TAO_NULL)
| destroy | - destroys the user defined routine when the solver is destroyed (or TAO_NULL)
| ctx | - linesearch structure (or TAO_NULL)

## Calling sequence of line

        line(TAO_SOLVER tao, TaoVec* X, TaoVec* G, TaoVec* DX, TaoVec* Work, double *f,double *step, int *flag, void *ctx)

## Input Parameter for line search

| tao | - the TAO_SOLVER solver context
| xx | - current solution
| gg | - current gradient
| dxdx | - step direction
| Work | - work vector
| f | - function value
| step | - initial stepsize
| ctx | - user-defined line search context

## Output Parameter for line search

| X | - new solution
| G | - new gradient
| f | - new function value
| step | - multiple of DX added to the previous solution
| flag | - indicator of success or failure (flag=0 is a success, flag=7 means DX is not a descent direction)

## Notes

The input parameter gdx should be negative and is used to test the Armijo condition.

To ensure descent in a projected line search, the input parameter gdx should be the inner product of the gradient and the first linear manifold being searched.

## Keywords

TAO_SOLVER, destroy

## See Also

TaoLineSearchApply()

Level:advanced
Location:src/interface/line.c
TAO Solver Index
Table of Contents