line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# GENERATED WITH PDL::PP! Don't modify! |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
package PDL::Ops; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
@EXPORT_OK = qw( PDL::PP log10 PDL::PP assgn PDL::PP carg PDL::PP conj PDL::PP creal PDL::PP cimag PDL::PP ci PDL::PP ipow PDL::PP _rabs PDL::PP _cabs ); |
8
|
|
|
|
|
|
|
%EXPORT_TAGS = (Func=>[@EXPORT_OK]); |
9
|
|
|
|
|
|
|
|
10
|
122
|
|
|
122
|
|
906
|
use PDL::Core; |
|
122
|
|
|
|
|
243
|
|
|
122
|
|
|
|
|
734
|
|
11
|
122
|
|
|
122
|
|
882
|
use PDL::Exporter; |
|
122
|
|
|
|
|
256
|
|
|
122
|
|
|
|
|
649
|
|
12
|
122
|
|
|
122
|
|
588
|
use DynaLoader; |
|
122
|
|
|
|
|
240
|
|
|
122
|
|
|
|
|
90063
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
@ISA = ( 'PDL::Exporter','DynaLoader' ); |
18
|
|
|
|
|
|
|
push @PDL::Core::PP, __PACKAGE__; |
19
|
|
|
|
|
|
|
bootstrap PDL::Ops ; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
PDL::Ops - Fundamental mathematical operators |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This module provides the functions used by PDL to |
32
|
|
|
|
|
|
|
overload the basic mathematical operators (C<+ - / *> |
33
|
|
|
|
|
|
|
etc.) and functions (C etc.) |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
It also includes the function C, which should |
36
|
|
|
|
|
|
|
be a perl function so that we can overload it! |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Matrix multiplication (the operator C) is handled |
39
|
|
|
|
|
|
|
by the module L. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
none |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 FUNCTIONS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 plus |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=for sig |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=for ref |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
add two piddles |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=for example |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$c = plus $x, $y, 0; # explicit call with trailing 0 |
77
|
|
|
|
|
|
|
$c = $x + $y; # overloaded call |
78
|
|
|
|
|
|
|
$x->inplace->plus($y,0); # modify $x inplace |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
81
|
|
|
|
|
|
|
This function is used to overload the binary C<+> operator. |
82
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
83
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
84
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=for bad |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
plus processes bad values. |
91
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
*plus = \&PDL::plus; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 mult |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=for sig |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=for ref |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
multiply two piddles |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=for example |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$c = mult $x, $y, 0; # explicit call with trailing 0 |
120
|
|
|
|
|
|
|
$c = $x * $y; # overloaded call |
121
|
|
|
|
|
|
|
$x->inplace->mult($y,0); # modify $x inplace |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
124
|
|
|
|
|
|
|
This function is used to overload the binary C<*> operator. |
125
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
126
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
127
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=for bad |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
mult processes bad values. |
134
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
*mult = \&PDL::mult; |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 minus |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=for sig |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=for ref |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
subtract two piddles |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=for example |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
$c = minus $x, $y, 0; # explicit call with trailing 0 |
163
|
|
|
|
|
|
|
$c = $x - $y; # overloaded call |
164
|
|
|
|
|
|
|
$x->inplace->minus($y,0); # modify $x inplace |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
167
|
|
|
|
|
|
|
This function is used to overload the binary C<-> operator. |
168
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
169
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
170
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=for bad |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
minus processes bad values. |
177
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
*minus = \&PDL::minus; |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 divide |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=for sig |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=for ref |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
divide two piddles |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=for example |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$c = divide $x, $y, 0; # explicit call with trailing 0 |
206
|
|
|
|
|
|
|
$c = $x / $y; # overloaded call |
207
|
|
|
|
|
|
|
$x->inplace->divide($y,0); # modify $x inplace |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
210
|
|
|
|
|
|
|
This function is used to overload the binary C> operator. |
211
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
212
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
213
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=for bad |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
divide processes bad values. |
220
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=cut |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
*divide = \&PDL::divide; |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 gt |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=for sig |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=for ref |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
the binary E (greater than) operation |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=for example |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
$c = gt $x, $y, 0; # explicit call with trailing 0 |
249
|
|
|
|
|
|
|
$c = $x > $y; # overloaded call |
250
|
|
|
|
|
|
|
$x->inplace->gt($y,0); # modify $x inplace |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
253
|
|
|
|
|
|
|
This function is used to overload the binary C> operator. |
254
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
255
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
256
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=for bad |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
gt processes bad values. |
263
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=cut |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
*gt = \&PDL::gt; |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head2 lt |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=for sig |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=for ref |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
the binary E (less than) operation |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=for example |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
$c = lt $x, $y, 0; # explicit call with trailing 0 |
292
|
|
|
|
|
|
|
$c = $x < $y; # overloaded call |
293
|
|
|
|
|
|
|
$x->inplace->lt($y,0); # modify $x inplace |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
296
|
|
|
|
|
|
|
This function is used to overload the binary C> operator. |
297
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
298
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
299
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=for bad |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
lt processes bad values. |
306
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
*lt = \&PDL::lt; |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=head2 le |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=for sig |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=for ref |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
the binary E= (less equal) operation |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=for example |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
$c = le $x, $y, 0; # explicit call with trailing 0 |
335
|
|
|
|
|
|
|
$c = $x <= $y; # overloaded call |
336
|
|
|
|
|
|
|
$x->inplace->le($y,0); # modify $x inplace |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
339
|
|
|
|
|
|
|
This function is used to overload the binary C=> operator. |
340
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
341
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
342
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=for bad |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
le processes bad values. |
349
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=cut |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
*le = \&PDL::le; |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=head2 ge |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=for sig |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=for ref |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
the binary E= (greater equal) operation |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=for example |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
$c = ge $x, $y, 0; # explicit call with trailing 0 |
378
|
|
|
|
|
|
|
$c = $x >= $y; # overloaded call |
379
|
|
|
|
|
|
|
$x->inplace->ge($y,0); # modify $x inplace |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
382
|
|
|
|
|
|
|
This function is used to overload the binary C=> operator. |
383
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
384
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
385
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=for bad |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
ge processes bad values. |
392
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=cut |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
*ge = \&PDL::ge; |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=head2 eq |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=for sig |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=for ref |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
binary I operation (C<==>) |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=for example |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
$c = eq $x, $y, 0; # explicit call with trailing 0 |
421
|
|
|
|
|
|
|
$c = $x == $y; # overloaded call |
422
|
|
|
|
|
|
|
$x->inplace->eq($y,0); # modify $x inplace |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
425
|
|
|
|
|
|
|
This function is used to overload the binary C<==> operator. |
426
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
427
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
428
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=for bad |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
eq processes bad values. |
435
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
=cut |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
*eq = \&PDL::eq; |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=head2 ne |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=for sig |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=for ref |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
binary I operation (C) |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=for example |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
$c = ne $x, $y, 0; # explicit call with trailing 0 |
464
|
|
|
|
|
|
|
$c = $x != $y; # overloaded call |
465
|
|
|
|
|
|
|
$x->inplace->ne($y,0); # modify $x inplace |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
468
|
|
|
|
|
|
|
This function is used to overload the binary C operator. |
469
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
470
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
471
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=for bad |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
ne processes bad values. |
478
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
=cut |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
*ne = \&PDL::ne; |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=head2 shiftleft |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=for sig |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=for ref |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
leftshift C<$a> by C<$b> |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
=for example |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
$c = shiftleft $x, $y, 0; # explicit call with trailing 0 |
507
|
|
|
|
|
|
|
$c = $x << $y; # overloaded call |
508
|
|
|
|
|
|
|
$x->inplace->shiftleft($y,0); # modify $x inplace |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
511
|
|
|
|
|
|
|
This function is used to overload the binary CE> operator. |
512
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
513
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
514
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
=for bad |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
shiftleft processes bad values. |
521
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
=cut |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
*shiftleft = \&PDL::shiftleft; |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
=head2 shiftright |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
=for sig |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=for ref |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
rightshift C<$a> by C<$b> |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
=for example |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
$c = shiftright $x, $y, 0; # explicit call with trailing 0 |
550
|
|
|
|
|
|
|
$c = $x >> $y; # overloaded call |
551
|
|
|
|
|
|
|
$x->inplace->shiftright($y,0); # modify $x inplace |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
554
|
|
|
|
|
|
|
This function is used to overload the binary CE> operator. |
555
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
556
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
557
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=for bad |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
shiftright processes bad values. |
564
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=cut |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
*shiftright = \&PDL::shiftright; |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
=head2 or2 |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=for sig |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=for ref |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
binary I of two piddles |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
=for example |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
$c = or2 $x, $y, 0; # explicit call with trailing 0 |
593
|
|
|
|
|
|
|
$c = $x | $y; # overloaded call |
594
|
|
|
|
|
|
|
$x->inplace->or2($y,0); # modify $x inplace |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
597
|
|
|
|
|
|
|
This function is used to overload the binary C<|> operator. |
598
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
599
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
600
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
=for bad |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
or2 processes bad values. |
607
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
=cut |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
*or2 = \&PDL::or2; |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=head2 and2 |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
=for sig |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
=for ref |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
binary I of two piddles |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
=for example |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
$c = and2 $x, $y, 0; # explicit call with trailing 0 |
636
|
|
|
|
|
|
|
$c = $x & $y; # overloaded call |
637
|
|
|
|
|
|
|
$x->inplace->and2($y,0); # modify $x inplace |
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
640
|
|
|
|
|
|
|
This function is used to overload the binary C<&> operator. |
641
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
642
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
643
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
=for bad |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
and2 processes bad values. |
650
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
=cut |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
*and2 = \&PDL::and2; |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
=head2 xor |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
=for sig |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
=for ref |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
binary I of two piddles |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
=for example |
677
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
$c = xor $x, $y, 0; # explicit call with trailing 0 |
679
|
|
|
|
|
|
|
$c = $x ^ $y; # overloaded call |
680
|
|
|
|
|
|
|
$x->inplace->xor($y,0); # modify $x inplace |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
683
|
|
|
|
|
|
|
This function is used to overload the binary C<^> operator. |
684
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
685
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
686
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
=for bad |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
xor processes bad values. |
693
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
=cut |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
*xor = \&PDL::xor; |
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
=head2 bitnot |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
=for sig |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
714
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
=for ref |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
unary bit negation |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
=for example |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
$y = ~ $x; |
722
|
|
|
|
|
|
|
$x->inplace->bitnot; # modify $x inplace |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
725
|
|
|
|
|
|
|
This function is used to overload the unary C<~> operator/function. |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
=for bad |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
bitnot processes bad values. |
732
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
=cut |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
*bitnot = \&PDL::bitnot; |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=head2 power |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=for sig |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=for ref |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
raise piddle C<$a> to the power C<$b> |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
=for example |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
$c = $x->power($y,0); # explicit function call |
761
|
|
|
|
|
|
|
$c = $a ** $b; # overloaded use |
762
|
|
|
|
|
|
|
$x->inplace->power($y,0); # modify $x inplace |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
765
|
|
|
|
|
|
|
This function is used to overload the binary C<**> function. |
766
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
767
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
768
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=for bad |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
power processes bad values. |
775
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=cut |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
|
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
*power = \&PDL::power; |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
=head2 atan2 |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
=for sig |
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
=for ref |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
elementwise C of two piddles |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
=for example |
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
$c = $x->atan2($y,0); # explicit function call |
804
|
|
|
|
|
|
|
$c = atan2 $a, $b; # overloaded use |
805
|
|
|
|
|
|
|
$x->inplace->atan2($y,0); # modify $x inplace |
806
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
808
|
|
|
|
|
|
|
This function is used to overload the binary C function. |
809
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
810
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
811
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
812
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
=for bad |
816
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
atan2 processes bad values. |
818
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
=cut |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
*atan2 = \&PDL::atan2; |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
=head2 modulo |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
=for sig |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
=for ref |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
elementwise C operation |
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
=for example |
845
|
|
|
|
|
|
|
|
846
|
|
|
|
|
|
|
$c = $x->modulo($y,0); # explicit function call |
847
|
|
|
|
|
|
|
$c = $a % $b; # overloaded use |
848
|
|
|
|
|
|
|
$x->inplace->modulo($y,0); # modify $x inplace |
849
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
851
|
|
|
|
|
|
|
This function is used to overload the binary C<%> function. |
852
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
853
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
854
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
=for bad |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
modulo processes bad values. |
861
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
=cut |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
*modulo = \&PDL::modulo; |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
=head2 spaceship |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
=for sig |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
Signature: (a(); b(); [o]c(); int swap) |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
=for ref |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
elementwise "<=>" operation |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
=for example |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
$c = $x->spaceship($y,0); # explicit function call |
890
|
|
|
|
|
|
|
$c = $a <=> $b; # overloaded use |
891
|
|
|
|
|
|
|
$x->inplace->spaceship($y,0); # modify $x inplace |
892
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
894
|
|
|
|
|
|
|
This function is used to overload the binary C=E> function. |
895
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
896
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
897
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
=for bad |
902
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
spaceship processes bad values. |
904
|
|
|
|
|
|
|
The state of the bad-value flag of the output piddles is unknown. |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
=cut |
908
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
*spaceship = \&PDL::spaceship; |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
=head2 sqrt |
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
=for sig |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
=for ref |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
elementwise square root |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
=for example |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
$y = sqrt $x; |
933
|
|
|
|
|
|
|
$x->inplace->sqrt; # modify $x inplace |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
936
|
|
|
|
|
|
|
This function is used to overload the unary C operator/function. |
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
=for bad |
941
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
sqrt processes bad values. |
943
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
=cut |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
*sqrt = \&PDL::sqrt; |
954
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
=head2 sin |
960
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
=for sig |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
964
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
=for ref |
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
the sin function |
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
=for example |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
$y = sin $x; |
972
|
|
|
|
|
|
|
$x->inplace->sin; # modify $x inplace |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
975
|
|
|
|
|
|
|
This function is used to overload the unary C operator/function. |
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
=for bad |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
sin processes bad values. |
982
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
=cut |
986
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
*sin = \&PDL::sin; |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
|
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
=head2 cos |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
=for sig |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
=for ref |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
the cos function |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
=for example |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
$y = cos $x; |
1011
|
|
|
|
|
|
|
$x->inplace->cos; # modify $x inplace |
1012
|
|
|
|
|
|
|
|
1013
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
1014
|
|
|
|
|
|
|
This function is used to overload the unary C operator/function. |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
|
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
=for bad |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
cos processes bad values. |
1021
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1022
|
|
|
|
|
|
|
|
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
=cut |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
|
1031
|
|
|
|
|
|
|
*cos = \&PDL::cos; |
1032
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
|
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
=head2 not |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
=for sig |
1040
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
=for ref |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
the elementwise I operation |
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
=for example |
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
$y = ! $x; |
1050
|
|
|
|
|
|
|
$x->inplace->not; # modify $x inplace |
1051
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
1053
|
|
|
|
|
|
|
This function is used to overload the unary C operator/function. |
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
=for bad |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
not processes bad values. |
1060
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
=cut |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
|
1070
|
|
|
|
|
|
|
*not = \&PDL::not; |
1071
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
|
1076
|
|
|
|
|
|
|
=head2 exp |
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
=for sig |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
=for ref |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
the exponential function |
1085
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
=for example |
1087
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
$y = exp $x; |
1089
|
|
|
|
|
|
|
$x->inplace->exp; # modify $x inplace |
1090
|
|
|
|
|
|
|
|
1091
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
1092
|
|
|
|
|
|
|
This function is used to overload the unary C operator/function. |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
|
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
=for bad |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
exp processes bad values. |
1099
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1100
|
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
=cut |
1103
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
|
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
*exp = \&PDL::exp; |
1110
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
|
1113
|
|
|
|
|
|
|
|
1114
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
=head2 log |
1116
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
=for sig |
1118
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
1120
|
|
|
|
|
|
|
|
1121
|
|
|
|
|
|
|
=for ref |
1122
|
|
|
|
|
|
|
|
1123
|
|
|
|
|
|
|
the natural logarithm |
1124
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
=for example |
1126
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
$y = log $x; |
1128
|
|
|
|
|
|
|
$x->inplace->log; # modify $x inplace |
1129
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
1131
|
|
|
|
|
|
|
This function is used to overload the unary C operator/function. |
1132
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
=for bad |
1136
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
log processes bad values. |
1138
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
=cut |
1142
|
|
|
|
|
|
|
|
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
|
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
*log = \&PDL::log; |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
|
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
=head2 log10 |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
=for sig |
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
=for ref |
1161
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
the base 10 logarithm |
1163
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
=for example |
1165
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
$y = log10 $x; |
1167
|
|
|
|
|
|
|
$x->inplace->log10; # modify $x inplace |
1168
|
|
|
|
|
|
|
|
1169
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
1170
|
|
|
|
|
|
|
This function is used to overload the unary C operator/function. |
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
=for bad |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
log10 processes bad values. |
1177
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1178
|
|
|
|
|
|
|
|
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=cut |
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
|
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
sub PDL::log10 { |
1187
|
11
|
|
|
11
|
0
|
1015
|
my $x = shift; |
1188
|
11
|
100
|
|
|
|
56
|
if ( ! UNIVERSAL::isa($x,"PDL") ) { return log($x) / log(10); } |
|
2
|
|
|
|
|
17
|
|
1189
|
9
|
|
|
|
|
22
|
my $y; |
1190
|
9
|
100
|
|
|
|
59
|
if ( $x->is_inplace ) { $x->set_inplace(0); $y = $x; } |
|
2
|
100
|
|
|
|
8
|
|
|
2
|
|
|
|
|
4
|
|
1191
|
|
|
|
|
|
|
elsif( ref($x) eq "PDL"){ |
1192
|
|
|
|
|
|
|
#PDL Objects, use nullcreate: |
1193
|
6
|
|
|
|
|
21
|
$y = PDL->nullcreate($x); |
1194
|
|
|
|
|
|
|
}else{ |
1195
|
|
|
|
|
|
|
#PDL-Derived Object, use copy: (Consistent with |
1196
|
|
|
|
|
|
|
# Auto-creation docs in Objects.pod) |
1197
|
1
|
|
|
|
|
4
|
$y = $x->copy; |
1198
|
|
|
|
|
|
|
} |
1199
|
9
|
|
|
|
|
174
|
&PDL::_log10_int( $x, $y ); |
1200
|
9
|
|
|
|
|
52
|
return $y; |
1201
|
|
|
|
|
|
|
}; |
1202
|
|
|
|
|
|
|
|
1203
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
*log10 = \&PDL::log10; |
1205
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
|
1209
|
|
|
|
|
|
|
|
1210
|
|
|
|
|
|
|
=head2 assgn |
1211
|
|
|
|
|
|
|
|
1212
|
|
|
|
|
|
|
=for sig |
1213
|
|
|
|
|
|
|
|
1214
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
1215
|
|
|
|
|
|
|
|
1216
|
|
|
|
|
|
|
=for ref |
1217
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
Plain numerical assignment. This is used to implement the ".=" operator |
1219
|
|
|
|
|
|
|
|
1220
|
|
|
|
|
|
|
=for bad |
1221
|
|
|
|
|
|
|
|
1222
|
|
|
|
|
|
|
If C is a child piddle (e.g., the result of a slice) and bad values are generated in C, |
1223
|
|
|
|
|
|
|
the bad value flag is set in C, but it is B automatically propagated back to the parent of C. |
1224
|
|
|
|
|
|
|
The following idiom ensures that the badflag is propagated back to the parent of C: |
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
$pdl->slice(":,(1)") .= PDL::Bad_aware_func(); |
1227
|
|
|
|
|
|
|
$pdl->badflag(1); |
1228
|
|
|
|
|
|
|
$pdl->check_badflag(); |
1229
|
|
|
|
|
|
|
|
1230
|
|
|
|
|
|
|
This is unnecessary if $pdl->badflag is known to be 1 before the slice is performed. |
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
See http://pdl.perl.org/PDLdocs/BadValues.html#dataflow_of_the_badflag for details. |
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
=cut |
1235
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
|
1239
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
|
1241
|
|
|
|
|
|
|
*assgn = \&PDL::assgn; |
1242
|
|
|
|
|
|
|
|
1243
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
|
1245
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
=head2 carg |
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
=for sig |
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
Signature: (a(); double [o] b()) |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
=for ref |
1254
|
|
|
|
|
|
|
|
1255
|
|
|
|
|
|
|
Returns the polar angle of a complex number. |
1256
|
|
|
|
|
|
|
|
1257
|
|
|
|
|
|
|
=for bad |
1258
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
carg processes bad values. |
1260
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1261
|
|
|
|
|
|
|
|
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
=cut |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
|
1270
|
|
|
|
|
|
|
*carg = \&PDL::carg; |
1271
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
|
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
=head2 conj |
1277
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
=for sig |
1279
|
|
|
|
|
|
|
|
1280
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
1281
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
=for ref |
1283
|
|
|
|
|
|
|
|
1284
|
|
|
|
|
|
|
complex conjugate. |
1285
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
=for bad |
1287
|
|
|
|
|
|
|
|
1288
|
|
|
|
|
|
|
conj processes bad values. |
1289
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1290
|
|
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
=cut |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
|
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
*conj = \&PDL::conj; |
1300
|
|
|
|
|
|
|
|
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
|
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
|
1305
|
|
|
|
|
|
|
=head2 creal |
1306
|
|
|
|
|
|
|
|
1307
|
|
|
|
|
|
|
=for sig |
1308
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
Signature: (a(); double [o] b()) |
1310
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
=for ref |
1312
|
|
|
|
|
|
|
|
1313
|
|
|
|
|
|
|
Returns the real part of a complex number. |
1314
|
|
|
|
|
|
|
|
1315
|
|
|
|
|
|
|
=for bad |
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
creal processes bad values. |
1318
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1319
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
|
1321
|
|
|
|
|
|
|
=cut |
1322
|
|
|
|
|
|
|
|
1323
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
|
1327
|
|
|
|
|
|
|
|
1328
|
|
|
|
|
|
|
*creal = \&PDL::creal; |
1329
|
|
|
|
|
|
|
|
1330
|
|
|
|
|
|
|
|
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
|
1334
|
|
|
|
|
|
|
=head2 cimag |
1335
|
|
|
|
|
|
|
|
1336
|
|
|
|
|
|
|
=for sig |
1337
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
Signature: (a(); double [o]b()) |
1339
|
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
|
=for ref |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
Returns the imaginary part of a complex number. |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
=for bad |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
cimag processes bad values. |
1347
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1348
|
|
|
|
|
|
|
|
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
=cut |
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
|
1353
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
|
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
|
1357
|
|
|
|
|
|
|
*cimag = \&PDL::cimag; |
1358
|
|
|
|
|
|
|
|
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
|
1363
|
|
|
|
|
|
|
=head2 ci |
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
=for sig |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
Signature: (cdouble [o]b()) |
1368
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
Returns the complex number 0 + 1i. |
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
B because this is not defined as a constant (with empty |
1372
|
|
|
|
|
|
|
prototype), you must use it either as C<10*ci> or C. If you |
1373
|
|
|
|
|
|
|
use it as C this will actually try to use 10 as a glob and pass |
1374
|
|
|
|
|
|
|
that to C, which will not do what you want. |
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
|
1377
|
|
|
|
|
|
|
=for bad |
1378
|
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
|
ci processes bad values. |
1380
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1381
|
|
|
|
|
|
|
|
1382
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
=cut |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
|
1387
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
*ci = \&PDL::ci; |
1391
|
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
|
1396
|
|
|
|
|
|
|
=head2 ipow |
1397
|
|
|
|
|
|
|
|
1398
|
|
|
|
|
|
|
=for sig |
1399
|
|
|
|
|
|
|
|
1400
|
|
|
|
|
|
|
Signature: (a(); b(); [o] ans()) |
1401
|
|
|
|
|
|
|
|
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
=for ref |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
raise piddle C<$a> to integer power C<$b> |
1406
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
=for example |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
$c = $x->ipow($y,0); # explicit function call |
1410
|
|
|
|
|
|
|
$c = ipow $x, $y; |
1411
|
|
|
|
|
|
|
$x->inplace->ipow($y,0); # modify $x inplace |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
It can be made to work inplace with the C<$x-Einplace> syntax. |
1414
|
|
|
|
|
|
|
Note that when calling this function explicitly you need to supply |
1415
|
|
|
|
|
|
|
a third argument that should generally be zero (see first example). |
1416
|
|
|
|
|
|
|
This restriction is expected to go away in future releases. |
1417
|
|
|
|
|
|
|
|
1418
|
|
|
|
|
|
|
Algorithm from L |
1419
|
|
|
|
|
|
|
|
1420
|
|
|
|
|
|
|
|
1421
|
|
|
|
|
|
|
|
1422
|
|
|
|
|
|
|
=for bad |
1423
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
ipow does not process bad values. |
1425
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1426
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
|
=cut |
1429
|
|
|
|
|
|
|
|
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
|
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
*ipow = \&PDL::ipow; |
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
|
1438
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
|
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
=head2 _rabs |
1442
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
=for sig |
1444
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
Signature: (a(); [o]b()) |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
=for ref |
1448
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
Returns the absolute value of a number. |
1450
|
|
|
|
|
|
|
|
1451
|
|
|
|
|
|
|
=for bad |
1452
|
|
|
|
|
|
|
|
1453
|
|
|
|
|
|
|
_rabs processes bad values. |
1454
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1455
|
|
|
|
|
|
|
|
1456
|
|
|
|
|
|
|
|
1457
|
|
|
|
|
|
|
=cut |
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
|
1460
|
|
|
|
|
|
|
|
1461
|
|
|
|
|
|
|
|
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
|
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
|
1466
|
|
|
|
|
|
|
|
1467
|
|
|
|
|
|
|
|
1468
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
=head2 _cabs |
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
=for sig |
1472
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
Signature: (a(); double [o] b()) |
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
=for ref |
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
Returns the absolute (length) of a complex number. |
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
=for bad |
1480
|
|
|
|
|
|
|
|
1481
|
|
|
|
|
|
|
_cabs processes bad values. |
1482
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1483
|
|
|
|
|
|
|
|
1484
|
|
|
|
|
|
|
|
1485
|
|
|
|
|
|
|
=cut |
1486
|
|
|
|
|
|
|
|
1487
|
|
|
|
|
|
|
|
1488
|
|
|
|
|
|
|
|
1489
|
|
|
|
|
|
|
|
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
|
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
|
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
sub PDL::abs { |
1497
|
533
|
|
|
533
|
0
|
1426
|
my $x=shift; |
1498
|
533
|
|
|
|
|
813
|
my $ret; |
1499
|
533
|
100
|
66
|
|
|
1812
|
if ($x->type eq 'cdouble' or $x->type eq 'cfloat') { |
1500
|
9
|
|
|
|
|
181
|
$ret=PDL::_cabs($x); |
1501
|
|
|
|
|
|
|
} else { |
1502
|
524
|
|
|
|
|
98324
|
$ret=PDL::_rabs($x); |
1503
|
|
|
|
|
|
|
} |
1504
|
533
|
|
|
|
|
102005
|
$ret; |
1505
|
|
|
|
|
|
|
} |
1506
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
|
1508
|
|
|
|
|
|
|
|
1509
|
|
|
|
|
|
|
; |
1510
|
|
|
|
|
|
|
|
1511
|
|
|
|
|
|
|
|
1512
|
|
|
|
|
|
|
=head1 AUTHOR |
1513
|
|
|
|
|
|
|
|
1514
|
|
|
|
|
|
|
Tuomas J. Lukka (lukka@fas.harvard.edu), |
1515
|
|
|
|
|
|
|
Karl Glazebrook (kgb@aaoepp.aao.gov.au), |
1516
|
|
|
|
|
|
|
Doug Hunt (dhunt@ucar.edu), |
1517
|
|
|
|
|
|
|
Christian Soeller (c.soeller@auckland.ac.nz), |
1518
|
|
|
|
|
|
|
Doug Burke (burke@ifa.hawaii.edu), |
1519
|
|
|
|
|
|
|
and Craig DeForest (deforest@boulder.swri.edu). |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
=cut |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
|
1524
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
|
1526
|
|
|
|
|
|
|
|
1527
|
|
|
|
|
|
|
# Exit with OK status |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
1; |
1530
|
|
|
|
|
|
|
|
1531
|
|
|
|
|
|
|
|