Cubic line search algorithm for finding a minimum value of a function. More...
|void||cblnsrch (Array< double > &xold, double fold, Array< double > &g, Array< double > &p, Array< double > &x, double &f, double(*func)(const Array< double > &), double lambda)|
|Does a cubic line search, i.e. given a nonlinear function, a starting point and a direction, a new point is calculated where the function has decreased "sufficiently". |
Cubic line search algorithm for finding a minimum value of a function.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Definition in file cblnsrch.cpp.
|void cblnsrch||(||Array< double > &||xold,|
|Array< double > &||g,|
|Array< double > &||p,|
|Array< double > &||x,|
|double(*)(const Array< double > &)||func,|
Does a cubic line search, i.e. given a nonlinear function, a starting point and a direction, a new point is calculated where the function has decreased "sufficiently".
Does a cubic line search, i.e.
The line search algorithms are based on the Newton method of approximating root values of monotone decreasing functions. When the derivative of the function at a starting point on the X-axis can be calculated, the intersection of the tangent at point (with gradient ) with the X-axis can be used to get a better approximation of the minima at .
This function is based on this idea: Given a nonlinear function , a n-dimensional starting point and a direction (known as Newton direction), a new point is calculated as
in a way that has decreased sufficiently. Sufficiently means that
where is a fraction of the initial rate of decrease .
This function can be used for minimization or solving a set of nonlinear equations of the form . Finding the root value (the x-value at which the related function will intersect the X-axis) will then solve the equations. In contrast to line search (lnsrch.cpp) the cubic line search interpolates four points to find the minimum value and is useful, when gradient information is already available or when more than three function evaluations have been calculated.
|xold||n-dimensional starting point.|
|fold||The value of function func at point xold.|
|g||The n-dimensional gradient of function func at point xold.|
|p||n-dimensional point to specify the search direction (the Newton direction).|
|x||New n-dimensional point along the direction p from xold where the function func decreases "sufficiently".|
|f||The new function value for point x.|
|func||Function to decrease.|
|lambda||Controls the accuracy of line search, is a good choice.|
Please follow the link to view the source code of the example. The example can be executed in the example directory of package LinAlg.