line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# GENERATED WITH PDLA::PP! Don't modify! |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
package PDLA::Ufunc; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
@EXPORT_OK = qw( PDLA::PP prodover PDLA::PP dprodover PDLA::PP cumuprodover PDLA::PP dcumuprodover PDLA::PP sumover PDLA::PP dsumover PDLA::PP cumusumover PDLA::PP dcumusumover PDLA::PP andover PDLA::PP bandover PDLA::PP borover PDLA::PP orover PDLA::PP zcover PDLA::PP intover PDLA::PP average PDLA::PP avgover PDLA::PP daverage PDLA::PP davgover PDLA::PP medover PDLA::PP oddmedover PDLA::PP modeover PDLA::PP pctover PDLA::PP oddpctover pct oddpct avg sum prod davg dsum dprod zcheck and band or bor min max median mode oddmedian any all minmax PDLA::PP qsort PDLA::PP qsorti PDLA::PP qsortvec PDLA::PP qsortveci PDLA::PP minimum PDLA::PP minimum_ind PDLA::PP minimum_n_ind PDLA::PP maximum PDLA::PP maximum_ind PDLA::PP maximum_n_ind PDLA::PP maxover PDLA::PP maxover_ind PDLA::PP maxover_n_ind PDLA::PP minover PDLA::PP minover_ind PDLA::PP minover_n_ind PDLA::PP minmaximum PDLA::PP minmaxover ); |
8
|
|
|
|
|
|
|
%EXPORT_TAGS = (Func=>[@EXPORT_OK]); |
9
|
|
|
|
|
|
|
|
10
|
78
|
|
|
78
|
|
599
|
use PDLA::Core; |
|
78
|
|
|
|
|
170
|
|
|
78
|
|
|
|
|
589
|
|
11
|
78
|
|
|
78
|
|
600
|
use PDLA::Exporter; |
|
78
|
|
|
|
|
196
|
|
|
78
|
|
|
|
|
458
|
|
12
|
78
|
|
|
78
|
|
442
|
use DynaLoader; |
|
78
|
|
|
|
|
190
|
|
|
78
|
|
|
|
|
4603
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
@ISA = ( 'PDLA::Exporter','DynaLoader' ); |
18
|
|
|
|
|
|
|
push @PDLA::Core::PP, __PACKAGE__; |
19
|
|
|
|
|
|
|
bootstrap PDLA::Ufunc ; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
PDLA::Ufunc - primitive ufunc operations for pdl |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This module provides some primitive and useful functions defined |
32
|
|
|
|
|
|
|
using PDLA::PP based on functionality of what are sometimes called |
33
|
|
|
|
|
|
|
I (for example NumPY and Mathematica talk about these). |
34
|
|
|
|
|
|
|
It collects all the functions generally used to C or |
35
|
|
|
|
|
|
|
C along a dimension. These all do their job across the |
36
|
|
|
|
|
|
|
first dimension but by using the slicing functions you can do it |
37
|
|
|
|
|
|
|
on any dimension. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
The L module provides an alternative interface |
40
|
|
|
|
|
|
|
to many of the functions in this module. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use PDLA::Ufunc; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
78
|
|
|
78
|
|
527
|
use PDLA::Slices; |
|
78
|
|
|
|
|
193
|
|
|
78
|
|
|
|
|
606
|
|
49
|
78
|
|
|
78
|
|
605
|
use Carp; |
|
78
|
|
|
|
|
185
|
|
|
78
|
|
|
|
|
152549
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 FUNCTIONS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 prodover |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=for sig |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Signature: (a(n); int+ [o]b()) |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=for ref |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Project via product to N-1 dimensions |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
79
|
|
|
|
|
|
|
by one by taking the product along the 1st dimension. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
By using L etc. it is possible to use |
82
|
|
|
|
|
|
|
I dimension. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=for usage |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$y = prodover($x); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=for example |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$spectrum = prodover $image->xchg(0,1) |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=for bad |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
prodover processes bad values. |
99
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
*prodover = \&PDLA::prodover; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 dprodover |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=for sig |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Signature: (a(n); double [o]b()) |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=for ref |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Project via product to N-1 dimensions |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
127
|
|
|
|
|
|
|
by one by taking the product along the 1st dimension. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
By using L etc. it is possible to use |
130
|
|
|
|
|
|
|
I dimension. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=for usage |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$y = dprodover($x); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=for example |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$spectrum = dprodover $image->xchg(0,1) |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Unlike L, the calculations are performed in double |
141
|
|
|
|
|
|
|
precision. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=for bad |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
dprodover processes bad values. |
148
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
*dprodover = \&PDLA::dprodover; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 cumuprodover |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=for sig |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Signature: (a(n); int+ [o]b(n)) |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=for ref |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Cumulative product |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
This function calculates the cumulative product |
176
|
|
|
|
|
|
|
along the 1st dimension. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
By using L etc. it is possible to use |
179
|
|
|
|
|
|
|
I dimension. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
The sum is started so that the first element in the cumulative product |
182
|
|
|
|
|
|
|
is the first element of the parameter. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=for usage |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
$y = cumuprodover($x); |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=for example |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
$spectrum = cumuprodover $image->xchg(0,1) |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=for bad |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
cumuprodover processes bad values. |
199
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=cut |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
*cumuprodover = \&PDLA::cumuprodover; |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head2 dcumuprodover |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=for sig |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Signature: (a(n); double [o]b(n)) |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=for ref |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Cumulative product |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
This function calculates the cumulative product |
227
|
|
|
|
|
|
|
along the 1st dimension. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
By using L etc. it is possible to use |
230
|
|
|
|
|
|
|
I dimension. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
The sum is started so that the first element in the cumulative product |
233
|
|
|
|
|
|
|
is the first element of the parameter. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=for usage |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
$y = cumuprodover($x); |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=for example |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
$spectrum = cumuprodover $image->xchg(0,1) |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
Unlike L, the calculations are performed in double |
244
|
|
|
|
|
|
|
precision. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=for bad |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
dcumuprodover processes bad values. |
251
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=cut |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
*dcumuprodover = \&PDLA::dcumuprodover; |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head2 sumover |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=for sig |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Signature: (a(n); int+ [o]b()) |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=for ref |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Project via sum to N-1 dimensions |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
279
|
|
|
|
|
|
|
by one by taking the sum along the 1st dimension. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
By using L etc. it is possible to use |
282
|
|
|
|
|
|
|
I dimension. |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=for usage |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
$y = sumover($x); |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=for example |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
$spectrum = sumover $image->xchg(0,1) |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=for bad |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
sumover processes bad values. |
299
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=cut |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
*sumover = \&PDLA::sumover; |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head2 dsumover |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=for sig |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
Signature: (a(n); double [o]b()) |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=for ref |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
Project via sum to N-1 dimensions |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
327
|
|
|
|
|
|
|
by one by taking the sum along the 1st dimension. |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
By using L etc. it is possible to use |
330
|
|
|
|
|
|
|
I dimension. |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=for usage |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
$y = dsumover($x); |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=for example |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
$spectrum = dsumover $image->xchg(0,1) |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
Unlike L, the calculations are performed in double |
341
|
|
|
|
|
|
|
precision. |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=for bad |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
dsumover processes bad values. |
348
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=cut |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
*dsumover = \&PDLA::dsumover; |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
=head2 cumusumover |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
=for sig |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
Signature: (a(n); int+ [o]b(n)) |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=for ref |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
Cumulative sum |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
This function calculates the cumulative sum |
376
|
|
|
|
|
|
|
along the 1st dimension. |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
By using L etc. it is possible to use |
379
|
|
|
|
|
|
|
I dimension. |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
The sum is started so that the first element in the cumulative sum |
382
|
|
|
|
|
|
|
is the first element of the parameter. |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=for usage |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
$y = cumusumover($x); |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=for example |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
$spectrum = cumusumover $image->xchg(0,1) |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=for bad |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
cumusumover processes bad values. |
399
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=cut |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
*cumusumover = \&PDLA::cumusumover; |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=head2 dcumusumover |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=for sig |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
Signature: (a(n); double [o]b(n)) |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=for ref |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
Cumulative sum |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
This function calculates the cumulative sum |
427
|
|
|
|
|
|
|
along the 1st dimension. |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
By using L etc. it is possible to use |
430
|
|
|
|
|
|
|
I dimension. |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
The sum is started so that the first element in the cumulative sum |
433
|
|
|
|
|
|
|
is the first element of the parameter. |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=for usage |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
$y = cumusumover($x); |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=for example |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
$spectrum = cumusumover $image->xchg(0,1) |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
Unlike L, the calculations are performed in double |
444
|
|
|
|
|
|
|
precision. |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=for bad |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
dcumusumover processes bad values. |
451
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=cut |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
*dcumusumover = \&PDLA::dcumusumover; |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
=head2 andover |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=for sig |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
Signature: (a(n); int+ [o]b()) |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=for ref |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
Project via and to N-1 dimensions |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
479
|
|
|
|
|
|
|
by one by taking the and along the 1st dimension. |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
By using L etc. it is possible to use |
482
|
|
|
|
|
|
|
I dimension. |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=for usage |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
$y = andover($x); |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
=for example |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
$spectrum = andover $image->xchg(0,1) |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=for bad |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
If C contains only bad data (and its bad flag is set), |
499
|
|
|
|
|
|
|
C is set bad. Otherwise C will have its bad flag cleared, |
500
|
|
|
|
|
|
|
as it will not contain any bad values. |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=cut |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
*andover = \&PDLA::andover; |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
=head2 bandover |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=for sig |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
Signature: (a(n); [o]b()) |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
=for ref |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
Project via bitwise and to N-1 dimensions |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
527
|
|
|
|
|
|
|
by one by taking the bitwise and along the 1st dimension. |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
By using L etc. it is possible to use |
530
|
|
|
|
|
|
|
I dimension. |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=for usage |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
$y = bandover($x); |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=for example |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
$spectrum = bandover $image->xchg(0,1) |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
=for bad |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
If C contains only bad data (and its bad flag is set), |
547
|
|
|
|
|
|
|
C is set bad. Otherwise C will have its bad flag cleared, |
548
|
|
|
|
|
|
|
as it will not contain any bad values. |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
=cut |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
*bandover = \&PDLA::bandover; |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=head2 borover |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=for sig |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
Signature: (a(n); [o]b()) |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
=for ref |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
Project via bitwise or to N-1 dimensions |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
575
|
|
|
|
|
|
|
by one by taking the bitwise or along the 1st dimension. |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
By using L etc. it is possible to use |
578
|
|
|
|
|
|
|
I dimension. |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
=for usage |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
$y = borover($x); |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
=for example |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
$spectrum = borover $image->xchg(0,1) |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
=for bad |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
If C contains only bad data (and its bad flag is set), |
595
|
|
|
|
|
|
|
C is set bad. Otherwise C will have its bad flag cleared, |
596
|
|
|
|
|
|
|
as it will not contain any bad values. |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
=cut |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
*borover = \&PDLA::borover; |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
=head2 orover |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
=for sig |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
Signature: (a(n); int+ [o]b()) |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
=for ref |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
Project via or to N-1 dimensions |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
623
|
|
|
|
|
|
|
by one by taking the or along the 1st dimension. |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
By using L etc. it is possible to use |
626
|
|
|
|
|
|
|
I dimension. |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
=for usage |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
$y = orover($x); |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
=for example |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
$spectrum = orover $image->xchg(0,1) |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
=for bad |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
If C contains only bad data (and its bad flag is set), |
643
|
|
|
|
|
|
|
C is set bad. Otherwise C will have its bad flag cleared, |
644
|
|
|
|
|
|
|
as it will not contain any bad values. |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=cut |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
*orover = \&PDLA::orover; |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
=head2 zcover |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
=for sig |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
Signature: (a(n); int+ [o]b()) |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
=for ref |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
Project via == 0 to N-1 dimensions |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
671
|
|
|
|
|
|
|
by one by taking the == 0 along the 1st dimension. |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
By using L etc. it is possible to use |
674
|
|
|
|
|
|
|
I dimension. |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
=for usage |
677
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
$y = zcover($x); |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
=for example |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
$spectrum = zcover $image->xchg(0,1) |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=for bad |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
If C contains only bad data (and its bad flag is set), |
691
|
|
|
|
|
|
|
C is set bad. Otherwise C will have its bad flag cleared, |
692
|
|
|
|
|
|
|
as it will not contain any bad values. |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=cut |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
*zcover = \&PDLA::zcover; |
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
=head2 intover |
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
=for sig |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
Signature: (a(n); float+ [o]b()) |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
=for ref |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
Project via integral to N-1 dimensions |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
719
|
|
|
|
|
|
|
by one by taking the integral along the 1st dimension. |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
By using L etc. it is possible to use |
722
|
|
|
|
|
|
|
I dimension. |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=for usage |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
$y = intover($x); |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=for example |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
$spectrum = intover $image->xchg(0,1) |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
Notes: |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
C uses a point spacing of one (i.e., delta-h==1). You will |
735
|
|
|
|
|
|
|
need to scale the result to correct for the true point delta). |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
For C 3>, these are all C (like Simpson's rule), but are |
738
|
|
|
|
|
|
|
integrals between the end points assuming the pdl gives values just at |
739
|
|
|
|
|
|
|
these centres: for such `functions', sumover is correct to C, but |
740
|
|
|
|
|
|
|
is the natural (and correct) choice for binned data, of course. |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
=for bad |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
intover ignores the bad-value flag of the input piddles. |
748
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
=cut |
752
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
|
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
*intover = \&PDLA::intover; |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
=head2 average |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
=for sig |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
Signature: (a(n); int+ [o]b()) |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
=for ref |
772
|
|
|
|
|
|
|
|
773
|
|
|
|
|
|
|
Project via average to N-1 dimensions |
774
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
776
|
|
|
|
|
|
|
by one by taking the average along the 1st dimension. |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
By using L etc. it is possible to use |
779
|
|
|
|
|
|
|
I dimension. |
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
=for usage |
782
|
|
|
|
|
|
|
|
783
|
|
|
|
|
|
|
$y = average($x); |
784
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
=for example |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
$spectrum = average $image->xchg(0,1) |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
=for bad |
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
average processes bad values. |
796
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
=cut |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
*average = \&PDLA::average; |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
*PDLA::avgover = \&PDLA::average; |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
*avgover = \&PDLA::average; |
814
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
=head2 avgover |
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
=for ref |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
Synonym for average. |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
=cut |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
=head2 daverage |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
=for sig |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
Signature: (a(n); double [o]b()) |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
=for ref |
836
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
Project via average to N-1 dimensions |
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
840
|
|
|
|
|
|
|
by one by taking the average along the 1st dimension. |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
By using L etc. it is possible to use |
843
|
|
|
|
|
|
|
I dimension. |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
=for usage |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
$y = daverage($x); |
848
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
=for example |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
$spectrum = daverage $image->xchg(0,1) |
852
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
Unlike L, the calculation is performed in double |
854
|
|
|
|
|
|
|
precision. |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
=for bad |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
daverage processes bad values. |
861
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
=cut |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
*daverage = \&PDLA::daverage; |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
*PDLA::davgover = \&PDLA::daverage; |
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
*davgover = \&PDLA::daverage; |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
=head2 davgover |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
=for ref |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
Synonym for daverage. |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
=cut |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
|
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
=head2 medover |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
=for sig |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
Signature: (a(n); [o]b(); [t]tmp(n)) |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
=for ref |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
Project via median to N-1 dimensions |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
905
|
|
|
|
|
|
|
by one by taking the median along the 1st dimension. |
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
By using L etc. it is possible to use |
908
|
|
|
|
|
|
|
I dimension. |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
=for usage |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
$y = medover($x); |
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
=for example |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
$spectrum = medover $image->xchg(0,1) |
917
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
=for bad |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
medover processes bad values. |
925
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
926
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
=cut |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
*medover = \&PDLA::medover; |
936
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
=head2 oddmedover |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
=for sig |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
Signature: (a(n); [o]b(); [t]tmp(n)) |
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
=for ref |
949
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
Project via oddmedian to N-1 dimensions |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
953
|
|
|
|
|
|
|
by one by taking the oddmedian along the 1st dimension. |
954
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
By using L etc. it is possible to use |
956
|
|
|
|
|
|
|
I dimension. |
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
=for usage |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
$y = oddmedover($x); |
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
=for example |
963
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
$spectrum = oddmedover $image->xchg(0,1) |
965
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
The median is sometimes not a good choice as if the array has |
969
|
|
|
|
|
|
|
an even number of elements it lies half-way between the two |
970
|
|
|
|
|
|
|
middle values - thus it does not always correspond to a data |
971
|
|
|
|
|
|
|
value. The lower-odd median is just the lower of these two values |
972
|
|
|
|
|
|
|
and so it ALWAYS sits on an actual data value which is useful in |
973
|
|
|
|
|
|
|
some circumstances. |
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
=for bad |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
oddmedover processes bad values. |
981
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
982
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
=cut |
985
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
*oddmedover = \&PDLA::oddmedover; |
992
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
|
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
=head2 modeover |
998
|
|
|
|
|
|
|
|
999
|
|
|
|
|
|
|
=for sig |
1000
|
|
|
|
|
|
|
|
1001
|
|
|
|
|
|
|
Signature: (data(n); [o]out(); [t]sorted(n)) |
1002
|
|
|
|
|
|
|
|
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
=for ref |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
Project via mode to N-1 dimensions |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
1009
|
|
|
|
|
|
|
by one by taking the mode along the 1st dimension. |
1010
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
By using L etc. it is possible to use |
1012
|
|
|
|
|
|
|
I dimension. |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
=for usage |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
$y = modeover($x); |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
=for example |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
$spectrum = modeover $image->xchg(0,1) |
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
|
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
The mode is the single element most frequently found in a |
1025
|
|
|
|
|
|
|
discrete data set. |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
It I makes sense for integer data types, since |
1028
|
|
|
|
|
|
|
floating-point types are demoted to integer before the |
1029
|
|
|
|
|
|
|
mode is calculated. |
1030
|
|
|
|
|
|
|
|
1031
|
|
|
|
|
|
|
C treats BAD the same as any other value: if |
1032
|
|
|
|
|
|
|
BAD is the most common element, the returned value is also BAD. |
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
|
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
=for bad |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
modeover does not process bad values. |
1040
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1041
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
=cut |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
*modeover = \&PDLA::modeover; |
1051
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
=head2 pctover |
1057
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
=for sig |
1059
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
Signature: (a(n); p(); [o]b(); [t]tmp(n)) |
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
=for ref |
1065
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
Project via percentile to N-1 dimensions |
1067
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle by one by finding |
1069
|
|
|
|
|
|
|
the specified percentile (p) along the 1st dimension. The specified |
1070
|
|
|
|
|
|
|
percentile must be between 0.0 and 1.0. When the specified percentile |
1071
|
|
|
|
|
|
|
falls between data points, the result is interpolated. Values outside |
1072
|
|
|
|
|
|
|
the allowed range are clipped to 0.0 or 1.0 respectively. The algorithm |
1073
|
|
|
|
|
|
|
implemented here is based on the interpolation variant described at |
1074
|
|
|
|
|
|
|
L as used by Microsoft Excel |
1075
|
|
|
|
|
|
|
and recommended by NIST. |
1076
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
By using L etc. it is possible to use |
1078
|
|
|
|
|
|
|
I dimension. |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
=for usage |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
$y = pctover($x, $p); |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
=for example |
1085
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
$spectrum = pctover $image->xchg(0,1), $p |
1087
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
=for bad |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
pctover processes bad values. |
1093
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1094
|
|
|
|
|
|
|
|
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
=cut |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
|
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
*pctover = \&PDLA::pctover; |
1104
|
|
|
|
|
|
|
|
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
=head2 oddpctover |
1110
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
=for sig |
1112
|
|
|
|
|
|
|
|
1113
|
|
|
|
|
|
|
Signature: (a(n); p(); [o]b(); [t]tmp(n)) |
1114
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
Project via percentile to N-1 dimensions |
1118
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle by one by finding |
1120
|
|
|
|
|
|
|
the specified percentile along the 1st dimension. The specified |
1121
|
|
|
|
|
|
|
percentile must be between 0.0 and 1.0. When the specified percentile |
1122
|
|
|
|
|
|
|
falls between two values, the nearest data value is the result. |
1123
|
|
|
|
|
|
|
The algorithm implemented is from the textbook version described |
1124
|
|
|
|
|
|
|
first at L. |
1125
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
By using L etc. it is possible to use |
1127
|
|
|
|
|
|
|
I dimension. |
1128
|
|
|
|
|
|
|
|
1129
|
|
|
|
|
|
|
=for usage |
1130
|
|
|
|
|
|
|
|
1131
|
|
|
|
|
|
|
$y = oddpctover($x, $p); |
1132
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
=for example |
1134
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
$spectrum = oddpctover $image->xchg(0,1), $p |
1136
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
=for bad |
1140
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
oddpctover processes bad values. |
1142
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
|
1145
|
|
|
|
|
|
|
=cut |
1146
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
*oddpctover = \&PDLA::oddpctover; |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
|
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
=head2 pct |
1158
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
=for ref |
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
Return the specified percentile of all elements in a piddle. The |
1162
|
|
|
|
|
|
|
specified percentile (p) must be between 0.0 and 1.0. When the |
1163
|
|
|
|
|
|
|
specified percentile falls between data points, the result is |
1164
|
|
|
|
|
|
|
interpolated. |
1165
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
=for usage |
1167
|
|
|
|
|
|
|
|
1168
|
|
|
|
|
|
|
$x = pct($data, $pct); |
1169
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
=cut |
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
*pct = \&PDLA::pct; |
1173
|
|
|
|
|
|
|
sub PDLA::pct { |
1174
|
3
|
|
|
3
|
0
|
601
|
my($x, $p) = @_; |
1175
|
3
|
|
|
|
|
7
|
my $tmp; |
1176
|
3
|
|
|
|
|
11
|
$x->clump(-1)->pctover($p, $tmp=PDLA->nullcreate($x)); |
1177
|
3
|
|
|
|
|
27
|
return $tmp->at(); |
1178
|
|
|
|
|
|
|
} |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
|
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
=head2 oddpct |
1184
|
|
|
|
|
|
|
|
1185
|
|
|
|
|
|
|
=for ref |
1186
|
|
|
|
|
|
|
|
1187
|
|
|
|
|
|
|
Return the specified percentile of all elements in a piddle. The |
1188
|
|
|
|
|
|
|
specified percentile must be between 0.0 and 1.0. When the specified |
1189
|
|
|
|
|
|
|
percentile falls between two values, the nearest data value is the |
1190
|
|
|
|
|
|
|
result. |
1191
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
=for usage |
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
$x = oddpct($data, $pct); |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
=cut |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
*oddpct = \&PDLA::oddpct; |
1199
|
|
|
|
|
|
|
sub PDLA::oddpct { |
1200
|
4
|
|
|
4
|
0
|
1244
|
my($x, $p) = @_; |
1201
|
4
|
|
|
|
|
6
|
my $tmp; |
1202
|
4
|
|
|
|
|
16
|
$x->clump(-1)->oddpctover($p, $tmp=PDLA->nullcreate($x)); |
1203
|
4
|
|
|
|
|
43
|
return $tmp->at(); |
1204
|
|
|
|
|
|
|
} |
1205
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
|
1209
|
|
|
|
|
|
|
=head2 avg |
1210
|
|
|
|
|
|
|
|
1211
|
|
|
|
|
|
|
=for ref |
1212
|
|
|
|
|
|
|
|
1213
|
|
|
|
|
|
|
Return the average of all elements in a piddle. |
1214
|
|
|
|
|
|
|
|
1215
|
|
|
|
|
|
|
See the documentation for L for more information. |
1216
|
|
|
|
|
|
|
|
1217
|
|
|
|
|
|
|
=for usage |
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
$x = avg($data); |
1220
|
|
|
|
|
|
|
|
1221
|
|
|
|
|
|
|
=cut |
1222
|
|
|
|
|
|
|
|
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
|
1225
|
|
|
|
|
|
|
=for bad |
1226
|
|
|
|
|
|
|
|
1227
|
|
|
|
|
|
|
This routine handles bad values. |
1228
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
=cut |
1230
|
|
|
|
|
|
|
|
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
|
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
*avg = \&PDLA::avg; |
1235
|
|
|
|
|
|
|
sub PDLA::avg { |
1236
|
1
|
|
|
1
|
0
|
3
|
my($x) = @_; my $tmp; |
|
1
|
|
|
|
|
2
|
|
1237
|
1
|
|
|
|
|
4
|
$x->clump(-1)->average( $tmp=PDLA->nullcreate($x) ); |
1238
|
1
|
|
|
|
|
7
|
return $tmp->at(); |
1239
|
|
|
|
|
|
|
} |
1240
|
|
|
|
|
|
|
|
1241
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
|
1243
|
|
|
|
|
|
|
=head2 sum |
1244
|
|
|
|
|
|
|
|
1245
|
|
|
|
|
|
|
=for ref |
1246
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
Return the sum of all elements in a piddle. |
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
See the documentation for L for more information. |
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
=for usage |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
$x = sum($data); |
1254
|
|
|
|
|
|
|
|
1255
|
|
|
|
|
|
|
=cut |
1256
|
|
|
|
|
|
|
|
1257
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
=for bad |
1260
|
|
|
|
|
|
|
|
1261
|
|
|
|
|
|
|
This routine handles bad values. |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
=cut |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
*sum = \&PDLA::sum; |
1269
|
|
|
|
|
|
|
sub PDLA::sum { |
1270
|
75
|
|
|
75
|
0
|
2484
|
my($x) = @_; my $tmp; |
|
75
|
|
|
|
|
186
|
|
1271
|
75
|
|
|
|
|
276
|
$x->clump(-1)->sumover( $tmp=PDLA->nullcreate($x) ); |
1272
|
75
|
|
|
|
|
575
|
return $tmp->at(); |
1273
|
|
|
|
|
|
|
} |
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
=head2 prod |
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
=for ref |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
Return the product of all elements in a piddle. |
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
See the documentation for L for more information. |
1284
|
|
|
|
|
|
|
|
1285
|
|
|
|
|
|
|
=for usage |
1286
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
$x = prod($data); |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
=cut |
1290
|
|
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
=for bad |
1294
|
|
|
|
|
|
|
|
1295
|
|
|
|
|
|
|
This routine handles bad values. |
1296
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
=cut |
1298
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
|
1300
|
|
|
|
|
|
|
|
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
*prod = \&PDLA::prod; |
1303
|
|
|
|
|
|
|
sub PDLA::prod { |
1304
|
0
|
|
|
0
|
0
|
0
|
my($x) = @_; my $tmp; |
|
0
|
|
|
|
|
0
|
|
1305
|
0
|
|
|
|
|
0
|
$x->clump(-1)->prodover( $tmp=PDLA->nullcreate($x) ); |
1306
|
0
|
|
|
|
|
0
|
return $tmp->at(); |
1307
|
|
|
|
|
|
|
} |
1308
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
=head2 davg |
1312
|
|
|
|
|
|
|
|
1313
|
|
|
|
|
|
|
=for ref |
1314
|
|
|
|
|
|
|
|
1315
|
|
|
|
|
|
|
Return the average (in double precision) of all elements in a piddle. |
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
See the documentation for L for more information. |
1318
|
|
|
|
|
|
|
|
1319
|
|
|
|
|
|
|
=for usage |
1320
|
|
|
|
|
|
|
|
1321
|
|
|
|
|
|
|
$x = davg($data); |
1322
|
|
|
|
|
|
|
|
1323
|
|
|
|
|
|
|
=cut |
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
|
1327
|
|
|
|
|
|
|
=for bad |
1328
|
|
|
|
|
|
|
|
1329
|
|
|
|
|
|
|
This routine handles bad values. |
1330
|
|
|
|
|
|
|
|
1331
|
|
|
|
|
|
|
=cut |
1332
|
|
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
|
1334
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
|
1336
|
|
|
|
|
|
|
*davg = \&PDLA::davg; |
1337
|
|
|
|
|
|
|
sub PDLA::davg { |
1338
|
0
|
|
|
0
|
0
|
0
|
my($x) = @_; my $tmp; |
|
0
|
|
|
|
|
0
|
|
1339
|
0
|
|
|
|
|
0
|
$x->clump(-1)->daverage( $tmp=PDLA->nullcreate($x) ); |
1340
|
0
|
|
|
|
|
0
|
return $tmp->at(); |
1341
|
|
|
|
|
|
|
} |
1342
|
|
|
|
|
|
|
|
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
|
1345
|
|
|
|
|
|
|
=head2 dsum |
1346
|
|
|
|
|
|
|
|
1347
|
|
|
|
|
|
|
=for ref |
1348
|
|
|
|
|
|
|
|
1349
|
|
|
|
|
|
|
Return the sum (in double precision) of all elements in a piddle. |
1350
|
|
|
|
|
|
|
|
1351
|
|
|
|
|
|
|
See the documentation for L for more information. |
1352
|
|
|
|
|
|
|
|
1353
|
|
|
|
|
|
|
=for usage |
1354
|
|
|
|
|
|
|
|
1355
|
|
|
|
|
|
|
$x = dsum($data); |
1356
|
|
|
|
|
|
|
|
1357
|
|
|
|
|
|
|
=cut |
1358
|
|
|
|
|
|
|
|
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
=for bad |
1362
|
|
|
|
|
|
|
|
1363
|
|
|
|
|
|
|
This routine handles bad values. |
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
=cut |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
|
1370
|
|
|
|
|
|
|
*dsum = \&PDLA::dsum; |
1371
|
|
|
|
|
|
|
sub PDLA::dsum { |
1372
|
0
|
|
|
0
|
0
|
0
|
my($x) = @_; my $tmp; |
|
0
|
|
|
|
|
0
|
|
1373
|
0
|
|
|
|
|
0
|
$x->clump(-1)->dsumover( $tmp=PDLA->nullcreate($x) ); |
1374
|
0
|
|
|
|
|
0
|
return $tmp->at(); |
1375
|
|
|
|
|
|
|
} |
1376
|
|
|
|
|
|
|
|
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
|
=head2 dprod |
1380
|
|
|
|
|
|
|
|
1381
|
|
|
|
|
|
|
=for ref |
1382
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
Return the product (in double precision) of all elements in a piddle. |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
See the documentation for L for more information. |
1386
|
|
|
|
|
|
|
|
1387
|
|
|
|
|
|
|
=for usage |
1388
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
$x = dprod($data); |
1390
|
|
|
|
|
|
|
|
1391
|
|
|
|
|
|
|
=cut |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
=for bad |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
This routine handles bad values. |
1398
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
=cut |
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
|
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
|
1404
|
|
|
|
|
|
|
*dprod = \&PDLA::dprod; |
1405
|
|
|
|
|
|
|
sub PDLA::dprod { |
1406
|
0
|
|
|
0
|
0
|
0
|
my($x) = @_; my $tmp; |
|
0
|
|
|
|
|
0
|
|
1407
|
0
|
|
|
|
|
0
|
$x->clump(-1)->dprodover( $tmp=PDLA->nullcreate($x) ); |
1408
|
0
|
|
|
|
|
0
|
return $tmp->at(); |
1409
|
|
|
|
|
|
|
} |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
|
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
=head2 zcheck |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
=for ref |
1416
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
Return the check for zero of all elements in a piddle. |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
See the documentation for L for more information. |
1420
|
|
|
|
|
|
|
|
1421
|
|
|
|
|
|
|
=for usage |
1422
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
$x = zcheck($data); |
1424
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
=cut |
1426
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
=for bad |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
This routine handles bad values. |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
=cut |
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
|
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
|
1438
|
|
|
|
|
|
|
*zcheck = \&PDLA::zcheck; |
1439
|
|
|
|
|
|
|
sub PDLA::zcheck { |
1440
|
8
|
|
|
8
|
0
|
30
|
my($x) = @_; my $tmp; |
|
8
|
|
|
|
|
13
|
|
1441
|
8
|
|
|
|
|
31
|
$x->clump(-1)->zcover( $tmp=PDLA->nullcreate($x) ); |
1442
|
8
|
|
|
|
|
67
|
return $tmp->at(); |
1443
|
|
|
|
|
|
|
} |
1444
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
|
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
=head2 and |
1448
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
=for ref |
1450
|
|
|
|
|
|
|
|
1451
|
|
|
|
|
|
|
Return the logical and of all elements in a piddle. |
1452
|
|
|
|
|
|
|
|
1453
|
|
|
|
|
|
|
See the documentation for L for more information. |
1454
|
|
|
|
|
|
|
|
1455
|
|
|
|
|
|
|
=for usage |
1456
|
|
|
|
|
|
|
|
1457
|
|
|
|
|
|
|
$x = and($data); |
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
=cut |
1460
|
|
|
|
|
|
|
|
1461
|
|
|
|
|
|
|
|
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
=for bad |
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
This routine handles bad values. |
1466
|
|
|
|
|
|
|
|
1467
|
|
|
|
|
|
|
=cut |
1468
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
|
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
|
1472
|
|
|
|
|
|
|
*and = \&PDLA::and; |
1473
|
|
|
|
|
|
|
sub PDLA::and { |
1474
|
361
|
|
|
361
|
1
|
17097
|
my($x) = @_; my $tmp; |
|
361
|
|
|
|
|
538
|
|
1475
|
361
|
|
|
|
|
1177
|
$x->clump(-1)->andover( $tmp=PDLA->nullcreate($x) ); |
1476
|
361
|
|
|
|
|
2703
|
return $tmp->at(); |
1477
|
|
|
|
|
|
|
} |
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
|
1480
|
|
|
|
|
|
|
|
1481
|
|
|
|
|
|
|
=head2 band |
1482
|
|
|
|
|
|
|
|
1483
|
|
|
|
|
|
|
=for ref |
1484
|
|
|
|
|
|
|
|
1485
|
|
|
|
|
|
|
Return the bitwise and of all elements in a piddle. |
1486
|
|
|
|
|
|
|
|
1487
|
|
|
|
|
|
|
See the documentation for L for more information. |
1488
|
|
|
|
|
|
|
|
1489
|
|
|
|
|
|
|
=for usage |
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
$x = band($data); |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
=cut |
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
=for bad |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
This routine handles bad values. |
1500
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
=cut |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
|
1504
|
|
|
|
|
|
|
|
1505
|
|
|
|
|
|
|
|
1506
|
|
|
|
|
|
|
*band = \&PDLA::band; |
1507
|
|
|
|
|
|
|
sub PDLA::band { |
1508
|
0
|
|
|
0
|
0
|
0
|
my($x) = @_; my $tmp; |
|
0
|
|
|
|
|
0
|
|
1509
|
0
|
|
|
|
|
0
|
$x->clump(-1)->bandover( $tmp=PDLA->nullcreate($x) ); |
1510
|
0
|
|
|
|
|
0
|
return $tmp->at(); |
1511
|
|
|
|
|
|
|
} |
1512
|
|
|
|
|
|
|
|
1513
|
|
|
|
|
|
|
|
1514
|
|
|
|
|
|
|
|
1515
|
|
|
|
|
|
|
=head2 or |
1516
|
|
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
=for ref |
1518
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
Return the logical or of all elements in a piddle. |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
See the documentation for L for more information. |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
=for usage |
1524
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
$x = or($data); |
1526
|
|
|
|
|
|
|
|
1527
|
|
|
|
|
|
|
=cut |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
|
1530
|
|
|
|
|
|
|
|
1531
|
|
|
|
|
|
|
=for bad |
1532
|
|
|
|
|
|
|
|
1533
|
|
|
|
|
|
|
This routine handles bad values. |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
=cut |
1536
|
|
|
|
|
|
|
|
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
|
1539
|
|
|
|
|
|
|
|
1540
|
|
|
|
|
|
|
*or = \&PDLA::or; |
1541
|
|
|
|
|
|
|
sub PDLA::or { |
1542
|
5
|
|
|
5
|
0
|
115
|
my($x) = @_; my $tmp; |
|
5
|
|
|
|
|
25
|
|
1543
|
5
|
|
|
|
|
24
|
$x->clump(-1)->orover( $tmp=PDLA->nullcreate($x) ); |
1544
|
5
|
|
|
|
|
174
|
return $tmp->at(); |
1545
|
|
|
|
|
|
|
} |
1546
|
|
|
|
|
|
|
|
1547
|
|
|
|
|
|
|
|
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
=head2 bor |
1550
|
|
|
|
|
|
|
|
1551
|
|
|
|
|
|
|
=for ref |
1552
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
Return the bitwise or of all elements in a piddle. |
1554
|
|
|
|
|
|
|
|
1555
|
|
|
|
|
|
|
See the documentation for L for more information. |
1556
|
|
|
|
|
|
|
|
1557
|
|
|
|
|
|
|
=for usage |
1558
|
|
|
|
|
|
|
|
1559
|
|
|
|
|
|
|
$x = bor($data); |
1560
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
=cut |
1562
|
|
|
|
|
|
|
|
1563
|
|
|
|
|
|
|
|
1564
|
|
|
|
|
|
|
|
1565
|
|
|
|
|
|
|
=for bad |
1566
|
|
|
|
|
|
|
|
1567
|
|
|
|
|
|
|
This routine handles bad values. |
1568
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
=cut |
1570
|
|
|
|
|
|
|
|
1571
|
|
|
|
|
|
|
|
1572
|
|
|
|
|
|
|
|
1573
|
|
|
|
|
|
|
|
1574
|
|
|
|
|
|
|
*bor = \&PDLA::bor; |
1575
|
|
|
|
|
|
|
sub PDLA::bor { |
1576
|
0
|
|
|
0
|
0
|
0
|
my($x) = @_; my $tmp; |
|
0
|
|
|
|
|
0
|
|
1577
|
0
|
|
|
|
|
0
|
$x->clump(-1)->borover( $tmp=PDLA->nullcreate($x) ); |
1578
|
0
|
|
|
|
|
0
|
return $tmp->at(); |
1579
|
|
|
|
|
|
|
} |
1580
|
|
|
|
|
|
|
|
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
|
1583
|
|
|
|
|
|
|
=head2 min |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
=for ref |
1586
|
|
|
|
|
|
|
|
1587
|
|
|
|
|
|
|
Return the minimum of all elements in a piddle. |
1588
|
|
|
|
|
|
|
|
1589
|
|
|
|
|
|
|
See the documentation for L for more information. |
1590
|
|
|
|
|
|
|
|
1591
|
|
|
|
|
|
|
=for usage |
1592
|
|
|
|
|
|
|
|
1593
|
|
|
|
|
|
|
$x = min($data); |
1594
|
|
|
|
|
|
|
|
1595
|
|
|
|
|
|
|
=cut |
1596
|
|
|
|
|
|
|
|
1597
|
|
|
|
|
|
|
|
1598
|
|
|
|
|
|
|
|
1599
|
|
|
|
|
|
|
=for bad |
1600
|
|
|
|
|
|
|
|
1601
|
|
|
|
|
|
|
This routine handles bad values. |
1602
|
|
|
|
|
|
|
|
1603
|
|
|
|
|
|
|
=cut |
1604
|
|
|
|
|
|
|
|
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
|
1607
|
|
|
|
|
|
|
|
1608
|
|
|
|
|
|
|
*min = \&PDLA::min; |
1609
|
|
|
|
|
|
|
sub PDLA::min { |
1610
|
34
|
|
|
34
|
0
|
94
|
my($x) = @_; my $tmp; |
|
34
|
|
|
|
|
55
|
|
1611
|
34
|
|
|
|
|
118
|
$x->clump(-1)->minimum( $tmp=PDLA->nullcreate($x) ); |
1612
|
34
|
|
|
|
|
285
|
return $tmp->at(); |
1613
|
|
|
|
|
|
|
} |
1614
|
|
|
|
|
|
|
|
1615
|
|
|
|
|
|
|
|
1616
|
|
|
|
|
|
|
|
1617
|
|
|
|
|
|
|
=head2 max |
1618
|
|
|
|
|
|
|
|
1619
|
|
|
|
|
|
|
=for ref |
1620
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
Return the maximum of all elements in a piddle. |
1622
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
See the documentation for L for more information. |
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
=for usage |
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
$x = max($data); |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
=cut |
1630
|
|
|
|
|
|
|
|
1631
|
|
|
|
|
|
|
|
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
=for bad |
1634
|
|
|
|
|
|
|
|
1635
|
|
|
|
|
|
|
This routine handles bad values. |
1636
|
|
|
|
|
|
|
|
1637
|
|
|
|
|
|
|
=cut |
1638
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
|
1640
|
|
|
|
|
|
|
|
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
*max = \&PDLA::max; |
1643
|
|
|
|
|
|
|
sub PDLA::max { |
1644
|
202
|
|
|
202
|
0
|
1631
|
my($x) = @_; my $tmp; |
|
202
|
|
|
|
|
324
|
|
1645
|
202
|
|
|
|
|
798
|
$x->clump(-1)->maximum( $tmp=PDLA->nullcreate($x) ); |
1646
|
202
|
|
|
|
|
6765
|
return $tmp->at(); |
1647
|
|
|
|
|
|
|
} |
1648
|
|
|
|
|
|
|
|
1649
|
|
|
|
|
|
|
|
1650
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
=head2 median |
1652
|
|
|
|
|
|
|
|
1653
|
|
|
|
|
|
|
=for ref |
1654
|
|
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
Return the median of all elements in a piddle. |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
See the documentation for L for more information. |
1658
|
|
|
|
|
|
|
|
1659
|
|
|
|
|
|
|
=for usage |
1660
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
$x = median($data); |
1662
|
|
|
|
|
|
|
|
1663
|
|
|
|
|
|
|
=cut |
1664
|
|
|
|
|
|
|
|
1665
|
|
|
|
|
|
|
|
1666
|
|
|
|
|
|
|
|
1667
|
|
|
|
|
|
|
=for bad |
1668
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
This routine handles bad values. |
1670
|
|
|
|
|
|
|
|
1671
|
|
|
|
|
|
|
=cut |
1672
|
|
|
|
|
|
|
|
1673
|
|
|
|
|
|
|
|
1674
|
|
|
|
|
|
|
|
1675
|
|
|
|
|
|
|
|
1676
|
|
|
|
|
|
|
*median = \&PDLA::median; |
1677
|
|
|
|
|
|
|
sub PDLA::median { |
1678
|
2
|
|
|
2
|
0
|
11
|
my($x) = @_; my $tmp; |
|
2
|
|
|
|
|
5
|
|
1679
|
2
|
|
|
|
|
10
|
$x->clump(-1)->medover( $tmp=PDLA->nullcreate($x) ); |
1680
|
2
|
|
|
|
|
22
|
return $tmp->at(); |
1681
|
|
|
|
|
|
|
} |
1682
|
|
|
|
|
|
|
|
1683
|
|
|
|
|
|
|
|
1684
|
|
|
|
|
|
|
|
1685
|
|
|
|
|
|
|
=head2 mode |
1686
|
|
|
|
|
|
|
|
1687
|
|
|
|
|
|
|
=for ref |
1688
|
|
|
|
|
|
|
|
1689
|
|
|
|
|
|
|
Return the mode of all elements in a piddle. |
1690
|
|
|
|
|
|
|
|
1691
|
|
|
|
|
|
|
See the documentation for L for more information. |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
=for usage |
1694
|
|
|
|
|
|
|
|
1695
|
|
|
|
|
|
|
$x = mode($data); |
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
=cut |
1698
|
|
|
|
|
|
|
|
1699
|
|
|
|
|
|
|
|
1700
|
|
|
|
|
|
|
|
1701
|
|
|
|
|
|
|
=for bad |
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
This routine handles bad values. |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
=cut |
1706
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
|
1708
|
|
|
|
|
|
|
|
1709
|
|
|
|
|
|
|
|
1710
|
|
|
|
|
|
|
*mode = \&PDLA::mode; |
1711
|
|
|
|
|
|
|
sub PDLA::mode { |
1712
|
1
|
|
|
1
|
0
|
10
|
my($x) = @_; my $tmp; |
|
1
|
|
|
|
|
2
|
|
1713
|
1
|
|
|
|
|
6
|
$x->clump(-1)->modeover( $tmp=PDLA->nullcreate($x) ); |
1714
|
1
|
|
|
|
|
15
|
return $tmp->at(); |
1715
|
|
|
|
|
|
|
} |
1716
|
|
|
|
|
|
|
|
1717
|
|
|
|
|
|
|
|
1718
|
|
|
|
|
|
|
|
1719
|
|
|
|
|
|
|
=head2 oddmedian |
1720
|
|
|
|
|
|
|
|
1721
|
|
|
|
|
|
|
=for ref |
1722
|
|
|
|
|
|
|
|
1723
|
|
|
|
|
|
|
Return the oddmedian of all elements in a piddle. |
1724
|
|
|
|
|
|
|
|
1725
|
|
|
|
|
|
|
See the documentation for L for more information. |
1726
|
|
|
|
|
|
|
|
1727
|
|
|
|
|
|
|
=for usage |
1728
|
|
|
|
|
|
|
|
1729
|
|
|
|
|
|
|
$x = oddmedian($data); |
1730
|
|
|
|
|
|
|
|
1731
|
|
|
|
|
|
|
=cut |
1732
|
|
|
|
|
|
|
|
1733
|
|
|
|
|
|
|
|
1734
|
|
|
|
|
|
|
|
1735
|
|
|
|
|
|
|
=for bad |
1736
|
|
|
|
|
|
|
|
1737
|
|
|
|
|
|
|
This routine handles bad values. |
1738
|
|
|
|
|
|
|
|
1739
|
|
|
|
|
|
|
=cut |
1740
|
|
|
|
|
|
|
|
1741
|
|
|
|
|
|
|
|
1742
|
|
|
|
|
|
|
|
1743
|
|
|
|
|
|
|
|
1744
|
|
|
|
|
|
|
*oddmedian = \&PDLA::oddmedian; |
1745
|
|
|
|
|
|
|
sub PDLA::oddmedian { |
1746
|
3
|
|
|
3
|
0
|
297
|
my($x) = @_; my $tmp; |
|
3
|
|
|
|
|
7
|
|
1747
|
3
|
|
|
|
|
11
|
$x->clump(-1)->oddmedover( $tmp=PDLA->nullcreate($x) ); |
1748
|
3
|
|
|
|
|
29
|
return $tmp->at(); |
1749
|
|
|
|
|
|
|
} |
1750
|
|
|
|
|
|
|
|
1751
|
|
|
|
|
|
|
|
1752
|
|
|
|
|
|
|
|
1753
|
|
|
|
|
|
|
=head2 any |
1754
|
|
|
|
|
|
|
|
1755
|
|
|
|
|
|
|
=for ref |
1756
|
|
|
|
|
|
|
|
1757
|
|
|
|
|
|
|
Return true if any element in piddle set |
1758
|
|
|
|
|
|
|
|
1759
|
|
|
|
|
|
|
Useful in conditional expressions: |
1760
|
|
|
|
|
|
|
|
1761
|
|
|
|
|
|
|
=for example |
1762
|
|
|
|
|
|
|
|
1763
|
|
|
|
|
|
|
if (any $x>15) { print "some values are greater than 15\n" } |
1764
|
|
|
|
|
|
|
|
1765
|
|
|
|
|
|
|
=cut |
1766
|
|
|
|
|
|
|
|
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
|
1769
|
|
|
|
|
|
|
=for bad |
1770
|
|
|
|
|
|
|
|
1771
|
|
|
|
|
|
|
See L for comments on what happens when all elements |
1772
|
|
|
|
|
|
|
in the check are bad. |
1773
|
|
|
|
|
|
|
|
1774
|
|
|
|
|
|
|
=cut |
1775
|
|
|
|
|
|
|
|
1776
|
|
|
|
|
|
|
|
1777
|
|
|
|
|
|
|
|
1778
|
|
|
|
|
|
|
*any = \∨ |
1779
|
|
|
|
|
|
|
*PDLA::any = \&PDLA::or; |
1780
|
|
|
|
|
|
|
|
1781
|
|
|
|
|
|
|
=head2 all |
1782
|
|
|
|
|
|
|
|
1783
|
|
|
|
|
|
|
=for ref |
1784
|
|
|
|
|
|
|
|
1785
|
|
|
|
|
|
|
Return true if all elements in piddle set |
1786
|
|
|
|
|
|
|
|
1787
|
|
|
|
|
|
|
Useful in conditional expressions: |
1788
|
|
|
|
|
|
|
|
1789
|
|
|
|
|
|
|
=for example |
1790
|
|
|
|
|
|
|
|
1791
|
|
|
|
|
|
|
if (all $x>15) { print "all values are greater than 15\n" } |
1792
|
|
|
|
|
|
|
|
1793
|
|
|
|
|
|
|
=cut |
1794
|
|
|
|
|
|
|
|
1795
|
|
|
|
|
|
|
|
1796
|
|
|
|
|
|
|
|
1797
|
|
|
|
|
|
|
=for bad |
1798
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
See L for comments on what happens when all elements |
1800
|
|
|
|
|
|
|
in the check are bad. |
1801
|
|
|
|
|
|
|
|
1802
|
|
|
|
|
|
|
=cut |
1803
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
|
1805
|
|
|
|
|
|
|
|
1806
|
|
|
|
|
|
|
|
1807
|
|
|
|
|
|
|
*all = \∧ |
1808
|
|
|
|
|
|
|
*PDLA::all = \&PDLA::and; |
1809
|
|
|
|
|
|
|
|
1810
|
|
|
|
|
|
|
|
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
|
1813
|
|
|
|
|
|
|
=head2 minmax |
1814
|
|
|
|
|
|
|
|
1815
|
|
|
|
|
|
|
=for ref |
1816
|
|
|
|
|
|
|
|
1817
|
|
|
|
|
|
|
Returns an array with minimum and maximum values of a piddle. |
1818
|
|
|
|
|
|
|
|
1819
|
|
|
|
|
|
|
=for usage |
1820
|
|
|
|
|
|
|
|
1821
|
|
|
|
|
|
|
($mn, $mx) = minmax($pdl); |
1822
|
|
|
|
|
|
|
|
1823
|
|
|
|
|
|
|
This routine does I thread over the dimensions of C<$pdl>; |
1824
|
|
|
|
|
|
|
it returns the minimum and maximum values of the whole array. |
1825
|
|
|
|
|
|
|
See L if this is not what is required. |
1826
|
|
|
|
|
|
|
The two values are returned as Perl scalars similar to min/max. |
1827
|
|
|
|
|
|
|
|
1828
|
|
|
|
|
|
|
=for example |
1829
|
|
|
|
|
|
|
|
1830
|
|
|
|
|
|
|
pdla> $x = pdl [1,-2,3,5,0] |
1831
|
|
|
|
|
|
|
pdla> ($min, $max) = minmax($x); |
1832
|
|
|
|
|
|
|
pdla> p "$min $max\n"; |
1833
|
|
|
|
|
|
|
-2 5 |
1834
|
|
|
|
|
|
|
|
1835
|
|
|
|
|
|
|
=cut |
1836
|
|
|
|
|
|
|
|
1837
|
|
|
|
|
|
|
*minmax = \&PDLA::minmax; |
1838
|
|
|
|
|
|
|
sub PDLA::minmax { |
1839
|
3
|
|
|
3
|
0
|
15
|
my ($x)=@_; my $tmp; |
|
3
|
|
|
|
|
5
|
|
1840
|
3
|
|
|
|
|
15
|
my @arr = $x->clump(-1)->minmaximum; |
1841
|
3
|
|
|
|
|
85
|
return map {$_->sclr} @arr[0,1]; # return as scalars ! |
|
6
|
|
|
|
|
46
|
|
1842
|
|
|
|
|
|
|
} |
1843
|
|
|
|
|
|
|
|
1844
|
|
|
|
|
|
|
|
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
|
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
=head2 qsort |
1849
|
|
|
|
|
|
|
|
1850
|
|
|
|
|
|
|
=for sig |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
Signature: (a(n); [o]b(n)) |
1853
|
|
|
|
|
|
|
|
1854
|
|
|
|
|
|
|
|
1855
|
|
|
|
|
|
|
=for ref |
1856
|
|
|
|
|
|
|
|
1857
|
|
|
|
|
|
|
Quicksort a vector into ascending order. |
1858
|
|
|
|
|
|
|
|
1859
|
|
|
|
|
|
|
=for example |
1860
|
|
|
|
|
|
|
|
1861
|
|
|
|
|
|
|
print qsort random(10); |
1862
|
|
|
|
|
|
|
|
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
|
1865
|
|
|
|
|
|
|
=for bad |
1866
|
|
|
|
|
|
|
|
1867
|
|
|
|
|
|
|
Bad values are moved to the end of the array: |
1868
|
|
|
|
|
|
|
|
1869
|
|
|
|
|
|
|
pdla> p $y |
1870
|
|
|
|
|
|
|
[42 47 98 BAD 22 96 74 41 79 76 96 BAD 32 76 25 59 BAD 96 32 BAD] |
1871
|
|
|
|
|
|
|
pdla> p qsort($y) |
1872
|
|
|
|
|
|
|
[22 25 32 32 41 42 47 59 74 76 76 79 96 96 96 98 BAD BAD BAD BAD] |
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
|
1875
|
|
|
|
|
|
|
=cut |
1876
|
|
|
|
|
|
|
|
1877
|
|
|
|
|
|
|
|
1878
|
|
|
|
|
|
|
|
1879
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
|
1881
|
|
|
|
|
|
|
|
1882
|
|
|
|
|
|
|
*qsort = \&PDLA::qsort; |
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
|
1885
|
|
|
|
|
|
|
|
1886
|
|
|
|
|
|
|
|
1887
|
|
|
|
|
|
|
|
1888
|
|
|
|
|
|
|
=head2 qsorti |
1889
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
=for sig |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
Signature: (a(n); indx [o]indx(n)) |
1893
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
|
1895
|
|
|
|
|
|
|
=for ref |
1896
|
|
|
|
|
|
|
|
1897
|
|
|
|
|
|
|
Quicksort a vector and return index of elements in ascending order. |
1898
|
|
|
|
|
|
|
|
1899
|
|
|
|
|
|
|
=for example |
1900
|
|
|
|
|
|
|
|
1901
|
|
|
|
|
|
|
$ix = qsorti $x; |
1902
|
|
|
|
|
|
|
print $x->index($ix); # Sorted list |
1903
|
|
|
|
|
|
|
|
1904
|
|
|
|
|
|
|
|
1905
|
|
|
|
|
|
|
|
1906
|
|
|
|
|
|
|
=for bad |
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
Bad elements are moved to the end of the array: |
1909
|
|
|
|
|
|
|
|
1910
|
|
|
|
|
|
|
pdla> p $y |
1911
|
|
|
|
|
|
|
[42 47 98 BAD 22 96 74 41 79 76 96 BAD 32 76 25 59 BAD 96 32 BAD] |
1912
|
|
|
|
|
|
|
pdla> p $y->index( qsorti($y) ) |
1913
|
|
|
|
|
|
|
[22 25 32 32 41 42 47 59 74 76 76 79 96 96 96 98 BAD BAD BAD BAD] |
1914
|
|
|
|
|
|
|
|
1915
|
|
|
|
|
|
|
|
1916
|
|
|
|
|
|
|
=cut |
1917
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
|
1919
|
|
|
|
|
|
|
|
1920
|
|
|
|
|
|
|
|
1921
|
|
|
|
|
|
|
|
1922
|
|
|
|
|
|
|
|
1923
|
|
|
|
|
|
|
*qsorti = \&PDLA::qsorti; |
1924
|
|
|
|
|
|
|
|
1925
|
|
|
|
|
|
|
|
1926
|
|
|
|
|
|
|
|
1927
|
|
|
|
|
|
|
|
1928
|
|
|
|
|
|
|
|
1929
|
|
|
|
|
|
|
=head2 qsortvec |
1930
|
|
|
|
|
|
|
|
1931
|
|
|
|
|
|
|
=for sig |
1932
|
|
|
|
|
|
|
|
1933
|
|
|
|
|
|
|
Signature: (a(n,m); [o]b(n,m)) |
1934
|
|
|
|
|
|
|
|
1935
|
|
|
|
|
|
|
|
1936
|
|
|
|
|
|
|
=for ref |
1937
|
|
|
|
|
|
|
|
1938
|
|
|
|
|
|
|
Sort a list of vectors lexicographically. |
1939
|
|
|
|
|
|
|
|
1940
|
|
|
|
|
|
|
The 0th dimension of the source piddle is dimension in the vector; |
1941
|
|
|
|
|
|
|
the 1st dimension is list order. Higher dimensions are threaded over. |
1942
|
|
|
|
|
|
|
|
1943
|
|
|
|
|
|
|
=for example |
1944
|
|
|
|
|
|
|
|
1945
|
|
|
|
|
|
|
print qsortvec pdl([[1,2],[0,500],[2,3],[4,2],[3,4],[3,5]]); |
1946
|
|
|
|
|
|
|
[ |
1947
|
|
|
|
|
|
|
[ 0 500] |
1948
|
|
|
|
|
|
|
[ 1 2] |
1949
|
|
|
|
|
|
|
[ 2 3] |
1950
|
|
|
|
|
|
|
[ 3 4] |
1951
|
|
|
|
|
|
|
[ 3 5] |
1952
|
|
|
|
|
|
|
[ 4 2] |
1953
|
|
|
|
|
|
|
] |
1954
|
|
|
|
|
|
|
|
1955
|
|
|
|
|
|
|
|
1956
|
|
|
|
|
|
|
|
1957
|
|
|
|
|
|
|
|
1958
|
|
|
|
|
|
|
=for bad |
1959
|
|
|
|
|
|
|
|
1960
|
|
|
|
|
|
|
Vectors with bad components should be moved to the end of the array: |
1961
|
|
|
|
|
|
|
|
1962
|
|
|
|
|
|
|
|
1963
|
|
|
|
|
|
|
=cut |
1964
|
|
|
|
|
|
|
|
1965
|
|
|
|
|
|
|
|
1966
|
|
|
|
|
|
|
|
1967
|
|
|
|
|
|
|
|
1968
|
|
|
|
|
|
|
|
1969
|
|
|
|
|
|
|
|
1970
|
|
|
|
|
|
|
*qsortvec = \&PDLA::qsortvec; |
1971
|
|
|
|
|
|
|
|
1972
|
|
|
|
|
|
|
|
1973
|
|
|
|
|
|
|
|
1974
|
|
|
|
|
|
|
|
1975
|
|
|
|
|
|
|
|
1976
|
|
|
|
|
|
|
=head2 qsortveci |
1977
|
|
|
|
|
|
|
|
1978
|
|
|
|
|
|
|
=for sig |
1979
|
|
|
|
|
|
|
|
1980
|
|
|
|
|
|
|
Signature: (a(n,m); indx [o]indx(m)) |
1981
|
|
|
|
|
|
|
|
1982
|
|
|
|
|
|
|
|
1983
|
|
|
|
|
|
|
=for ref |
1984
|
|
|
|
|
|
|
|
1985
|
|
|
|
|
|
|
Sort a list of vectors lexicographically, returning the indices of the |
1986
|
|
|
|
|
|
|
sorted vectors rather than the sorted list itself. |
1987
|
|
|
|
|
|
|
|
1988
|
|
|
|
|
|
|
As with C, the input PDLA should be an NxM array containing M |
1989
|
|
|
|
|
|
|
separate N-dimensional vectors. The return value is an integer M-PDLA |
1990
|
|
|
|
|
|
|
containing the M-indices of original array rows, in sorted order. |
1991
|
|
|
|
|
|
|
|
1992
|
|
|
|
|
|
|
As with C, the zeroth element of the vectors runs slowest in the |
1993
|
|
|
|
|
|
|
sorted list. |
1994
|
|
|
|
|
|
|
|
1995
|
|
|
|
|
|
|
Additional dimensions are threaded over: each plane is sorted separately, |
1996
|
|
|
|
|
|
|
so qsortveci may be thought of as a collapse operator of sorts (groan). |
1997
|
|
|
|
|
|
|
|
1998
|
|
|
|
|
|
|
|
1999
|
|
|
|
|
|
|
|
2000
|
|
|
|
|
|
|
=for bad |
2001
|
|
|
|
|
|
|
|
2002
|
|
|
|
|
|
|
Vectors with bad components should be moved to the end of the array: |
2003
|
|
|
|
|
|
|
|
2004
|
|
|
|
|
|
|
|
2005
|
|
|
|
|
|
|
=cut |
2006
|
|
|
|
|
|
|
|
2007
|
|
|
|
|
|
|
|
2008
|
|
|
|
|
|
|
|
2009
|
|
|
|
|
|
|
|
2010
|
|
|
|
|
|
|
|
2011
|
|
|
|
|
|
|
|
2012
|
|
|
|
|
|
|
*qsortveci = \&PDLA::qsortveci; |
2013
|
|
|
|
|
|
|
|
2014
|
|
|
|
|
|
|
|
2015
|
|
|
|
|
|
|
|
2016
|
|
|
|
|
|
|
|
2017
|
|
|
|
|
|
|
|
2018
|
|
|
|
|
|
|
=head2 minimum |
2019
|
|
|
|
|
|
|
|
2020
|
|
|
|
|
|
|
=for sig |
2021
|
|
|
|
|
|
|
|
2022
|
|
|
|
|
|
|
Signature: (a(n); [o]c()) |
2023
|
|
|
|
|
|
|
|
2024
|
|
|
|
|
|
|
|
2025
|
|
|
|
|
|
|
=for ref |
2026
|
|
|
|
|
|
|
|
2027
|
|
|
|
|
|
|
Project via minimum to N-1 dimensions |
2028
|
|
|
|
|
|
|
|
2029
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
2030
|
|
|
|
|
|
|
by one by taking the minimum along the 1st dimension. |
2031
|
|
|
|
|
|
|
|
2032
|
|
|
|
|
|
|
By using L etc. it is possible to use |
2033
|
|
|
|
|
|
|
I dimension. |
2034
|
|
|
|
|
|
|
|
2035
|
|
|
|
|
|
|
=for usage |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
$y = minimum($x); |
2038
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
=for example |
2040
|
|
|
|
|
|
|
|
2041
|
|
|
|
|
|
|
$spectrum = minimum $image->xchg(0,1) |
2042
|
|
|
|
|
|
|
|
2043
|
|
|
|
|
|
|
|
2044
|
|
|
|
|
|
|
|
2045
|
|
|
|
|
|
|
|
2046
|
|
|
|
|
|
|
|
2047
|
|
|
|
|
|
|
=for bad |
2048
|
|
|
|
|
|
|
|
2049
|
|
|
|
|
|
|
Output is set bad if all elements of the input are bad, |
2050
|
|
|
|
|
|
|
otherwise the bad flag is cleared for the output piddle. |
2051
|
|
|
|
|
|
|
|
2052
|
|
|
|
|
|
|
Note that C are considered to be valid values; |
2053
|
|
|
|
|
|
|
see L and L |
2054
|
|
|
|
|
|
|
for ways of masking NaNs. |
2055
|
|
|
|
|
|
|
|
2056
|
|
|
|
|
|
|
|
2057
|
|
|
|
|
|
|
=cut |
2058
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
|
2060
|
|
|
|
|
|
|
|
2061
|
|
|
|
|
|
|
|
2062
|
|
|
|
|
|
|
|
2063
|
|
|
|
|
|
|
|
2064
|
|
|
|
|
|
|
*minimum = \&PDLA::minimum; |
2065
|
|
|
|
|
|
|
|
2066
|
|
|
|
|
|
|
|
2067
|
|
|
|
|
|
|
|
2068
|
|
|
|
|
|
|
|
2069
|
|
|
|
|
|
|
|
2070
|
|
|
|
|
|
|
=head2 minimum_ind |
2071
|
|
|
|
|
|
|
|
2072
|
|
|
|
|
|
|
=for sig |
2073
|
|
|
|
|
|
|
|
2074
|
|
|
|
|
|
|
Signature: (a(n); indx [o] c()) |
2075
|
|
|
|
|
|
|
|
2076
|
|
|
|
|
|
|
=for ref |
2077
|
|
|
|
|
|
|
|
2078
|
|
|
|
|
|
|
Like minimum but returns the index rather than the value |
2079
|
|
|
|
|
|
|
|
2080
|
|
|
|
|
|
|
=for bad |
2081
|
|
|
|
|
|
|
|
2082
|
|
|
|
|
|
|
Output is set bad if all elements of the input are bad, |
2083
|
|
|
|
|
|
|
otherwise the bad flag is cleared for the output piddle. |
2084
|
|
|
|
|
|
|
|
2085
|
|
|
|
|
|
|
=cut |
2086
|
|
|
|
|
|
|
|
2087
|
|
|
|
|
|
|
|
2088
|
|
|
|
|
|
|
|
2089
|
|
|
|
|
|
|
|
2090
|
|
|
|
|
|
|
|
2091
|
|
|
|
|
|
|
|
2092
|
|
|
|
|
|
|
*minimum_ind = \&PDLA::minimum_ind; |
2093
|
|
|
|
|
|
|
|
2094
|
|
|
|
|
|
|
|
2095
|
|
|
|
|
|
|
|
2096
|
|
|
|
|
|
|
|
2097
|
|
|
|
|
|
|
|
2098
|
|
|
|
|
|
|
=head2 minimum_n_ind |
2099
|
|
|
|
|
|
|
|
2100
|
|
|
|
|
|
|
=for sig |
2101
|
|
|
|
|
|
|
|
2102
|
|
|
|
|
|
|
Signature: (a(n); indx [o]c(m)) |
2103
|
|
|
|
|
|
|
|
2104
|
|
|
|
|
|
|
=for ref |
2105
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
Returns the index of C minimum elements |
2107
|
|
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
=for bad |
2109
|
|
|
|
|
|
|
|
2110
|
|
|
|
|
|
|
Not yet been converted to ignore bad values |
2111
|
|
|
|
|
|
|
|
2112
|
|
|
|
|
|
|
=cut |
2113
|
|
|
|
|
|
|
|
2114
|
|
|
|
|
|
|
|
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
|
2117
|
|
|
|
|
|
|
|
2118
|
|
|
|
|
|
|
|
2119
|
|
|
|
|
|
|
*minimum_n_ind = \&PDLA::minimum_n_ind; |
2120
|
|
|
|
|
|
|
|
2121
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2123
|
|
|
|
|
|
|
|
2124
|
|
|
|
|
|
|
|
2125
|
|
|
|
|
|
|
=head2 maximum |
2126
|
|
|
|
|
|
|
|
2127
|
|
|
|
|
|
|
=for sig |
2128
|
|
|
|
|
|
|
|
2129
|
|
|
|
|
|
|
Signature: (a(n); [o]c()) |
2130
|
|
|
|
|
|
|
|
2131
|
|
|
|
|
|
|
|
2132
|
|
|
|
|
|
|
=for ref |
2133
|
|
|
|
|
|
|
|
2134
|
|
|
|
|
|
|
Project via maximum to N-1 dimensions |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
This function reduces the dimensionality of a piddle |
2137
|
|
|
|
|
|
|
by one by taking the maximum along the 1st dimension. |
2138
|
|
|
|
|
|
|
|
2139
|
|
|
|
|
|
|
By using L etc. it is possible to use |
2140
|
|
|
|
|
|
|
I dimension. |
2141
|
|
|
|
|
|
|
|
2142
|
|
|
|
|
|
|
=for usage |
2143
|
|
|
|
|
|
|
|
2144
|
|
|
|
|
|
|
$y = maximum($x); |
2145
|
|
|
|
|
|
|
|
2146
|
|
|
|
|
|
|
=for example |
2147
|
|
|
|
|
|
|
|
2148
|
|
|
|
|
|
|
$spectrum = maximum $image->xchg(0,1) |
2149
|
|
|
|
|
|
|
|
2150
|
|
|
|
|
|
|
|
2151
|
|
|
|
|
|
|
|
2152
|
|
|
|
|
|
|
|
2153
|
|
|
|
|
|
|
|
2154
|
|
|
|
|
|
|
=for bad |
2155
|
|
|
|
|
|
|
|
2156
|
|
|
|
|
|
|
Output is set bad if all elements of the input are bad, |
2157
|
|
|
|
|
|
|
otherwise the bad flag is cleared for the output piddle. |
2158
|
|
|
|
|
|
|
|
2159
|
|
|
|
|
|
|
Note that C are considered to be valid values; |
2160
|
|
|
|
|
|
|
see L and L |
2161
|
|
|
|
|
|
|
for ways of masking NaNs. |
2162
|
|
|
|
|
|
|
|
2163
|
|
|
|
|
|
|
|
2164
|
|
|
|
|
|
|
=cut |
2165
|
|
|
|
|
|
|
|
2166
|
|
|
|
|
|
|
|
2167
|
|
|
|
|
|
|
|
2168
|
|
|
|
|
|
|
|
2169
|
|
|
|
|
|
|
|
2170
|
|
|
|
|
|
|
|
2171
|
|
|
|
|
|
|
*maximum = \&PDLA::maximum; |
2172
|
|
|
|
|
|
|
|
2173
|
|
|
|
|
|
|
|
2174
|
|
|
|
|
|
|
|
2175
|
|
|
|
|
|
|
|
2176
|
|
|
|
|
|
|
|
2177
|
|
|
|
|
|
|
=head2 maximum_ind |
2178
|
|
|
|
|
|
|
|
2179
|
|
|
|
|
|
|
=for sig |
2180
|
|
|
|
|
|
|
|
2181
|
|
|
|
|
|
|
Signature: (a(n); indx [o] c()) |
2182
|
|
|
|
|
|
|
|
2183
|
|
|
|
|
|
|
=for ref |
2184
|
|
|
|
|
|
|
|
2185
|
|
|
|
|
|
|
Like maximum but returns the index rather than the value |
2186
|
|
|
|
|
|
|
|
2187
|
|
|
|
|
|
|
=for bad |
2188
|
|
|
|
|
|
|
|
2189
|
|
|
|
|
|
|
Output is set bad if all elements of the input are bad, |
2190
|
|
|
|
|
|
|
otherwise the bad flag is cleared for the output piddle. |
2191
|
|
|
|
|
|
|
|
2192
|
|
|
|
|
|
|
=cut |
2193
|
|
|
|
|
|
|
|
2194
|
|
|
|
|
|
|
|
2195
|
|
|
|
|
|
|
|
2196
|
|
|
|
|
|
|
|
2197
|
|
|
|
|
|
|
|
2198
|
|
|
|
|
|
|
|
2199
|
|
|
|
|
|
|
*maximum_ind = \&PDLA::maximum_ind; |
2200
|
|
|
|
|
|
|
|
2201
|
|
|
|
|
|
|
|
2202
|
|
|
|
|
|
|
|
2203
|
|
|
|
|
|
|
|
2204
|
|
|
|
|
|
|
|
2205
|
|
|
|
|
|
|
=head2 maximum_n_ind |
2206
|
|
|
|
|
|
|
|
2207
|
|
|
|
|
|
|
=for sig |
2208
|
|
|
|
|
|
|
|
2209
|
|
|
|
|
|
|
Signature: (a(n); indx [o]c(m)) |
2210
|
|
|
|
|
|
|
|
2211
|
|
|
|
|
|
|
=for ref |
2212
|
|
|
|
|
|
|
|
2213
|
|
|
|
|
|
|
Returns the index of C maximum elements |
2214
|
|
|
|
|
|
|
|
2215
|
|
|
|
|
|
|
=for bad |
2216
|
|
|
|
|
|
|
|
2217
|
|
|
|
|
|
|
Not yet been converted to ignore bad values |
2218
|
|
|
|
|
|
|
|
2219
|
|
|
|
|
|
|
=cut |
2220
|
|
|
|
|
|
|
|
2221
|
|
|
|
|
|
|
|
2222
|
|
|
|
|
|
|
|
2223
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
|
2225
|
|
|
|
|
|
|
|
2226
|
|
|
|
|
|
|
*maximum_n_ind = \&PDLA::maximum_n_ind; |
2227
|
|
|
|
|
|
|
|
2228
|
|
|
|
|
|
|
|
2229
|
|
|
|
|
|
|
|
2230
|
|
|
|
|
|
|
*PDLA::maxover = \&PDLA::maximum; |
2231
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
|
2233
|
|
|
|
|
|
|
*maxover = \&PDLA::maximum; |
2234
|
|
|
|
|
|
|
|
2235
|
|
|
|
|
|
|
|
2236
|
|
|
|
|
|
|
=head2 maxover |
2237
|
|
|
|
|
|
|
|
2238
|
|
|
|
|
|
|
=for ref |
2239
|
|
|
|
|
|
|
|
2240
|
|
|
|
|
|
|
Synonym for maximum. |
2241
|
|
|
|
|
|
|
|
2242
|
|
|
|
|
|
|
=cut |
2243
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
|
2245
|
|
|
|
|
|
|
|
2246
|
|
|
|
|
|
|
*PDLA::maxover_ind = \&PDLA::maximum_ind; |
2247
|
|
|
|
|
|
|
|
2248
|
|
|
|
|
|
|
|
2249
|
|
|
|
|
|
|
*maxover_ind = \&PDLA::maximum_ind; |
2250
|
|
|
|
|
|
|
|
2251
|
|
|
|
|
|
|
|
2252
|
|
|
|
|
|
|
=head2 maxover_ind |
2253
|
|
|
|
|
|
|
|
2254
|
|
|
|
|
|
|
=for ref |
2255
|
|
|
|
|
|
|
|
2256
|
|
|
|
|
|
|
Synonym for maximum_ind. |
2257
|
|
|
|
|
|
|
|
2258
|
|
|
|
|
|
|
=cut |
2259
|
|
|
|
|
|
|
|
2260
|
|
|
|
|
|
|
|
2261
|
|
|
|
|
|
|
|
2262
|
|
|
|
|
|
|
*PDLA::maxover_n_ind = \&PDLA::maximum_n_ind; |
2263
|
|
|
|
|
|
|
|
2264
|
|
|
|
|
|
|
|
2265
|
|
|
|
|
|
|
*maxover_n_ind = \&PDLA::maximum_n_ind; |
2266
|
|
|
|
|
|
|
|
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
=head2 maxover_n_ind |
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
=for ref |
2271
|
|
|
|
|
|
|
|
2272
|
|
|
|
|
|
|
Synonym for maximum_n_ind. |
2273
|
|
|
|
|
|
|
|
2274
|
|
|
|
|
|
|
=cut |
2275
|
|
|
|
|
|
|
|
2276
|
|
|
|
|
|
|
|
2277
|
|
|
|
|
|
|
|
2278
|
|
|
|
|
|
|
*PDLA::minover = \&PDLA::minimum; |
2279
|
|
|
|
|
|
|
|
2280
|
|
|
|
|
|
|
|
2281
|
|
|
|
|
|
|
*minover = \&PDLA::minimum; |
2282
|
|
|
|
|
|
|
|
2283
|
|
|
|
|
|
|
|
2284
|
|
|
|
|
|
|
=head2 minover |
2285
|
|
|
|
|
|
|
|
2286
|
|
|
|
|
|
|
=for ref |
2287
|
|
|
|
|
|
|
|
2288
|
|
|
|
|
|
|
Synonym for minimum. |
2289
|
|
|
|
|
|
|
|
2290
|
|
|
|
|
|
|
=cut |
2291
|
|
|
|
|
|
|
|
2292
|
|
|
|
|
|
|
|
2293
|
|
|
|
|
|
|
|
2294
|
|
|
|
|
|
|
*PDLA::minover_ind = \&PDLA::minimum_ind; |
2295
|
|
|
|
|
|
|
|
2296
|
|
|
|
|
|
|
|
2297
|
|
|
|
|
|
|
*minover_ind = \&PDLA::minimum_ind; |
2298
|
|
|
|
|
|
|
|
2299
|
|
|
|
|
|
|
|
2300
|
|
|
|
|
|
|
=head2 minover_ind |
2301
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
=for ref |
2303
|
|
|
|
|
|
|
|
2304
|
|
|
|
|
|
|
Synonym for minimum_ind. |
2305
|
|
|
|
|
|
|
|
2306
|
|
|
|
|
|
|
=cut |
2307
|
|
|
|
|
|
|
|
2308
|
|
|
|
|
|
|
|
2309
|
|
|
|
|
|
|
|
2310
|
|
|
|
|
|
|
*PDLA::minover_n_ind = \&PDLA::minimum_n_ind; |
2311
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
|
2313
|
|
|
|
|
|
|
*minover_n_ind = \&PDLA::minimum_n_ind; |
2314
|
|
|
|
|
|
|
|
2315
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
=head2 minover_n_ind |
2317
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
=for ref |
2319
|
|
|
|
|
|
|
|
2320
|
|
|
|
|
|
|
Synonym for minimum_n_ind |
2321
|
|
|
|
|
|
|
|
2322
|
|
|
|
|
|
|
=cut |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
|
2325
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
|
2327
|
|
|
|
|
|
|
|
2328
|
|
|
|
|
|
|
=head2 minmaximum |
2329
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
=for sig |
2331
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
Signature: (a(n); [o]cmin(); [o] cmax(); indx [o]cmin_ind(); indx [o]cmax_ind()) |
2333
|
|
|
|
|
|
|
|
2334
|
|
|
|
|
|
|
|
2335
|
|
|
|
|
|
|
=for ref |
2336
|
|
|
|
|
|
|
|
2337
|
|
|
|
|
|
|
Find minimum and maximum and their indices for a given piddle; |
2338
|
|
|
|
|
|
|
|
2339
|
|
|
|
|
|
|
=for usage |
2340
|
|
|
|
|
|
|
|
2341
|
|
|
|
|
|
|
pdla> $x=pdl [[-2,3,4],[1,0,3]] |
2342
|
|
|
|
|
|
|
pdla> ($min, $max, $min_ind, $max_ind)=minmaximum($x) |
2343
|
|
|
|
|
|
|
pdla> p $min, $max, $min_ind, $max_ind |
2344
|
|
|
|
|
|
|
[-2 0] [4 3] [0 1] [2 2] |
2345
|
|
|
|
|
|
|
|
2346
|
|
|
|
|
|
|
See also L, which clumps the piddle together. |
2347
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
|
2349
|
|
|
|
|
|
|
|
2350
|
|
|
|
|
|
|
=for bad |
2351
|
|
|
|
|
|
|
|
2352
|
|
|
|
|
|
|
If C contains only bad data, then the output piddles will |
2353
|
|
|
|
|
|
|
be set bad, along with their bad flag. |
2354
|
|
|
|
|
|
|
Otherwise they will have their bad flags cleared, |
2355
|
|
|
|
|
|
|
since they will not contain any bad values. |
2356
|
|
|
|
|
|
|
|
2357
|
|
|
|
|
|
|
=cut |
2358
|
|
|
|
|
|
|
|
2359
|
|
|
|
|
|
|
|
2360
|
|
|
|
|
|
|
|
2361
|
|
|
|
|
|
|
|
2362
|
|
|
|
|
|
|
|
2363
|
|
|
|
|
|
|
|
2364
|
|
|
|
|
|
|
*minmaximum = \&PDLA::minmaximum; |
2365
|
|
|
|
|
|
|
|
2366
|
|
|
|
|
|
|
|
2367
|
|
|
|
|
|
|
|
2368
|
|
|
|
|
|
|
*PDLA::minmaxover = \&PDLA::minmaximum; |
2369
|
|
|
|
|
|
|
|
2370
|
|
|
|
|
|
|
|
2371
|
|
|
|
|
|
|
*minmaxover = \&PDLA::minmaximum; |
2372
|
|
|
|
|
|
|
|
2373
|
|
|
|
|
|
|
|
2374
|
|
|
|
|
|
|
=head2 minmaxover |
2375
|
|
|
|
|
|
|
|
2376
|
|
|
|
|
|
|
=for ref |
2377
|
|
|
|
|
|
|
|
2378
|
|
|
|
|
|
|
Synonym for minmaximum. |
2379
|
|
|
|
|
|
|
|
2380
|
|
|
|
|
|
|
=cut |
2381
|
|
|
|
|
|
|
|
2382
|
|
|
|
|
|
|
|
2383
|
|
|
|
|
|
|
|
2384
|
|
|
|
|
|
|
; |
2385
|
|
|
|
|
|
|
|
2386
|
|
|
|
|
|
|
|
2387
|
|
|
|
|
|
|
=head1 AUTHOR |
2388
|
|
|
|
|
|
|
|
2389
|
|
|
|
|
|
|
Copyright (C) Tuomas J. Lukka 1997 (lukka@husc.harvard.edu). |
2390
|
|
|
|
|
|
|
Contributions by Christian Soeller (c.soeller@auckland.ac.nz) |
2391
|
|
|
|
|
|
|
and Karl Glazebrook (kgb@aaoepp.aao.gov.au). All rights |
2392
|
|
|
|
|
|
|
reserved. There is no warranty. You are allowed to redistribute this |
2393
|
|
|
|
|
|
|
software / documentation under certain conditions. For details, see |
2394
|
|
|
|
|
|
|
the file COPYING in the PDLA distribution. If this file is separated |
2395
|
|
|
|
|
|
|
from the PDLA distribution, the copyright notice should be included in |
2396
|
|
|
|
|
|
|
the file. |
2397
|
|
|
|
|
|
|
|
2398
|
|
|
|
|
|
|
=cut |
2399
|
|
|
|
|
|
|
|
2400
|
|
|
|
|
|
|
|
2401
|
|
|
|
|
|
|
|
2402
|
|
|
|
|
|
|
|
2403
|
|
|
|
|
|
|
|
2404
|
|
|
|
|
|
|
# Exit with OK status |
2405
|
|
|
|
|
|
|
|
2406
|
|
|
|
|
|
|
1; |
2407
|
|
|
|
|
|
|
|
2408
|
|
|
|
|
|
|
|