1648
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1648
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_oct_cmplx_h) |
|
24 #define octave_oct_cmplx_h 1 |
|
25 |
3775
|
26 // By using this file instead of <complex>, we can easily avoid buggy |
|
27 // implementations of the standard complex data type (if needed). |
|
28 |
1648
|
29 #include <complex> |
|
30 |
3504
|
31 typedef std::complex<double> Complex; |
1648
|
32 |
3775
|
33 #if defined (CXX_ISO_COMPLIANT_LIBRARY) |
|
34 |
|
35 // If namespaces don't work, we will end up with some infinite looping. |
|
36 |
|
37 inline double |
|
38 real (const Complex& z) |
|
39 { |
|
40 return std::real (z); |
|
41 } |
|
42 |
|
43 inline double |
|
44 imag (const Complex& z) |
|
45 { |
|
46 return std::imag (z); |
|
47 } |
|
48 |
|
49 inline double |
|
50 abs (const Complex& z) |
|
51 { |
|
52 return std::abs (z); |
|
53 } |
|
54 |
|
55 inline double |
|
56 arg (const Complex& z) |
|
57 { |
|
58 return std::arg (z); |
|
59 } |
|
60 |
|
61 inline double |
|
62 norm (const Complex& z) |
|
63 { |
|
64 return std::norm (z); |
|
65 } |
|
66 |
|
67 inline Complex |
|
68 conj (const Complex& z) |
|
69 { |
|
70 return std::conj (z); |
|
71 } |
|
72 |
|
73 inline Complex |
|
74 polar (const double& x, const double& y); |
|
75 |
|
76 inline Complex |
|
77 cos (const Complex& z) |
|
78 { |
|
79 return std::cos (z); |
|
80 } |
|
81 |
|
82 inline Complex |
|
83 cosh (const Complex& z) |
|
84 { |
|
85 return std::cosh (z); |
|
86 } |
|
87 |
|
88 inline Complex |
|
89 exp (const Complex& z) |
|
90 { |
|
91 return std::exp (z); |
|
92 } |
|
93 |
|
94 inline Complex |
|
95 log (const Complex& z) |
|
96 { |
|
97 return std::log (z); |
|
98 } |
|
99 |
|
100 inline Complex |
|
101 log10 (const Complex& z) |
|
102 { |
|
103 return std::log10 (z); |
|
104 } |
|
105 |
|
106 inline Complex |
|
107 pow (const Complex& z, int n) |
|
108 { |
|
109 return std::pow (z, n); |
|
110 } |
|
111 |
|
112 inline Complex |
|
113 pow (const Complex& z, const double& x) |
|
114 { |
|
115 return std::pow (z, x); |
|
116 } |
|
117 |
|
118 inline Complex |
|
119 pow (const Complex& z1, const Complex& z2) |
|
120 { |
|
121 return std::pow (z1, z2); |
|
122 } |
|
123 |
|
124 inline Complex |
|
125 pow (const double& x, const Complex& z) |
|
126 { |
|
127 return std::pow (x, z); |
|
128 } |
|
129 |
|
130 inline Complex |
|
131 sin (const Complex& z) |
|
132 { |
|
133 return std::sin (z); |
|
134 } |
|
135 |
|
136 inline Complex |
|
137 sinh (const Complex& z) |
|
138 { |
|
139 return std::sinh (z); |
|
140 } |
|
141 |
|
142 inline Complex |
|
143 sqrt (const Complex& z) |
|
144 { |
|
145 return std::sqrt (z); |
|
146 } |
|
147 |
|
148 inline Complex |
|
149 tan (const Complex& z) |
|
150 { |
|
151 return std::tan (z); |
|
152 } |
|
153 |
|
154 inline Complex |
|
155 tanh (const Complex& z) |
|
156 { |
|
157 return std::tanh (z); |
|
158 } |
|
159 |
|
160 #endif |
|
161 |
1648
|
162 #endif |
|
163 |
|
164 /* |
|
165 ;;; Local Variables: *** |
|
166 ;;; mode: C++ *** |
|
167 ;;; End: *** |
|
168 */ |