#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. | |
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 SIGN | ( | a, | |||
| b | ) | ((b) >= 0.0 ? fabs(a) : -fabs(a)) |
Definition at line 71 of file linmin.cpp.
| 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
variables, i.e. given as input the vectors
and
and the function
, the function finds the scalar
that minimizes
.
is replaced by
and
by
.
| 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. |
| 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 |
Definition at line 115 of file linmin.cpp.
References SIGN.