summaryrefslogtreecommitdiff
path: root/numlib/varmet.h
blob: 5f24445e1dba73558afb9140837384b224501082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef VARMET_H
#define VARMET_H

/* Variable Metric multivariate minimiser */

/*
 * Copyright 2000, 2007 Graeme W. Gill
 * All rights reserved.
 *
 * This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
 * see the License.txt file for licencing details.
 */

#ifdef __cplusplus
	extern "C" {
#endif

/* Variable Metric Gradient optimiser */
/* return 0 on sucess, 1 on failure due to excessive itterations */
/* Result will be in cp */
int varmet(
double *rv,				/* If not NULL, return the residual error */
int di,					/* Dimentionality */
double cp[],			/* Initial starting point */
double s[],				/* Size of initial search area */
double ftol,			/* Tollerance of error change to stop on */
int maxit,				/* Maximum iterations allowed */
double (*func)(void *fdata, double tp[]),		/* Error function to evaluate */
double (*dfunc)(void *fdata, double dp[], double tp[]),		/* Gradient function to evaluate */
void *fdata				/* Opaque data needed by function */
);

/* Example user function declarations */
double varmet_funk(		/* Return function value */
	void *fdata,		/* Opaque data pointer */
	double tp[]);		/* Multivriate input value */

/* Line in multi-dimensional space minimiser */
double brentnd(			/* vector multiplier return value */
double ax,				/* Minimum of multiplier range */
double bx,				/* Starting point multiplier of search */
double cx,				/* Maximum of multiplier range */
double ftol,			/* Tollerance to stop search */
double *xmin,			/* Return value of multiplier at minimum */		
int n,					/* Dimensionality */
double (*func)(void *fdata, double tp[]),		/* Error function to evaluate */
void *fdata,			/* Opaque data */
double pcom[],			/* Base vector point */
double xicom[]);		/* Vector that will be multiplied and added to pcom[] */

#ifdef __cplusplus
	}
#endif

#endif /* VARMET_H */