gccxml_gem 0.9.2-universal-darwin-10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +79 -0
- data/bin/gccxml +0 -0
- data/bin/gccxml_cc1plus +0 -0
- data/gccxml.rb +57 -0
- data/share/doc/gccxml-0.9/Copyright.txt +55 -0
- data/share/doc/gccxml-0.9/gccxml.html +168 -0
- data/share/doc/gccxml-0.9/gccxml.txt +293 -0
- data/share/gccxml-0.9/GCC/2.95/algorithm +76 -0
- data/share/gccxml-0.9/GCC/2.95/bitset +17 -0
- data/share/gccxml-0.9/GCC/2.95/cctype +24 -0
- data/share/gccxml-0.9/GCC/2.95/clocale +14 -0
- data/share/gccxml-0.9/GCC/2.95/cmath +33 -0
- data/share/gccxml-0.9/GCC/2.95/complex +38 -0
- data/share/gccxml-0.9/GCC/2.95/csetjmp +13 -0
- data/share/gccxml-0.9/GCC/2.95/csignal +14 -0
- data/share/gccxml-0.9/GCC/2.95/cstdarg +12 -0
- data/share/gccxml-0.9/GCC/2.95/cstddef +13 -0
- data/share/gccxml-0.9/GCC/2.95/cstdio +55 -0
- data/share/gccxml-0.9/GCC/2.95/cstdlib +66 -0
- data/share/gccxml-0.9/GCC/2.95/cstring +34 -0
- data/share/gccxml-0.9/GCC/2.95/ctime +24 -0
- data/share/gccxml-0.9/GCC/2.95/cwchar +65 -0
- data/share/gccxml-0.9/GCC/2.95/cwctype +31 -0
- data/share/gccxml-0.9/GCC/2.95/deque +19 -0
- data/share/gccxml-0.9/GCC/2.95/exception +20 -0
- data/share/gccxml-0.9/GCC/2.95/fstream +23 -0
- data/share/gccxml-0.9/GCC/2.95/functional +64 -0
- data/share/gccxml-0.9/GCC/2.95/gccxml_bitset +1066 -0
- data/share/gccxml-0.9/GCC/2.95/iomanip +20 -0
- data/share/gccxml-0.9/GCC/2.95/iosfwd +20 -0
- data/share/gccxml-0.9/GCC/2.95/iostream +27 -0
- data/share/gccxml-0.9/GCC/2.95/iterator +39 -0
- data/share/gccxml-0.9/GCC/2.95/list +19 -0
- data/share/gccxml-0.9/GCC/2.95/map +20 -0
- data/share/gccxml-0.9/GCC/2.95/memory +21 -0
- data/share/gccxml-0.9/GCC/2.95/new +13 -0
- data/share/gccxml-0.9/GCC/2.95/numeric +15 -0
- data/share/gccxml-0.9/GCC/2.95/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/2.95/queue +20 -0
- data/share/gccxml-0.9/GCC/2.95/set +20 -0
- data/share/gccxml-0.9/GCC/2.95/sstream +24 -0
- data/share/gccxml-0.9/GCC/2.95/stack +19 -0
- data/share/gccxml-0.9/GCC/2.95/std/bastring.cc +524 -0
- data/share/gccxml-0.9/GCC/2.95/std/complext.h +397 -0
- data/share/gccxml-0.9/GCC/2.95/std/dcomplex.h +92 -0
- data/share/gccxml-0.9/GCC/2.95/std/fcomplex.h +88 -0
- data/share/gccxml-0.9/GCC/2.95/std/gslice_array.h +170 -0
- data/share/gccxml-0.9/GCC/2.95/std/indirect_array.h +157 -0
- data/share/gccxml-0.9/GCC/2.95/std/ldcomplex.h +96 -0
- data/share/gccxml-0.9/GCC/2.95/std/mask_array.h +154 -0
- data/share/gccxml-0.9/GCC/2.95/std/slice_array.h +156 -0
- data/share/gccxml-0.9/GCC/2.95/std/std_valarray.h +728 -0
- data/share/gccxml-0.9/GCC/2.95/std/straits.h +162 -0
- data/share/gccxml-0.9/GCC/2.95/std/valarray_meta.h +1035 -0
- data/share/gccxml-0.9/GCC/2.95/stdexcept +17 -0
- data/share/gccxml-0.9/GCC/2.95/stl_alloc.h +1057 -0
- data/share/gccxml-0.9/GCC/2.95/stl_bvector.h +836 -0
- data/share/gccxml-0.9/GCC/2.95/stl_deque.h +1699 -0
- data/share/gccxml-0.9/GCC/2.95/stl_list.h +843 -0
- data/share/gccxml-0.9/GCC/2.95/stl_tree.h +1331 -0
- data/share/gccxml-0.9/GCC/2.95/stl_vector.h +828 -0
- data/share/gccxml-0.9/GCC/2.95/string +26 -0
- data/share/gccxml-0.9/GCC/2.95/strstream +23 -0
- data/share/gccxml-0.9/GCC/2.95/typeinfo +11 -0
- data/share/gccxml-0.9/GCC/2.95/utility +25 -0
- data/share/gccxml-0.9/GCC/2.95/valarray +52 -0
- data/share/gccxml-0.9/GCC/2.95/vector +19 -0
- data/share/gccxml-0.9/GCC/2.96/sstream +305 -0
- data/share/gccxml-0.9/GCC/3.0/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.1/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.2/bits/fstream.tcc +500 -0
- data/share/gccxml-0.9/GCC/3.2/bits/gthr-default.h +581 -0
- data/share/gccxml-0.9/GCC/3.2/bits/istream.tcc +1207 -0
- data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.h +1810 -0
- data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.tcc +2397 -0
- data/share/gccxml-0.9/GCC/3.2/bits/messages_members.h +108 -0
- data/share/gccxml-0.9/GCC/3.2/bits/ostream.tcc +713 -0
- data/share/gccxml-0.9/GCC/3.2/bits/sstream.tcc +241 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_deque.h +1682 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_list.h +989 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_tree.h +1462 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_vector.h +1085 -0
- data/share/gccxml-0.9/GCC/3.2/bits/valarray_meta.h +1063 -0
- data/share/gccxml-0.9/GCC/3.2/fstream +579 -0
- data/share/gccxml-0.9/GCC/3.2/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.2/sstream +384 -0
- data/share/gccxml-0.9/GCC/3.3/bits/fstream.tcc +530 -0
- data/share/gccxml-0.9/GCC/3.3/bits/list.tcc +378 -0
- data/share/gccxml-0.9/GCC/3.3/bits/locale_facets.h +2050 -0
- data/share/gccxml-0.9/GCC/3.3/bits/messages_members.h +108 -0
- data/share/gccxml-0.9/GCC/3.3/bits/sstream.tcc +243 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_deque.h +1603 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_list.h +1167 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_tree.h +1462 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_vector.h +992 -0
- data/share/gccxml-0.9/GCC/3.3/bits/valarray_meta.h +1135 -0
- data/share/gccxml-0.9/GCC/3.3/fstream +842 -0
- data/share/gccxml-0.9/GCC/3.3/gccxml_builtins.h +22 -0
- data/share/gccxml-0.9/GCC/3.3/sstream +638 -0
- data/share/gccxml-0.9/GCC/3.4/bits/gthr-default.h +664 -0
- data/share/gccxml-0.9/GCC/3.4/gccxml_builtins.h +91 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_builtins.h +128 -0
- data/share/gccxml-0.9/GCC/4.1/bits/gthr-default.h +618 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/4.3/gccxml_builtins.h +182 -0
- data/share/gccxml-0.9/IBM/8.0/adapt_headers.sh +34 -0
- data/share/gccxml-0.9/IBM/8.0/stdlib.h.patch +27 -0
- data/share/gccxml-0.9/IBM/8.0/xstring.patch +19 -0
- data/share/gccxml-0.9/IBM/README +8 -0
- data/share/gccxml-0.9/IBM/find_flags +51 -0
- data/share/gccxml-0.9/IBM/find_flags_common +48 -0
- data/share/gccxml-0.9/Intel/find_flags +56 -0
- data/share/gccxml-0.9/Intel/pthread.h +16 -0
- data/share/gccxml-0.9/MIPSpro/7.3/exception +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/gccxml_mpro_internals.h +21 -0
- data/share/gccxml-0.9/MIPSpro/7.3/iomanip +161 -0
- data/share/gccxml-0.9/MIPSpro/7.3/ostream +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stddef.h +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_config.h +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_locale.h +17 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_monetary.h +14 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_numeric_facets.h +13 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_threads.h +11 -0
- data/share/gccxml-0.9/MIPSpro/7.3/string +18 -0
- data/share/gccxml-0.9/MIPSpro/find_flags +70 -0
- data/share/gccxml-0.9/MIPSpro/mipspro_defs.cxx +63 -0
- data/share/gccxml-0.9/Sun/5.8/Cstd.patch +156 -0
- data/share/gccxml-0.9/Sun/5.8/adapt_headers.sh +32 -0
- data/share/gccxml-0.9/Sun/5.8/std-5.10.patch +22 -0
- data/share/gccxml-0.9/Sun/README +8 -0
- data/share/gccxml-0.9/Sun/find_flags +51 -0
- data/share/gccxml-0.9/Sun/find_flags_common +42 -0
- data/share/gccxml-0.9/gccxml_config +2 -0
- data/share/gccxml-0.9/gccxml_identify_compiler.cc +13 -0
- data/share/man/man1/gccxml.1 +246 -0
- metadata +194 -0
@@ -0,0 +1,397 @@
|
|
1
|
+
// The template and inlines for the -*- C++ -*- complex number classes.
|
2
|
+
// Copyright (C) 1994 Free Software Foundation
|
3
|
+
|
4
|
+
// This file is part of the GNU ANSI C++ Library. This library is free
|
5
|
+
// software; you can redistribute it and/or modify it under the terms of
|
6
|
+
// the GNU General Public License as published by the Free Software
|
7
|
+
// Foundation; either version 2, or (at your option) any later version.
|
8
|
+
|
9
|
+
// This library is distributed in the hope that it will be useful,
|
10
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
// GNU General Public License for more details.
|
13
|
+
|
14
|
+
// You should have received a copy of the GNU General Public License
|
15
|
+
// along with this library; see the file COPYING. If not, write to the Free
|
16
|
+
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
17
|
+
|
18
|
+
// As a special exception, if you link this library with files compiled
|
19
|
+
// with a GNU compiler to produce an executable, this does not cause the
|
20
|
+
// resulting executable to be covered by the GNU General Public License.
|
21
|
+
// This exception does not however invalidate any other reasons why the
|
22
|
+
// executable file might be covered by the GNU General Public License.
|
23
|
+
|
24
|
+
// Written by Jason Merrill based upon the specification in the 27 May 1994
|
25
|
+
// C++ working paper, ANSI document X3J16/94-0098.
|
26
|
+
|
27
|
+
#ifndef __COMPLEXT__GCCXML
|
28
|
+
#define __COMPLEXT__GCCXML
|
29
|
+
|
30
|
+
#ifdef __GNUG__
|
31
|
+
#pragma interface
|
32
|
+
#endif
|
33
|
+
|
34
|
+
#include <cmath>
|
35
|
+
|
36
|
+
#if ! defined (__GNUG__) && ! defined (__attribute__)
|
37
|
+
#define __attribute__(foo) /* Ignore. */
|
38
|
+
#endif
|
39
|
+
|
40
|
+
class istream;
|
41
|
+
class ostream;
|
42
|
+
|
43
|
+
extern "C++" {
|
44
|
+
template <class _FLT> class complex;
|
45
|
+
template <class _FLT> complex<_FLT>&
|
46
|
+
__doapl (complex<_FLT>* ths, const complex<_FLT>& r);
|
47
|
+
template <class _FLT> complex<_FLT>&
|
48
|
+
__doami (complex<_FLT>* ths, const complex<_FLT>& r);
|
49
|
+
template <class _FLT> complex<_FLT>&
|
50
|
+
__doaml (complex<_FLT>* ths, const complex<_FLT>& r);
|
51
|
+
template <class _FLT> complex<_FLT>&
|
52
|
+
__doadv (complex<_FLT>* ths, const complex<_FLT>& r);
|
53
|
+
|
54
|
+
template <class _FLT>
|
55
|
+
class complex
|
56
|
+
{
|
57
|
+
public:
|
58
|
+
complex (_FLT r = 0, _FLT i = 0): re (r), im (i) { }
|
59
|
+
complex& operator += (const complex&);
|
60
|
+
complex& operator -= (const complex&);
|
61
|
+
complex& operator *= (const complex&);
|
62
|
+
complex& operator /= (const complex&);
|
63
|
+
_FLT real () const { return re; }
|
64
|
+
_FLT imag () const { return im; }
|
65
|
+
private:
|
66
|
+
_FLT re, im;
|
67
|
+
|
68
|
+
friend complex& __doapl<> (complex *, const complex&);
|
69
|
+
friend complex& __doami<> (complex *, const complex&);
|
70
|
+
friend complex& __doaml<> (complex *, const complex&);
|
71
|
+
friend complex& __doadv<> (complex *, const complex&);
|
72
|
+
};
|
73
|
+
|
74
|
+
// Declare specializations.
|
75
|
+
class complex<float>;
|
76
|
+
class complex<double>;
|
77
|
+
class complex<long double>;
|
78
|
+
|
79
|
+
template <class _FLT>
|
80
|
+
inline complex<_FLT>&
|
81
|
+
__doapl (complex<_FLT>* ths, const complex<_FLT>& r)
|
82
|
+
{
|
83
|
+
ths->re += r.re;
|
84
|
+
ths->im += r.im;
|
85
|
+
return *ths;
|
86
|
+
}
|
87
|
+
template <class _FLT>
|
88
|
+
inline complex<_FLT>&
|
89
|
+
complex<_FLT>::operator += (const complex<_FLT>& r)
|
90
|
+
{
|
91
|
+
return __doapl (this, r);
|
92
|
+
}
|
93
|
+
|
94
|
+
template <class _FLT>
|
95
|
+
inline complex<_FLT>&
|
96
|
+
__doami (complex<_FLT>* ths, const complex<_FLT>& r)
|
97
|
+
{
|
98
|
+
ths->re -= r.re;
|
99
|
+
ths->im -= r.im;
|
100
|
+
return *ths;
|
101
|
+
}
|
102
|
+
template <class _FLT>
|
103
|
+
inline complex<_FLT>&
|
104
|
+
complex<_FLT>::operator -= (const complex<_FLT>& r)
|
105
|
+
{
|
106
|
+
return __doami (this, r);
|
107
|
+
}
|
108
|
+
|
109
|
+
template <class _FLT>
|
110
|
+
inline complex<_FLT>&
|
111
|
+
__doaml (complex<_FLT>* ths, const complex<_FLT>& r)
|
112
|
+
{
|
113
|
+
_FLT f = ths->re * r.re - ths->im * r.im;
|
114
|
+
ths->im = ths->re * r.im + ths->im * r.re;
|
115
|
+
ths->re = f;
|
116
|
+
return *ths;
|
117
|
+
}
|
118
|
+
template <class _FLT>
|
119
|
+
inline complex<_FLT>&
|
120
|
+
complex<_FLT>::operator *= (const complex<_FLT>& r)
|
121
|
+
{
|
122
|
+
return __doaml (this, r);
|
123
|
+
}
|
124
|
+
|
125
|
+
template <class _FLT>
|
126
|
+
inline complex<_FLT>&
|
127
|
+
complex<_FLT>::operator /= (const complex<_FLT>& r)
|
128
|
+
{
|
129
|
+
return __doadv (this, r);
|
130
|
+
}
|
131
|
+
|
132
|
+
template <class _FLT> inline _FLT
|
133
|
+
imag (const complex<_FLT>& x) __attribute__ ((const));
|
134
|
+
|
135
|
+
template <class _FLT> inline _FLT
|
136
|
+
imag (const complex<_FLT>& x)
|
137
|
+
{
|
138
|
+
return x.imag ();
|
139
|
+
}
|
140
|
+
|
141
|
+
template <class _FLT> inline _FLT
|
142
|
+
real (const complex<_FLT>& x) __attribute__ ((const));
|
143
|
+
|
144
|
+
template <class _FLT> inline _FLT
|
145
|
+
real (const complex<_FLT>& x)
|
146
|
+
{
|
147
|
+
return x.real ();
|
148
|
+
}
|
149
|
+
|
150
|
+
template <class _FLT> inline complex<_FLT>
|
151
|
+
operator + (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
152
|
+
|
153
|
+
template <class _FLT> inline complex<_FLT>
|
154
|
+
operator + (const complex<_FLT>& x, const complex<_FLT>& y)
|
155
|
+
{
|
156
|
+
return complex<_FLT> (real (x) + real (y), imag (x) + imag (y));
|
157
|
+
}
|
158
|
+
|
159
|
+
template <class _FLT> inline complex<_FLT>
|
160
|
+
operator + (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
161
|
+
|
162
|
+
template <class _FLT> inline complex<_FLT>
|
163
|
+
operator + (const complex<_FLT>& x, _FLT y)
|
164
|
+
{
|
165
|
+
return complex<_FLT> (real (x) + y, imag (x));
|
166
|
+
}
|
167
|
+
|
168
|
+
template <class _FLT> inline complex<_FLT>
|
169
|
+
operator + (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
170
|
+
|
171
|
+
template <class _FLT> inline complex<_FLT>
|
172
|
+
operator + (_FLT x, const complex<_FLT>& y)
|
173
|
+
{
|
174
|
+
return complex<_FLT> (x + real (y), imag (y));
|
175
|
+
}
|
176
|
+
|
177
|
+
template <class _FLT> inline complex<_FLT>
|
178
|
+
operator - (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
179
|
+
|
180
|
+
template <class _FLT> inline complex<_FLT>
|
181
|
+
operator - (const complex<_FLT>& x, const complex<_FLT>& y)
|
182
|
+
{
|
183
|
+
return complex<_FLT> (real (x) - real (y), imag (x) - imag (y));
|
184
|
+
}
|
185
|
+
|
186
|
+
template <class _FLT> inline complex<_FLT>
|
187
|
+
operator - (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
188
|
+
|
189
|
+
template <class _FLT> inline complex<_FLT>
|
190
|
+
operator - (const complex<_FLT>& x, _FLT y)
|
191
|
+
{
|
192
|
+
return complex<_FLT> (real (x) - y, imag (x));
|
193
|
+
}
|
194
|
+
|
195
|
+
template <class _FLT> inline complex<_FLT>
|
196
|
+
operator - (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
197
|
+
|
198
|
+
template <class _FLT> inline complex<_FLT>
|
199
|
+
operator - (_FLT x, const complex<_FLT>& y)
|
200
|
+
{
|
201
|
+
return complex<_FLT> (x - real (y), - imag (y));
|
202
|
+
}
|
203
|
+
|
204
|
+
template <class _FLT> inline complex<_FLT>
|
205
|
+
operator * (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
206
|
+
|
207
|
+
template <class _FLT> inline complex<_FLT>
|
208
|
+
operator * (const complex<_FLT>& x, const complex<_FLT>& y)
|
209
|
+
{
|
210
|
+
return complex<_FLT> (real (x) * real (y) - imag (x) * imag (y),
|
211
|
+
real (x) * imag (y) + imag (x) * real (y));
|
212
|
+
}
|
213
|
+
|
214
|
+
template <class _FLT> inline complex<_FLT>
|
215
|
+
operator * (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
216
|
+
|
217
|
+
template <class _FLT> inline complex<_FLT>
|
218
|
+
operator * (const complex<_FLT>& x, _FLT y)
|
219
|
+
{
|
220
|
+
return complex<_FLT> (real (x) * y, imag (x) * y);
|
221
|
+
}
|
222
|
+
|
223
|
+
template <class _FLT> inline complex<_FLT>
|
224
|
+
operator * (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
225
|
+
|
226
|
+
template <class _FLT> inline complex<_FLT>
|
227
|
+
operator * (_FLT x, const complex<_FLT>& y)
|
228
|
+
{
|
229
|
+
return complex<_FLT> (x * real (y), x * imag (y));
|
230
|
+
}
|
231
|
+
|
232
|
+
template <class _FLT> complex<_FLT>
|
233
|
+
operator / (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
234
|
+
|
235
|
+
template <class _FLT> complex<_FLT>
|
236
|
+
operator / (const complex<_FLT>& x, _FLT y)
|
237
|
+
{
|
238
|
+
return complex<_FLT> (real (x) / y, imag (x) / y);
|
239
|
+
}
|
240
|
+
|
241
|
+
template <class _FLT> inline complex<_FLT>
|
242
|
+
operator + (const complex<_FLT>& x) __attribute__ ((const));
|
243
|
+
|
244
|
+
template <class _FLT> inline complex<_FLT>
|
245
|
+
operator + (const complex<_FLT>& x)
|
246
|
+
{
|
247
|
+
return x;
|
248
|
+
}
|
249
|
+
|
250
|
+
template <class _FLT> inline complex<_FLT>
|
251
|
+
operator - (const complex<_FLT>& x) __attribute__ ((const));
|
252
|
+
|
253
|
+
template <class _FLT> inline complex<_FLT>
|
254
|
+
operator - (const complex<_FLT>& x)
|
255
|
+
{
|
256
|
+
return complex<_FLT> (-real (x), -imag (x));
|
257
|
+
}
|
258
|
+
|
259
|
+
template <class _FLT> inline bool
|
260
|
+
operator == (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
261
|
+
|
262
|
+
template <class _FLT> inline bool
|
263
|
+
operator == (const complex<_FLT>& x, const complex<_FLT>& y)
|
264
|
+
{
|
265
|
+
return real (x) == real (y) && imag (x) == imag (y);
|
266
|
+
}
|
267
|
+
|
268
|
+
template <class _FLT> inline bool
|
269
|
+
operator == (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
270
|
+
|
271
|
+
template <class _FLT> inline bool
|
272
|
+
operator == (const complex<_FLT>& x, _FLT y)
|
273
|
+
{
|
274
|
+
return real (x) == y && imag (x) == 0;
|
275
|
+
}
|
276
|
+
|
277
|
+
template <class _FLT> inline bool
|
278
|
+
operator == (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
279
|
+
|
280
|
+
template <class _FLT> inline bool
|
281
|
+
operator == (_FLT x, const complex<_FLT>& y)
|
282
|
+
{
|
283
|
+
return x == real (y) && imag (y) == 0;
|
284
|
+
}
|
285
|
+
|
286
|
+
template <class _FLT> inline bool
|
287
|
+
operator != (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
288
|
+
|
289
|
+
template <class _FLT> inline bool
|
290
|
+
operator != (const complex<_FLT>& x, const complex<_FLT>& y)
|
291
|
+
{
|
292
|
+
return real (x) != real (y) || imag (x) != imag (y);
|
293
|
+
}
|
294
|
+
|
295
|
+
template <class _FLT> inline bool
|
296
|
+
operator != (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
297
|
+
|
298
|
+
template <class _FLT> inline bool
|
299
|
+
operator != (const complex<_FLT>& x, _FLT y)
|
300
|
+
{
|
301
|
+
return real (x) != y || imag (x) != 0;
|
302
|
+
}
|
303
|
+
|
304
|
+
template <class _FLT> inline bool
|
305
|
+
operator != (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
306
|
+
|
307
|
+
template <class _FLT> inline bool
|
308
|
+
operator != (_FLT x, const complex<_FLT>& y)
|
309
|
+
{
|
310
|
+
return x != real (y) || imag (y) != 0;
|
311
|
+
}
|
312
|
+
|
313
|
+
template <class _FLT> inline _FLT
|
314
|
+
abs (const complex<_FLT>& x) __attribute__ ((const));
|
315
|
+
|
316
|
+
template <class _FLT> inline _FLT
|
317
|
+
abs (const complex<_FLT>& x)
|
318
|
+
{
|
319
|
+
return hypot (real (x), imag (x));
|
320
|
+
}
|
321
|
+
|
322
|
+
template <class _FLT> inline _FLT
|
323
|
+
arg (const complex<_FLT>& x) __attribute__ ((const));
|
324
|
+
|
325
|
+
template <class _FLT> inline _FLT
|
326
|
+
arg (const complex<_FLT>& x)
|
327
|
+
{
|
328
|
+
return atan2 (imag (x), real (x));
|
329
|
+
}
|
330
|
+
|
331
|
+
template <class _FLT> inline complex<_FLT>
|
332
|
+
polar (_FLT r, _FLT t) __attribute__ ((const));
|
333
|
+
|
334
|
+
template <class _FLT> inline complex<_FLT>
|
335
|
+
polar (_FLT r, _FLT t)
|
336
|
+
{
|
337
|
+
return complex<_FLT> (r * cos (t), r * sin (t));
|
338
|
+
}
|
339
|
+
|
340
|
+
template <class _FLT> inline complex<_FLT>
|
341
|
+
conj (const complex<_FLT>& x) __attribute__ ((const));
|
342
|
+
|
343
|
+
template <class _FLT> inline complex<_FLT>
|
344
|
+
conj (const complex<_FLT>& x)
|
345
|
+
{
|
346
|
+
return complex<_FLT> (real (x), -imag (x));
|
347
|
+
}
|
348
|
+
|
349
|
+
template <class _FLT> inline _FLT
|
350
|
+
norm (const complex<_FLT>& x) __attribute__ ((const));
|
351
|
+
|
352
|
+
template <class _FLT> inline _FLT
|
353
|
+
norm (const complex<_FLT>& x)
|
354
|
+
{
|
355
|
+
return real (x) * real (x) + imag (x) * imag (x);
|
356
|
+
}
|
357
|
+
|
358
|
+
// Declarations of templates in complext.ccI
|
359
|
+
|
360
|
+
template <class _FLT> complex<_FLT>
|
361
|
+
operator / (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const));
|
362
|
+
template <class _FLT> complex<_FLT>
|
363
|
+
operator / (_FLT, const complex<_FLT>&) __attribute__ ((const));
|
364
|
+
template <class _FLT> complex<_FLT>
|
365
|
+
cos (const complex<_FLT>&) __attribute__ ((const));
|
366
|
+
template <class _FLT> complex<_FLT>
|
367
|
+
cosh (const complex<_FLT>&) __attribute__ ((const));
|
368
|
+
template <class _FLT> complex<_FLT>
|
369
|
+
exp (const complex<_FLT>&) __attribute__ ((const));
|
370
|
+
template <class _FLT> complex<_FLT>
|
371
|
+
log (const complex<_FLT>&) __attribute__ ((const));
|
372
|
+
template <class _FLT> complex<_FLT>
|
373
|
+
pow (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const));
|
374
|
+
template <class _FLT> complex<_FLT>
|
375
|
+
pow (const complex<_FLT>&, _FLT) __attribute__ ((const));
|
376
|
+
template <class _FLT> complex<_FLT>
|
377
|
+
pow (const complex<_FLT>&, int) __attribute__ ((const));
|
378
|
+
template <class _FLT> complex<_FLT>
|
379
|
+
pow (_FLT, const complex<_FLT>&) __attribute__ ((const));
|
380
|
+
template <class _FLT> complex<_FLT>
|
381
|
+
sin (const complex<_FLT>&) __attribute__ ((const));
|
382
|
+
template <class _FLT> complex<_FLT>
|
383
|
+
sinh (const complex<_FLT>&) __attribute__ ((const));
|
384
|
+
template <class _FLT> complex<_FLT>
|
385
|
+
sqrt (const complex<_FLT>&) __attribute__ ((const));
|
386
|
+
|
387
|
+
template <class _FLT> istream& operator >> (istream&, complex<_FLT>&);
|
388
|
+
template <class _FLT> ostream& operator << (ostream&, const complex<_FLT>&);
|
389
|
+
} // extern "C++"
|
390
|
+
|
391
|
+
// Specializations and such
|
392
|
+
|
393
|
+
#include <std/fcomplex.h>
|
394
|
+
#include <std/dcomplex.h>
|
395
|
+
#include <std/ldcomplex.h>
|
396
|
+
|
397
|
+
#endif
|
@@ -0,0 +1,92 @@
|
|
1
|
+
// The -*- C++ -*- double_complex class.
|
2
|
+
// Copyright (C) 1994 Free Software Foundation
|
3
|
+
|
4
|
+
// This file is part of the GNU ANSI C++ Library. This library is free
|
5
|
+
// software; you can redistribute it and/or modify it under the
|
6
|
+
// terms of the GNU General Public License as published by the
|
7
|
+
// Free Software Foundation; either version 2, or (at your option)
|
8
|
+
// any later version.
|
9
|
+
|
10
|
+
// This library is distributed in the hope that it will be useful,
|
11
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
// GNU General Public License for more details.
|
14
|
+
|
15
|
+
// You should have received a copy of the GNU General Public License
|
16
|
+
// along with this library; see the file COPYING. If not, write to the Free
|
17
|
+
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
18
|
+
|
19
|
+
// As a special exception, if you link this library with files
|
20
|
+
// compiled with a GNU compiler to produce an executable, this does not cause
|
21
|
+
// the resulting executable to be covered by the GNU General Public License.
|
22
|
+
// This exception does not however invalidate any other reasons why
|
23
|
+
// the executable file might be covered by the GNU General Public License.
|
24
|
+
|
25
|
+
// Written by Jason Merrill based upon the specification in the 27 May 1994
|
26
|
+
// C++ working paper, ANSI document X3J16/94-0098.
|
27
|
+
|
28
|
+
#ifndef __DCOMPLEX__
|
29
|
+
#define __DCOMPLEX__
|
30
|
+
|
31
|
+
#ifdef __GNUG__
|
32
|
+
#pragma interface "dcomplex"
|
33
|
+
#endif
|
34
|
+
|
35
|
+
extern "C++" {
|
36
|
+
template <>
|
37
|
+
class complex<double>
|
38
|
+
{
|
39
|
+
public:
|
40
|
+
complex (double r = 0, double i = 0): re (r), im (i) { }
|
41
|
+
complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { }
|
42
|
+
explicit complex (const complex<long double>& r);
|
43
|
+
|
44
|
+
complex& operator+= (const complex& r) { return __doapl (this, r); }
|
45
|
+
complex& operator-= (const complex& r) { return __doami (this, r); }
|
46
|
+
complex& operator*= (const complex& r) { return __doaml (this, r); }
|
47
|
+
complex& operator/= (const complex& r) { return __doadv (this, r); }
|
48
|
+
|
49
|
+
double real () const { return re; }
|
50
|
+
double imag () const { return im; }
|
51
|
+
private:
|
52
|
+
double re, im;
|
53
|
+
|
54
|
+
friend complex& __doapl<> (complex *, const complex&);
|
55
|
+
friend complex& __doami<> (complex *, const complex&);
|
56
|
+
friend complex& __doaml<> (complex *, const complex&);
|
57
|
+
friend complex& __doadv<> (complex *, const complex&);
|
58
|
+
|
59
|
+
#ifndef __STRICT_ANSI__
|
60
|
+
friend inline complex operator + (const complex& x, double y)
|
61
|
+
{ return operator+<> (x, y); }
|
62
|
+
friend inline complex operator + (double x, const complex& y)
|
63
|
+
{ return operator+<> (x, y); }
|
64
|
+
friend inline complex operator - (const complex& x, double y)
|
65
|
+
{ return operator-<> (x, y); }
|
66
|
+
friend inline complex operator - (double x, const complex& y)
|
67
|
+
{ return operator-<> (x, y); }
|
68
|
+
friend inline complex operator * (const complex& x, double y)
|
69
|
+
{ return operator*<> (x, y); }
|
70
|
+
friend inline complex operator * (double x, const complex& y)
|
71
|
+
{ return operator*<> (x, y); }
|
72
|
+
friend inline complex operator / (const complex& x, double y)
|
73
|
+
{ return operator/<> (x, y); }
|
74
|
+
friend inline complex operator / (double x, const complex& y)
|
75
|
+
{ return operator/<> (x, y); }
|
76
|
+
friend inline bool operator == (const complex& x, double y)
|
77
|
+
{ return operator==<> (x, y); }
|
78
|
+
friend inline bool operator == (double x, const complex& y)
|
79
|
+
{ return operator==<> (x, y); }
|
80
|
+
friend inline bool operator != (const complex& x, double y)
|
81
|
+
{ return operator!=<> (x, y); }
|
82
|
+
friend inline bool operator != (double x, const complex& y)
|
83
|
+
{ return operator!=<> (x, y); }
|
84
|
+
#endif /* __STRICT_ANSI__ */
|
85
|
+
};
|
86
|
+
|
87
|
+
inline complex<float>::complex (const complex<double>& r)
|
88
|
+
: re (r.real ()), im (r.imag ())
|
89
|
+
{ }
|
90
|
+
} // extern "C++"
|
91
|
+
|
92
|
+
#endif
|
@@ -0,0 +1,88 @@
|
|
1
|
+
// The -*- C++ -*- float_complex class.
|
2
|
+
// Copyright (C) 1994 Free Software Foundation
|
3
|
+
|
4
|
+
// This file is part of the GNU ANSI C++ Library. This library is free
|
5
|
+
// software; you can redistribute it and/or modify it under the
|
6
|
+
// terms of the GNU General Public License as published by the
|
7
|
+
// Free Software Foundation; either version 2, or (at your option)
|
8
|
+
// any later version.
|
9
|
+
|
10
|
+
// This library is distributed in the hope that it will be useful,
|
11
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
// GNU General Public License for more details.
|
14
|
+
|
15
|
+
// You should have received a copy of the GNU General Public License
|
16
|
+
// along with this library; see the file COPYING. If not, write to the Free
|
17
|
+
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
18
|
+
|
19
|
+
// As a special exception, if you link this library with files
|
20
|
+
// compiled with a GNU compiler to produce an executable, this does not cause
|
21
|
+
// the resulting executable to be covered by the GNU General Public License.
|
22
|
+
// This exception does not however invalidate any other reasons why
|
23
|
+
// the executable file might be covered by the GNU General Public License.
|
24
|
+
|
25
|
+
// Written by Jason Merrill based upon the specification in the 27 May 1994
|
26
|
+
// C++ working paper, ANSI document X3J16/94-0098.
|
27
|
+
|
28
|
+
#ifndef __FCOMPLEX__
|
29
|
+
#define __FCOMPLEX__
|
30
|
+
|
31
|
+
#ifdef __GNUG__
|
32
|
+
#pragma interface "fcomplex"
|
33
|
+
#endif
|
34
|
+
|
35
|
+
extern "C++" {
|
36
|
+
template <>
|
37
|
+
class complex<float>
|
38
|
+
{
|
39
|
+
public:
|
40
|
+
complex (float r = 0, float i = 0): re (r), im (i) { }
|
41
|
+
explicit complex (const complex<double>& r);
|
42
|
+
explicit complex (const complex<long double>& r);
|
43
|
+
|
44
|
+
complex& operator+= (const complex& r) { return __doapl (this, r); }
|
45
|
+
complex& operator-= (const complex& r) { return __doami (this, r); }
|
46
|
+
complex& operator*= (const complex& r) { return __doaml (this, r); }
|
47
|
+
complex& operator/= (const complex& r) { return __doadv (this, r); }
|
48
|
+
|
49
|
+
float real () const { return re; }
|
50
|
+
float imag () const { return im; }
|
51
|
+
private:
|
52
|
+
float re, im;
|
53
|
+
|
54
|
+
friend complex& __doapl<> (complex *, const complex&);
|
55
|
+
friend complex& __doami<> (complex *, const complex&);
|
56
|
+
friend complex& __doaml<> (complex *, const complex&);
|
57
|
+
friend complex& __doadv<> (complex *, const complex&);
|
58
|
+
|
59
|
+
#ifndef __STRICT_ANSI__
|
60
|
+
friend inline complex operator + (const complex& x, float y)
|
61
|
+
{ return operator+<> (x, y); }
|
62
|
+
friend inline complex operator + (float x, const complex& y)
|
63
|
+
{ return operator+<> (x, y); }
|
64
|
+
friend inline complex operator - (const complex& x, float y)
|
65
|
+
{ return operator-<> (x, y); }
|
66
|
+
friend inline complex operator - (float x, const complex& y)
|
67
|
+
{ return operator-<> (x, y); }
|
68
|
+
friend inline complex operator * (const complex& x, float y)
|
69
|
+
{ return operator*<> (x, y); }
|
70
|
+
friend inline complex operator * (float x, const complex& y)
|
71
|
+
{ return operator*<> (x, y); }
|
72
|
+
friend inline complex operator / (const complex& x, float y)
|
73
|
+
{ return operator/<> (x, y); }
|
74
|
+
friend inline complex operator / (float x, const complex& y)
|
75
|
+
{ return operator/<> (x, y); }
|
76
|
+
friend inline bool operator == (const complex& x, float y)
|
77
|
+
{ return operator==<> (x, y); }
|
78
|
+
friend inline bool operator == (float x, const complex& y)
|
79
|
+
{ return operator==<> (x, y); }
|
80
|
+
friend inline bool operator != (const complex& x, float y)
|
81
|
+
{ return operator!=<> (x, y); }
|
82
|
+
friend inline bool operator != (float x, const complex& y)
|
83
|
+
{ return operator!=<> (x, y); }
|
84
|
+
#endif /* __STRICT_ANSI__ */
|
85
|
+
};
|
86
|
+
} // extern "C++"
|
87
|
+
|
88
|
+
#endif
|