linmin.cpp File Reference

Used to minimize functions of "N"-dimensional variables. More...

#include <cmath>
#include <SharkDefs.h>
#include <LinAlg/arrayoptimize.h>

Go to the source code of this file.

Defines

#define SIGN(a, b)   ((b) >= 0.0 ? fabs(a) : -fabs(a))

Functions

void linmin (Array< double > &p, const Array< double > &xi, double &fret, double(*func)(const Array< double > &))
 Minimizes a function of "N" variables.


Detailed Description

Used to minimize functions of "N"-dimensional variables.

Author:
M. Kreutz
Date:
1998
Copyright (c) 1998-2000:
Institut für Neuroinformatik
Ruhr-Universität Bochum
D-44780 Bochum, Germany
Phone: +49-234-32-25558
Fax: +49-234-32-14209
eMail: Shark-admin@neuroinformatik.ruhr-uni-bochum.de
www: http://www.neuroinformatik.ruhr-uni-bochum.de



This file is part of Shark. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

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 linmin.cpp.


Define Documentation

#define SIGN ( a,
 )     ((b) >= 0.0 ? fabs(a) : -fabs(a))

Definition at line 71 of file linmin.cpp.


Function Documentation

void linmin ( Array< double > &  p,
const Array< double > &  xi,
double &  fret,
double(*)(const Array< double > &)  func 
)

Minimizes a function of "N" variables.

Performs a minimization of a function of $ N $ variables, i.e. given as input the vectors $ P $ and $ n $ and the function $ f $, the function finds the scalar $ \lambda $ that minimizes $ f(P + \lambda n) $. $ P $ is replaced by $ P + \lambda n $ and $ n $ by $ \lambda n $.

Parameters:
p N-dimensional initial starting point for the search, is set to the point where the function takes on a minimum.
xi N-dimensional search direction, is replaced by the actual vector displacement that p was moved.
fret The function value at the new point p.
func The function that will be minimized.
Returns:
none.
Exceptions:
SharkException the type of the exception will be "size mismatch" and indicates that p is not one-dimensional or that p has not the same size than xi
Please follow the link to view the source code of the example. The example can be executed in the example directory of package LinAlg.

Author:
M. Kreutz
Date:
1998
Changes
none
Status
stable
See also:
dlinmin.cpp
Examples:
linmin_test.cpp.

Definition at line 115 of file linmin.cpp.

References SIGN.