My Project
0.0.16
QUCS Mapping
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
DownLoad
QUCS-src
qucs-0.0.16
qucs-core
src
math
complex.h
Go to the documentation of this file.
1
/*
2
* complex.h - complex number class definitions
3
*
4
* Copyright (C) 2008 Stefan Jahn <stefan@lkcc.org>
5
*
6
* This is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* This software is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this package; see the file COPYING. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19
* Boston, MA 02110-1301, USA.
20
*
21
* $Id: complex.h 1825 2011-03-11 20:42:14Z ela $
22
*
23
*/
24
25
#ifndef __COMPLEX_H__
26
#define __COMPLEX_H__
27
28
#include "
real.h
"
29
30
#ifndef HAVE_COMPLEX
31
#include "
cmplx.h
"
32
typedef
cmplx
nr_complex_t
;
33
#elif defined HAVE_TR1_COMPLEX
34
#include <tr1/complex>
35
using namespace
std;
36
using namespace
std::tr1;
37
typedef
std::complex<nr_double_t>
nr_complex_t
;
38
#else
39
#include <complex>
40
using namespace
std;
41
typedef
std::complex<nr_double_t>
nr_complex_t
;
42
#endif
43
44
// undefine this macro if it is defined already
45
#ifdef log2
46
#undef log2
47
#endif
48
49
// create a complex object given rectangle coordinates
50
nr_complex_t
rect
(
const
nr_double_t
x
,
const
nr_double_t y = 0.0);
51
52
// overloaded math functions
53
#ifndef HAVE_CXX_COMPLEX_ACOS
54
nr_complex_t
acos
(
const
nr_complex_t
);
55
#endif
56
57
#ifndef HAVE_CXX_COMPLEX_ACOSH
58
nr_complex_t
acosh
(
const
nr_complex_t
);
59
#endif
60
61
#ifndef HAVE_CXX_COMPLEX_ASIN
62
nr_complex_t
asin
(
const
nr_complex_t
);
63
#endif
64
65
#ifndef HAVE_CXX_COMPLEX_ASINH
66
nr_complex_t
asinh
(
const
nr_complex_t
);
67
#endif
68
69
#ifndef HAVE_CXX_COMPLEX_ATAN
70
nr_complex_t
atan
(
const
nr_complex_t
);
71
#endif
72
73
#ifndef HAVE_CXX_COMPLEX_ATANH
74
nr_complex_t
atanh
(
const
nr_complex_t
);
75
#endif
76
77
#ifndef HAVE_CXX_COMPLEX_ATAN2
78
nr_complex_t
atan2
(
const
nr_complex_t
,
const
nr_complex_t
);
79
#endif
80
81
#ifndef HAVE_CXX_COMPLEX_COS
82
nr_complex_t
cos
(
const
nr_complex_t
);
83
#endif
84
85
#ifndef HAVE_CXX_COMPLEX_COSH
86
nr_complex_t
cosh
(
const
nr_complex_t
);
87
#endif
88
89
#ifndef HAVE_CXX_COMPLEX_EXP
90
nr_complex_t
exp
(
const
nr_complex_t
);
91
#endif
92
93
#ifndef HAVE_CXX_COMPLEX_FMOD
94
nr_complex_t
fmod
(
const
nr_complex_t
x
,
const
nr_complex_t
y);
95
nr_complex_t
fmod
(
const
nr_complex_t
x
,
const
nr_double_t y);
96
nr_complex_t
fmod
(
const
nr_double_t
x
,
const
nr_complex_t
y);
97
#endif
98
99
#ifndef HAVE_CXX_COMPLEX_LOG
100
nr_complex_t
log
(
const
nr_complex_t
);
101
#endif
102
103
#ifndef HAVE_CXX_COMPLEX_LOG10
104
nr_complex_t
log10
(
const
nr_complex_t
);
105
#endif
106
107
#ifndef HAVE_CXX_COMPLEX_LOG2
108
nr_complex_t
log2
(
const
nr_complex_t
);
109
#endif
110
111
#ifndef HAVE_CXX_COMPLEX_NORM
112
nr_double_t
norm
(
const
nr_complex_t
);
113
#endif
114
115
#ifndef HAVE_CXX_COMPLEX_POLAR
116
nr_complex_t
polar
(
const
nr_double_t mag,
const
nr_double_t ang = 0.0);
117
#endif
118
119
#ifndef HAVE_CXX_COMPLEX_POLAR_COMPLEX
120
nr_complex_t
polar
(
const
nr_complex_t
a,
const
nr_complex_t
p);
121
nr_complex_t
polar
(
const
nr_double_t a,
const
nr_complex_t
p);
122
nr_complex_t
polar
(
const
nr_complex_t
a,
const
nr_double_t p = 0.0);
123
#endif
124
125
#ifndef HAVE_CXX_COMPLEX_POW
126
nr_complex_t
pow
(
const
nr_complex_t
,
const
nr_double_t);
127
nr_complex_t
pow
(
const
nr_double_t,
const
nr_complex_t
);
128
nr_complex_t
pow
(
const
nr_complex_t
,
const
nr_complex_t
);
129
#endif
130
131
#ifndef HAVE_CXX_COMPLEX_SIN
132
nr_complex_t
sin
(
const
nr_complex_t
);
133
#endif
134
135
#ifndef HAVE_CXX_COMPLEX_SINH
136
nr_complex_t
sinh
(
const
nr_complex_t
);
137
#endif
138
139
#ifndef HAVE_CXX_COMPLEX_SQRT
140
nr_complex_t
sqrt
(
const
nr_complex_t
);
141
#endif
142
143
#ifndef HAVE_CXX_COMPLEX_TAN
144
nr_complex_t
tan
(
const
nr_complex_t
);
145
#endif
146
147
#ifndef HAVE_CXX_COMPLEX_TANH
148
nr_complex_t
tanh
(
const
nr_complex_t
);
149
#endif
150
151
// extra math functions
152
nr_double_t
dB
(
const
nr_complex_t
);
153
nr_complex_t
limexp
(
const
nr_complex_t
);
154
nr_complex_t
cot
(
const
nr_complex_t
);
155
nr_complex_t
acot
(
const
nr_complex_t
);
156
nr_complex_t
asech
(
const
nr_complex_t
);
157
nr_complex_t
coth
(
const
nr_complex_t
);
158
nr_complex_t
acoth
(
const
nr_complex_t
);
159
nr_complex_t
ztor
(
const
nr_complex_t
,
const
nr_complex_t
zref = 50.0);
160
nr_complex_t
rtoz
(
const
nr_complex_t
,
const
nr_complex_t
zref = 50.0);
161
nr_complex_t
ytor
(
const
nr_complex_t
,
const
nr_complex_t
zref = 50.0);
162
nr_complex_t
rtoy
(
const
nr_complex_t
,
const
nr_complex_t
zref = 50.0);
163
nr_complex_t
signum
(
const
nr_complex_t
);
164
nr_complex_t
sign
(
const
nr_complex_t
);
165
nr_complex_t
sinc
(
const
nr_complex_t
);
166
nr_double_t
xhypot
(
const
nr_complex_t
,
const
nr_complex_t
);
167
nr_double_t
xhypot
(
const
nr_double_t,
const
nr_complex_t
);
168
nr_double_t
xhypot
(
const
nr_complex_t
,
const
nr_double_t);
169
nr_complex_t
floor
(
const
nr_complex_t
);
170
nr_complex_t
ceil
(
const
nr_complex_t
);
171
nr_complex_t
fix
(
const
nr_complex_t
);
172
nr_complex_t
trunc
(
const
nr_complex_t
);
173
nr_complex_t
round
(
const
nr_complex_t
);
174
nr_complex_t
sqr
(
const
nr_complex_t
);
175
nr_complex_t
step
(
const
nr_complex_t
);
176
nr_complex_t
jn
(
const
int
,
const
nr_complex_t
);
177
nr_complex_t
yn
(
const
int
,
const
nr_complex_t
);
178
nr_complex_t
i0
(
const
nr_complex_t
);
179
nr_complex_t
erf
(
const
nr_complex_t
);
180
nr_complex_t
erfc
(
const
nr_complex_t
);
181
nr_complex_t
erfinv
(
const
nr_complex_t
);
182
nr_complex_t
erfcinv
(
const
nr_complex_t
);
183
184
// modulo operators
185
nr_complex_t
operator %
(
const
nr_complex_t
,
const
nr_complex_t
);
186
nr_complex_t
operator %
(
const
nr_complex_t
,
const
nr_double_t);
187
nr_complex_t
operator %
(
const
nr_double_t,
const
nr_complex_t
);
188
189
// comparisons
190
bool
operator ==
(
const
nr_complex_t
,
const
nr_complex_t
);
191
bool
operator !=
(
const
nr_complex_t
,
const
nr_complex_t
);
192
bool
operator >=
(
const
nr_complex_t
,
const
nr_complex_t
);
193
bool
operator <=
(
const
nr_complex_t
,
const
nr_complex_t
);
194
bool
operator >
(
const
nr_complex_t
,
const
nr_complex_t
);
195
bool
operator <
(
const
nr_complex_t
,
const
nr_complex_t
);
196
197
#endif
/* __COMPLEX_H__ */
Generated on Tue Dec 25 2012 14:30:34 for My Project by
1.8.2