summaryrefslogtreecommitdiff
path: root/numlib/zbrent.h
blob: 2f8aac4f287dce28647532d71390c21ee7c75711 (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
#ifndef ROOT_H
#define ROOT_H

/*
 * Copyright 2000 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

/* 1 dimentional root finding code */

/* Bracket search function */
/* return  0 on sucess */
/*        -1 on no range */
/*        -2 on too many itterations */
int zbrac(
double *x1,			/* Input and output bracket values */
double *x2,
double (*func)(void *fdata, double tp),	/* function to evaluate */
void *fdata);							/* Opaque data pointer */

/* Root finder */
/* return  0 on sucess */
/*        -1 on root not bracketed */
/*        -2 on too many itterations */
int zbrent(
double *rv,								/* Return value */
double x1,								/* Bracket to search */
double x2,								/* (Min, Max) */
double tol,								/* Desired tollerance */
double (*func)(void *fdata, double tp),	/* function to evaluate */
void *fdata);							/* Opaque data pointer */

#ifdef __cplusplus
	}
#endif

#endif /* ROOT_H */