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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/*
* Functions-of-one-variable module
* by Tom Epperly
* Version: $Revision: 1.8 $
* Version control file: $RCSfile: functype.h,v $
* Date last modified: $Date: 2001/01/31 22:23:58 $
* Last modified by: $Author: ballan $
*
* This file is part of the Ascend Language Interpreter.
*
* Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
*
* The Ascend Language Interpreter 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 of the
* License, or (at your option) any later version.
*
* The Ascend Language Interpreter is distributed in 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 program. If not, see <http://www.gnu.org/licenses/>.
*
* Revision notes:
*
* If CHRIS_FUNC defined, auxillary quantities to func structure.
* 2/96 baa Probably somebody should properly set these evaluation
* defined below based on math.h when possible.
* 10/96 moved safe_err definition into here.
*/
/** @file
* Functions-of-one-variable module types and data structures.
* <pre>
* When #including functype.h, make sure these files are #included first:
* #include "compiler.h"
* </pre>
*/
#ifndef ASC_FUNCTYPE_H
#define ASC_FUNCTYPE_H
#include <ascend/general/config.h>
/** @addtogroup compiler_rel Compiler Relations
@{
*/
/**
* Safe math error codes.
* If you add to this enum be sure to add to safe_error_to_stderr
*/
enum safe_err {
safe_problem = -1,
safe_ok = 0,
safe_div_by_zero = 1,
safe_complex_result = 2,
safe_overflow = 3,
safe_underflow = 4,
safe_range_error = 5
};
/** Function enumeration. */
enum Func_enum {
F_LOG10, F_LN, F_EXP,
F_SIN, F_COS, F_TAN,
F_ARCSIN, F_ARCCOS, F_ARCTAN,
F_SQR, F_SQRT,
#ifdef HAVE_ERF
F_ERF,
#endif
F_LNM, F_SINH, F_COSH, F_TANH,
F_ARCSINH, F_ARCCOSH, F_ARCTANH,
F_CUBE, F_CBRT, F_ABS, F_HOLD
};
/** Function data structure. */
struct Func {
CONST char *name; /**< ASCEND name of function. not symchar */
CONST char *cname; /**< C name of function. not symchar */
CONST char *yname; /**< YACAS Name of Function. not symchar */
CONST char *deriv1cname; /**< C name of first derivative. not symchar */
CONST char *deriv2cname; /**< C name of second derivative. not symchar */
enum Func_enum id; /**< identification of function */
double (*value)(double); /**< pointer to function evaluation */
double (*deriv)(double); /**< pointer to derivative evaluation */
double (*deriv2)(double); /**< pointer to a second derivative evaluation */
double (*safevalue)(double,enum safe_err *); /**< pointer to function evaluation */
double (*safederiv)(double,enum safe_err *); /**< pointer to derivative evaluation */
double (*safederiv2)(double,enum safe_err *); /**< pointer to a second derivative evaluation */
#ifdef CHRIS_FUNC
struct Interval (*ivalue)(); /**< interval evaluation of function */
void (*slope)(unsigned long,struct Interval *,struct Interval *,
struct Interval *); /**< pointer to slope evaluation routine */
struct Interval (*ideriv)(struct Interval);
/**< interval derivative evaluation routine */
double (*tmin)(double,double); /**< return the point where the func is a min */
double (*tmax)(double,double); /**< return the point where the func is a max */
double (*e)(double,double,double,double (*)(double)); /**< convex envelope */
double (*ed)(double,double,double,double (*)(double)); /**< convex envelope derivative */
double (*E)(double,double,double,double (*)(double)); /**< concave envelope */
double (*Ed)(double,double,double,double (*)(double)); /**< concave envelope derivative */
#endif
};
/* @} */
#endif /* ASC_FUNCTYPE_H */
|