1 |
/* |
2 |
* SLV: Ascend Nonlinear Solver |
3 |
* by Kirk Andre' Abbott |
4 |
* Created: 10/06/95 |
5 |
* Version: $Revision: 1.3 $ |
6 |
* Version control file: $RCSfile: rootfind.h,v $ |
7 |
* Date last modified: $Date: 1997/07/18 12:15:38 $ |
8 |
* Last modified by: $Author: mthomas $ |
9 |
* |
10 |
* This file is part of the SLV solver. |
11 |
* |
12 |
* Copyright (C) 1990 Karl Michael Westerberg |
13 |
* Copyright (C) 1993 Joseph Zaher |
14 |
* Copyright (C) 1994 Joseph Zaher, Benjamin Andrew Allan |
15 |
* |
16 |
* The SLV solver is free software; you can redistribute |
17 |
* it and/or modify it under the terms of the GNU General Public License as |
18 |
* published by the Free Software Foundation; either version 2 of the |
19 |
* License, or (at your option) any later version. |
20 |
* |
21 |
* The SLV solver is distributed in hope that it will be |
22 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
24 |
* General Public License for more details. |
25 |
* |
26 |
* You should have received a copy of the GNU General Public License along with |
27 |
* the program; if not, write to the Free Software Foundation, Inc., 675 |
28 |
* Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING. |
29 |
* COPYING is found in ../compiler. |
30 |
*/ |
31 |
#ifndef rootfind_already_included |
32 |
#define rootfind_already_included |
33 |
|
34 |
#ifndef STAND_ALONE |
35 |
/* requires #include "extfunc.h" |
36 |
* needed only for the definition of |
37 |
* ExtEvalFunc. This definition should probably |
38 |
* be moved to types.h. or compiler.h */ |
39 |
#else |
40 |
/* requires #include "codegen_support.h" */ |
41 |
#endif /* STAND_ALONE */ |
42 |
|
43 |
|
44 |
extern double zbrent(ExtEvalFunc *func, /* the evaluation function */ |
45 |
double *lowbound, /* low bound */ |
46 |
double *upbound, /* up bound */ |
47 |
int *mode, /* to pass to the eval func */ |
48 |
int *m, /* the relation index */ |
49 |
int *n, /* the variable index */ |
50 |
double *x, /* the x vector -- needed by eval func */ |
51 |
double *u, /* the u vector -- needed by eval func */ |
52 |
double *f, /* vector of residuals */ |
53 |
double *g, /* vector of gradients */ |
54 |
double *tolerance, /* accuracy of solution */ |
55 |
int *status); /* success or failure */ |
56 |
/*********************************************************************\ |
57 |
Using Brents method, find the root of a function known to lie |
58 |
between x1 and x2. The root, returned as zbrent, will be refined |
59 |
until its accuracy is tol. The result of status must be monitored |
60 |
to see if we were successful. A nonzero code means that the result |
61 |
returned is erroneous. n is the index into the x vector of the variable |
62 |
that is to be solved for. |
63 |
\*********************************************************************/ |
64 |
|
65 |
#endif /* rootfind_already_included */ |
66 |
|
67 |
|
68 |
|
69 |
|