1
|
1 // mappers.h -*- C++ -*- |
|
2 /* |
|
3 |
1884
|
4 Copyright (C) 1996 John W. Eaton |
1
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
21 |
|
22 */ |
|
23 |
383
|
24 #if !defined (octave_mappers_h) |
|
25 #define octave_mappers_h 1 |
1
|
26 |
1755
|
27 #include <string> |
|
28 |
1651
|
29 #include "oct-cmplx.h" |
1
|
30 |
529
|
31 typedef double (*d_d_Mapper)(double); |
|
32 typedef double (*d_c_Mapper)(const Complex&); |
|
33 typedef Complex (*c_c_Mapper)(const Complex&); |
|
34 |
|
35 // If can_return_complex_for_real_arg is 1, lower_limit and |
|
36 // upper_limit specify the range of values for which a real arg |
|
37 // returns a real value. Outside that range, we have to convert args |
|
38 // to complex, and call the complex valued function. |
|
39 // |
|
40 // If can_return_complex_for_real_arg is 0, lower_limit and |
|
41 // upper_limit are ignored. |
|
42 |
|
43 struct Mapper_fcn |
|
44 { |
1755
|
45 string name; |
529
|
46 int can_return_complex_for_real_arg; |
|
47 double lower_limit; |
|
48 double upper_limit; |
|
49 d_d_Mapper d_d_mapper; |
|
50 d_c_Mapper d_c_mapper; |
|
51 c_c_Mapper c_c_mapper; |
|
52 }; |
|
53 |
|
54 struct builtin_mapper_function |
|
55 { |
1755
|
56 builtin_mapper_function (const string n, int cfr, double l, double u, |
|
57 d_d_Mapper dd, d_c_Mapper dc, c_c_Mapper cc, |
|
58 const string& h) |
|
59 : name (n), can_return_complex_for_real_arg (cfr), |
|
60 lower_limit (l), upper_limit (u), d_d_mapper (dd), |
|
61 d_c_mapper (dc), c_c_mapper (cc), help_string (h) { } |
|
62 |
|
63 string name; |
529
|
64 int can_return_complex_for_real_arg; |
|
65 double lower_limit; |
|
66 double upper_limit; |
|
67 d_d_Mapper d_d_mapper; |
|
68 d_c_Mapper d_c_mapper; |
|
69 c_c_Mapper c_c_mapper; |
1755
|
70 string help_string; |
529
|
71 }; |
1
|
72 |
|
73 extern double arg (double x); |
|
74 extern double conj (double x); |
|
75 extern double fix (double x); |
|
76 extern double imag (double x); |
|
77 extern double real (double x); |
|
78 extern double round (double x); |
|
79 extern double signum (double x); |
529
|
80 extern double xisnan (double x); |
1
|
81 extern double xfinite (double x); |
|
82 extern double xisinf (double x); |
|
83 |
529
|
84 extern double xisnan (const Complex& x); |
1
|
85 extern double xfinite (const Complex& x); |
|
86 extern double xisinf (const Complex& x); |
|
87 |
|
88 extern Complex acos (const Complex& x); |
|
89 extern Complex acosh (const Complex& x); |
|
90 extern Complex asin (const Complex& x); |
|
91 extern Complex asinh (const Complex& x); |
|
92 extern Complex atan (const Complex& x); |
|
93 extern Complex atanh (const Complex& x); |
|
94 extern Complex ceil (const Complex& x); |
|
95 extern Complex fix (const Complex& x); |
|
96 extern Complex floor (const Complex& x); |
|
97 extern Complex log10 (const Complex& x); |
|
98 extern Complex round (const Complex& x); |
|
99 extern Complex signum (const Complex& x); |
|
100 extern Complex tan (const Complex& x); |
|
101 extern Complex tanh (const Complex& x); |
|
102 |
529
|
103 extern void install_mapper_functions (void); |
|
104 |
1
|
105 #endif |
|
106 |
|
107 /* |
|
108 ;;; Local Variables: *** |
|
109 ;;; mode: C++ *** |
|
110 ;;; page-delimiter: "^/\\*" *** |
|
111 ;;; End: *** |
|
112 */ |