File Coverage

blib/lib/PDL/Ufunc.pm
Criterion Covered Total %
statement 72 92 78.2
branch n/a
condition n/a
subroutine 19 24 79.1
pod 1 19 5.2
total 92 135 68.1


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