line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############# Class : cmplx ############## |
2
|
|
|
|
|
|
|
package Math::Cephes::Complex; |
3
|
17
|
|
|
17
|
|
55
|
use strict; |
|
17
|
|
|
|
|
621
|
|
|
17
|
|
|
|
|
1031
|
|
4
|
17
|
|
|
17
|
|
657
|
use warnings; |
|
17
|
|
|
|
|
15
|
|
|
17
|
|
|
|
|
1737
|
|
5
|
17
|
|
|
|
|
18598
|
use vars qw(%OWNER %ITERATORS @ISA |
6
|
17
|
|
|
17
|
|
52
|
@EXPORT_OK %EXPORT_TAGS $VERSION); |
|
17
|
|
|
|
|
1255
|
|
7
|
|
|
|
|
|
|
require Math::Cephes; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
*import = \&Exporter::import; |
11
|
|
|
|
|
|
|
@ISA = qw( Math::Cephes ); |
12
|
|
|
|
|
|
|
#my @cmplx = qw(clog cexp csin ccos ctan ccot casin cmplx |
13
|
|
|
|
|
|
|
# cacos catan cadd csub cmul cdiv cmov cneg cabs csqrt |
14
|
|
|
|
|
|
|
# csinh ccosh ctanh cpow casinh cacosh catanh); |
15
|
|
|
|
|
|
|
@EXPORT_OK = qw(cmplx); |
16
|
|
|
|
|
|
|
#%EXPORT_TAGS = ('cmplx' => [qw(cmplx)]); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
%OWNER = (); |
19
|
|
|
|
|
|
|
%ITERATORS = (); |
20
|
|
|
|
|
|
|
$VERSION = '0.5305'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
*swig_r_get = *Math::Cephesc::cmplx_r_get; |
23
|
|
|
|
|
|
|
*swig_r_set = *Math::Cephesc::cmplx_r_set; |
24
|
|
|
|
|
|
|
*swig_i_get = *Math::Cephesc::cmplx_i_get; |
25
|
|
|
|
|
|
|
*swig_i_set = *Math::Cephesc::cmplx_i_set; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
28
|
58
|
|
|
58
|
0
|
450
|
my $pkg = shift; |
29
|
58
|
|
|
|
|
264
|
my $self = Math::Cephesc::new_cmplx(@_); |
30
|
58
|
50
|
|
|
|
219
|
bless $self, $pkg if defined($self); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub DESTROY { |
34
|
126
|
100
|
|
126
|
|
1975
|
return unless $_[0]->isa('HASH'); |
35
|
63
|
|
|
|
|
44
|
my $self = tied(%{$_[0]}); |
|
63
|
|
|
|
|
69
|
|
36
|
63
|
50
|
|
|
|
86
|
return unless defined $self; |
37
|
63
|
|
|
|
|
52
|
delete $ITERATORS{$self}; |
38
|
63
|
50
|
|
|
|
106
|
if (exists $OWNER{$self}) { |
39
|
63
|
|
|
|
|
96
|
Math::Cephesc::delete_cmplx($self); |
40
|
63
|
|
|
|
|
148
|
delete $OWNER{$self}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub DISOWN { |
45
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
46
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
47
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub ACQUIRE { |
51
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
52
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
53
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub r { |
58
|
76
|
|
|
76
|
0
|
1171
|
my ($self, $value) = @_; |
59
|
76
|
100
|
|
|
|
267
|
return $self->{r} unless (defined $value); |
60
|
1
|
|
|
|
|
12
|
$self->{r} = $value; |
61
|
1
|
|
|
|
|
2
|
return $value; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub i { |
65
|
77
|
|
|
77
|
0
|
123
|
my ($self, $value) = @_; |
66
|
77
|
100
|
|
|
|
263
|
return $self->{i} unless (defined $value); |
67
|
1
|
|
|
|
|
3
|
$self->{i} = $value; |
68
|
1
|
|
|
|
|
3
|
return $value; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub cmplx { |
72
|
0
|
|
|
0
|
0
|
0
|
return Math::Cephes::Complex->new(@_); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub as_string { |
76
|
0
|
|
|
0
|
0
|
0
|
my $z = shift; |
77
|
0
|
|
|
|
|
0
|
my $string; |
78
|
0
|
|
|
|
|
0
|
my $re = $z->{r}; |
79
|
0
|
|
|
|
|
0
|
my $im = $z->{i}; |
80
|
0
|
0
|
|
|
|
0
|
if ($im == 0) { |
81
|
0
|
|
|
|
|
0
|
$string = "$re"; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
else { |
84
|
0
|
0
|
|
|
|
0
|
$string = sprintf "%f %s %f %s", $re, |
|
|
0
|
|
|
|
|
|
85
|
|
|
|
|
|
|
(int( $im / abs($im) ) == -1) ? '-' : '+' , |
86
|
|
|
|
|
|
|
($im < 0) ? abs($im) : $im, 'i'; |
87
|
|
|
|
|
|
|
} |
88
|
0
|
|
|
|
|
0
|
return $string; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub cadd { |
93
|
1
|
|
|
1
|
0
|
5
|
my ($z1, $z2) = @_; |
94
|
1
|
|
|
|
|
2
|
my $z = Math::Cephes::Complex->new(); |
95
|
1
|
|
|
|
|
15
|
Math::Cephes::cadd($z1, $z2, $z); |
96
|
1
|
|
|
|
|
2
|
return $z; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub csub { |
100
|
1
|
|
|
1
|
0
|
3
|
my ($z1, $z2) = @_; |
101
|
1
|
|
|
|
|
4
|
my $z = Math::Cephes::Complex->new(); |
102
|
1
|
|
|
|
|
9
|
Math::Cephes::csub($z2, $z1, $z); |
103
|
1
|
|
|
|
|
2
|
return $z; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub cmul { |
107
|
2
|
|
|
2
|
0
|
5
|
my ($z1, $z2) = @_; |
108
|
2
|
|
|
|
|
4
|
my $z = Math::Cephes::Complex->new(); |
109
|
2
|
|
|
|
|
6
|
Math::Cephes::cmul($z1, $z2, $z); |
110
|
2
|
|
|
|
|
4
|
return $z; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub cdiv { |
114
|
1
|
|
|
1
|
0
|
10
|
my ($z1, $z2) = @_; |
115
|
1
|
|
|
|
|
4
|
my $z = Math::Cephes::Complex->new(); |
116
|
1
|
|
|
|
|
5
|
Math::Cephes::cdiv($z2, $z1, $z); |
117
|
1
|
|
|
|
|
1
|
return $z; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub cpow { |
121
|
1
|
|
|
1
|
0
|
2
|
my ($z1, $z2) = @_; |
122
|
1
|
|
|
|
|
2
|
my $z = Math::Cephes::Complex->new(); |
123
|
1
|
|
|
|
|
14
|
Math::Cephes::cpow($z1, $z2, $z); |
124
|
1
|
|
|
|
|
2
|
return $z; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub clog { |
128
|
2
|
|
|
2
|
0
|
4
|
my ($z1) = @_; |
129
|
2
|
|
|
|
|
4
|
my $z = Math::Cephes::Complex->new(); |
130
|
2
|
|
|
|
|
22
|
Math::Cephes::clog($z1, $z); |
131
|
2
|
|
|
|
|
4
|
return $z; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
sub cexp { |
134
|
2
|
|
|
2
|
0
|
4
|
my ($z1) = @_; |
135
|
2
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
136
|
2
|
|
|
|
|
12
|
Math::Cephes::cexp($z1, $z); |
137
|
2
|
|
|
|
|
3
|
return $z; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
sub csin { |
140
|
1
|
|
|
1
|
0
|
5
|
my ($z1) = @_; |
141
|
1
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
142
|
1
|
|
|
|
|
6
|
Math::Cephes::csin($z1, $z); |
143
|
1
|
|
|
|
|
2
|
return $z; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
sub ccos { |
146
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
147
|
1
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
148
|
1
|
|
|
|
|
4
|
Math::Cephes::ccos($z1, $z); |
149
|
1
|
|
|
|
|
2
|
return $z; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
sub ctan { |
152
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
153
|
1
|
|
|
|
|
2
|
my $z = Math::Cephes::Complex->new(); |
154
|
1
|
|
|
|
|
5
|
Math::Cephes::ctan($z1, $z); |
155
|
1
|
|
|
|
|
2
|
return $z; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
sub ccot { |
158
|
1
|
|
|
1
|
0
|
1
|
my ($z1) = @_; |
159
|
1
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
160
|
1
|
|
|
|
|
6
|
Math::Cephes::ccot($z1, $z); |
161
|
1
|
|
|
|
|
2
|
return $z; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
sub casin { |
164
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
165
|
1
|
|
|
|
|
4
|
my $z = Math::Cephes::Complex->new(); |
166
|
1
|
|
|
|
|
10
|
Math::Cephes::casin($z1, $z); |
167
|
1
|
|
|
|
|
2
|
return $z; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
sub cacos { |
170
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
171
|
1
|
|
|
|
|
2
|
my $z = Math::Cephes::Complex->new(); |
172
|
1
|
|
|
|
|
6
|
Math::Cephes::cacos($z1, $z); |
173
|
1
|
|
|
|
|
1
|
return $z; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
sub catan { |
176
|
1
|
|
|
1
|
0
|
1
|
my ($z1) = @_; |
177
|
1
|
|
|
|
|
9
|
my $z = Math::Cephes::Complex->new(); |
178
|
1
|
|
|
|
|
4
|
Math::Cephes::catan($z1, $z); |
179
|
1
|
|
|
|
|
2
|
return $z; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
sub cmov { |
182
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
183
|
1
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
184
|
1
|
|
|
|
|
4
|
Math::Cephes::cmov($z1, $z); |
185
|
1
|
|
|
|
|
2
|
return $z; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
sub cneg { |
188
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
189
|
1
|
|
|
|
|
4
|
Math::Cephes::cneg($z1); |
190
|
1
|
|
|
|
|
2
|
return $z1; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
sub csqrt { |
193
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
194
|
1
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
195
|
1
|
|
|
|
|
5
|
Math::Cephes::csqrt($z1, $z); |
196
|
1
|
|
|
|
|
2
|
return $z; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
sub cabs { |
199
|
1
|
|
|
1
|
0
|
1
|
my ($z1) = @_; |
200
|
1
|
|
|
|
|
22
|
my $abs = Math::Cephes::cabs($z1); |
201
|
1
|
|
|
|
|
3
|
return $abs; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub csinh { |
205
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
206
|
1
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
207
|
1
|
|
|
|
|
5
|
Math::Cephes::csinh($z1, $z); |
208
|
1
|
|
|
|
|
2
|
return $z; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
sub ccosh { |
211
|
1
|
|
|
1
|
0
|
3
|
my ($z1) = @_; |
212
|
1
|
|
|
|
|
2
|
my $z = Math::Cephes::Complex->new(); |
213
|
1
|
|
|
|
|
10
|
Math::Cephes::ccosh($z1, $z); |
214
|
1
|
|
|
|
|
2
|
return $z; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
sub ctanh { |
217
|
1
|
|
|
1
|
0
|
5
|
my ($z1) = @_; |
218
|
1
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
219
|
1
|
|
|
|
|
5
|
Math::Cephes::ctanh($z1, $z); |
220
|
1
|
|
|
|
|
2
|
return $z; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
sub casinh { |
223
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
224
|
1
|
|
|
|
|
3
|
my $z = Math::Cephes::Complex->new(); |
225
|
1
|
|
|
|
|
7
|
Math::Cephes::casinh($z1, $z); |
226
|
1
|
|
|
|
|
6
|
return $z; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
sub cacosh { |
229
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
230
|
1
|
|
|
|
|
2
|
my $z = Math::Cephes::Complex->new(); |
231
|
1
|
|
|
|
|
6
|
Math::Cephes::cacosh($z1, $z); |
232
|
1
|
|
|
|
|
2
|
return $z; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
sub catanh { |
235
|
1
|
|
|
1
|
0
|
2
|
my ($z1) = @_; |
236
|
1
|
|
|
|
|
2
|
my $z = Math::Cephes::Complex->new(); |
237
|
1
|
|
|
|
|
5
|
Math::Cephes::catanh($z1, $z); |
238
|
1
|
|
|
|
|
2
|
return $z; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
1; |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
__END__ |