File Coverage

blib/lib/PDLA/Ops.pm
Criterion Covered Total %
statement 20 20 100.0
branch 6 6 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 30 31 96.7


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