File Coverage

blib/lib/PDLA/Math.pm
Criterion Covered Total %
statement 12 13 92.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 17 94.1


line stmt bran cond sub pod time code
1              
2             #
3             # GENERATED WITH PDLA::PP! Don't modify!
4             #
5             package PDLA::Math;
6              
7             @EXPORT_OK = qw( PDLA::PP acos PDLA::PP asin PDLA::PP atan PDLA::PP cosh PDLA::PP sinh PDLA::PP tan PDLA::PP tanh PDLA::PP ceil PDLA::PP floor PDLA::PP rint PDLA::PP pow PDLA::PP acosh PDLA::PP asinh PDLA::PP atanh PDLA::PP erf PDLA::PP erfc PDLA::PP bessj0 PDLA::PP bessj1 PDLA::PP bessy0 PDLA::PP bessy1 PDLA::PP bessjn PDLA::PP bessyn PDLA::PP lgamma PDLA::PP badmask PDLA::PP isfinite PDLA::PP erfi PDLA::PP ndtri PDLA::PP polyroots );
8             %EXPORT_TAGS = (Func=>[@EXPORT_OK]);
9              
10 77     77   552 use PDLA::Core;
  77         183  
  77         466  
11 77     77   507 use PDLA::Exporter;
  77         183  
  77         407  
12 77     77   380 use DynaLoader;
  77         151  
  77         4463  
13              
14              
15              
16            
17             @ISA = ( 'PDLA::Exporter','DynaLoader' );
18             push @PDLA::Core::PP, __PACKAGE__;
19             bootstrap PDLA::Math ;
20              
21              
22              
23              
24             =head1 NAME
25              
26             PDLA::Math - extended mathematical operations and special functions
27              
28             =head1 SYNOPSIS
29              
30             use PDLA::Math;
31              
32             use PDLA::Graphics::TriD;
33             imag3d [SURF2D,bessj0(rvals(zeroes(50,50))/2)];
34              
35             =head1 DESCRIPTION
36              
37             This module extends PDLA with more advanced mathematical functions than
38             provided by standard Perl.
39              
40             All the functions have one input pdl, and one output, unless otherwise
41             stated.
42              
43             Many of the functions are linked from the system maths library or the
44             Cephes maths library (determined when PDLA is compiled); a few are implemented
45             entirely in PDLA.
46              
47             =cut
48              
49             ### Kludge for backwards compatibility with older scripts
50             ### This should be deleted at some point later than 21-Nov-2003.
51 77     77   40987 BEGIN {use PDLA::MatrixOps;}
  77         247  
  77         675  
  0            
52              
53              
54              
55              
56              
57              
58              
59             =head1 FUNCTIONS
60              
61              
62              
63             =cut
64              
65              
66              
67              
68              
69              
70             =head2 acos
71              
72             =for sig
73              
74             Signature: (a(); [o]b())
75              
76             =for ref
77              
78             The usual trigonometric function. Works inplace.
79              
80             =for bad
81              
82             acos processes bad values.
83             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
84              
85              
86             =cut
87              
88              
89              
90              
91              
92              
93             *acos = \&PDLA::acos;
94              
95              
96              
97              
98              
99             =head2 asin
100              
101             =for sig
102              
103             Signature: (a(); [o]b())
104              
105             =for ref
106              
107             The usual trigonometric function. Works inplace.
108              
109             =for bad
110              
111             asin processes bad values.
112             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
113              
114              
115             =cut
116              
117              
118              
119              
120              
121              
122             *asin = \&PDLA::asin;
123              
124              
125              
126              
127              
128             =head2 atan
129              
130             =for sig
131              
132             Signature: (a(); [o]b())
133              
134             =for ref
135              
136             The usual trigonometric function. Works inplace.
137              
138             =for bad
139              
140             atan processes bad values.
141             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
142              
143              
144             =cut
145              
146              
147              
148              
149              
150              
151             *atan = \&PDLA::atan;
152              
153              
154              
155              
156              
157             =head2 cosh
158              
159             =for sig
160              
161             Signature: (a(); [o]b())
162              
163             =for ref
164              
165             The standard hyperbolic function. Works inplace.
166              
167             =for bad
168              
169             cosh processes bad values.
170             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
171              
172              
173             =cut
174              
175              
176              
177              
178              
179              
180             *cosh = \&PDLA::cosh;
181              
182              
183              
184              
185              
186             =head2 sinh
187              
188             =for sig
189              
190             Signature: (a(); [o]b())
191              
192             =for ref
193              
194             The standard hyperbolic function. Works inplace.
195              
196             =for bad
197              
198             sinh processes bad values.
199             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
200              
201              
202             =cut
203              
204              
205              
206              
207              
208              
209             *sinh = \&PDLA::sinh;
210              
211              
212              
213              
214              
215             =head2 tan
216              
217             =for sig
218              
219             Signature: (a(); [o]b())
220              
221             =for ref
222              
223             The usual trigonometric function. Works inplace.
224              
225             =for bad
226              
227             tan processes bad values.
228             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
229              
230              
231             =cut
232              
233              
234              
235              
236              
237              
238             *tan = \&PDLA::tan;
239              
240              
241              
242              
243              
244             =head2 tanh
245              
246             =for sig
247              
248             Signature: (a(); [o]b())
249              
250             =for ref
251              
252             The standard hyperbolic function. Works inplace.
253              
254             =for bad
255              
256             tanh processes bad values.
257             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
258              
259              
260             =cut
261              
262              
263              
264              
265              
266              
267             *tanh = \&PDLA::tanh;
268              
269              
270              
271              
272              
273             =head2 ceil
274              
275             =for sig
276              
277             Signature: (a(); [o]b())
278              
279             =for ref
280              
281             Round to integer values in floating-point format. Works inplace.
282              
283             =for bad
284              
285             ceil processes bad values.
286             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
287              
288              
289             =cut
290              
291              
292              
293              
294              
295              
296             *ceil = \&PDLA::ceil;
297              
298              
299              
300              
301              
302             =head2 floor
303              
304             =for sig
305              
306             Signature: (a(); [o]b())
307              
308             =for ref
309              
310             Round to integer values in floating-point format. Works inplace.
311              
312             =for bad
313              
314             floor processes bad values.
315             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
316              
317              
318             =cut
319              
320              
321              
322              
323              
324              
325             *floor = \&PDLA::floor;
326              
327              
328              
329              
330              
331             =head2 rint
332              
333             =for sig
334              
335             Signature: (a(); [o]b())
336              
337             =for ref
338              
339             Round to integer values in floating-point format.
340              
341             =for method
342              
343             rint uses the 'round half to even' rounding method (also known as
344             banker's rounding). Half-integers are rounded to the nearest even
345             number. This avoids a slight statistical bias inherent in always
346             rounding half-integers up or away from zero.
347              
348             If you are looking to round half-integers up (regardless of sign), try
349             C. If you want to round half-integers away from zero,
350             try C<< floor(abs($x)+0.5)*($x<=>0) >>. Works inplace.
351              
352             =for bad
353              
354             rint processes bad values.
355             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
356              
357              
358             =cut
359              
360              
361              
362              
363              
364              
365             *rint = \&PDLA::rint;
366              
367              
368              
369              
370              
371             =head2 pow
372              
373             =for sig
374              
375             Signature: (a(); b(); [o]c())
376              
377             =for ref
378              
379             Synonym for `**'. Works inplace.
380              
381             =for bad
382              
383             pow processes bad values.
384             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
385              
386              
387             =cut
388              
389              
390              
391              
392              
393              
394             *pow = \&PDLA::pow;
395              
396              
397              
398              
399              
400             =head2 acosh
401              
402             =for sig
403              
404             Signature: (a(); [o]b())
405              
406             =for ref
407              
408             The standard hyperbolic function. Works inplace.
409              
410             =for bad
411              
412             acosh processes bad values.
413             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
414              
415              
416             =cut
417              
418              
419              
420              
421              
422              
423             *acosh = \&PDLA::acosh;
424              
425              
426              
427              
428              
429             =head2 asinh
430              
431             =for sig
432              
433             Signature: (a(); [o]b())
434              
435             =for ref
436              
437             The standard hyperbolic function. Works inplace.
438              
439             =for bad
440              
441             asinh processes bad values.
442             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
443              
444              
445             =cut
446              
447              
448              
449              
450              
451              
452             *asinh = \&PDLA::asinh;
453              
454              
455              
456              
457              
458             =head2 atanh
459              
460             =for sig
461              
462             Signature: (a(); [o]b())
463              
464             =for ref
465              
466             The standard hyperbolic function. Works inplace.
467              
468             =for bad
469              
470             atanh processes bad values.
471             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
472              
473              
474             =cut
475              
476              
477              
478              
479              
480              
481             *atanh = \&PDLA::atanh;
482              
483              
484              
485              
486              
487             =head2 erf
488              
489             =for sig
490              
491             Signature: (a(); [o]b())
492              
493             =for ref
494              
495             The error function. Works inplace.
496              
497             =for bad
498              
499             erf processes bad values.
500             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
501              
502              
503             =cut
504              
505              
506              
507              
508              
509              
510             *erf = \&PDLA::erf;
511              
512              
513              
514              
515              
516             =head2 erfc
517              
518             =for sig
519              
520             Signature: (a(); [o]b())
521              
522             =for ref
523              
524             The complement of the error function. Works inplace.
525              
526             =for bad
527              
528             erfc processes bad values.
529             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
530              
531              
532             =cut
533              
534              
535              
536              
537              
538              
539             *erfc = \&PDLA::erfc;
540              
541              
542              
543              
544              
545             =head2 bessj0
546              
547             =for sig
548              
549             Signature: (a(); [o]b())
550              
551             =for ref
552              
553             The regular Bessel function of the first kind, J_n Works inplace.
554              
555             =for bad
556              
557             bessj0 processes bad values.
558             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
559              
560              
561             =cut
562              
563              
564              
565              
566              
567              
568             *bessj0 = \&PDLA::bessj0;
569              
570              
571              
572              
573              
574             =head2 bessj1
575              
576             =for sig
577              
578             Signature: (a(); [o]b())
579              
580             =for ref
581              
582             The regular Bessel function of the first kind, J_n Works inplace.
583              
584             =for bad
585              
586             bessj1 processes bad values.
587             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
588              
589              
590             =cut
591              
592              
593              
594              
595              
596              
597             *bessj1 = \&PDLA::bessj1;
598              
599              
600              
601              
602              
603             =head2 bessy0
604              
605             =for sig
606              
607             Signature: (a(); [o]b())
608              
609             =for ref
610              
611             The regular Bessel function of the second kind, Y_n. Works inplace.
612              
613             =for bad
614              
615             bessy0 processes bad values.
616             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
617              
618              
619             =cut
620              
621              
622              
623              
624              
625              
626             *bessy0 = \&PDLA::bessy0;
627              
628              
629              
630              
631              
632             =head2 bessy1
633              
634             =for sig
635              
636             Signature: (a(); [o]b())
637              
638             =for ref
639              
640             The regular Bessel function of the second kind, Y_n. Works inplace.
641              
642             =for bad
643              
644             bessy1 processes bad values.
645             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
646              
647              
648             =cut
649              
650              
651              
652              
653              
654              
655             *bessy1 = \&PDLA::bessy1;
656              
657              
658              
659              
660              
661             =head2 bessjn
662              
663             =for sig
664              
665             Signature: (a(); int n(); [o]b())
666              
667             =for ref
668              
669             The regular Bessel function of the first kind, J_n
670             .
671             This takes a second int argument which gives the order
672             of the function required.
673             Works inplace.
674              
675             =for bad
676              
677             bessjn processes bad values.
678             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
679              
680              
681             =cut
682              
683              
684              
685              
686              
687              
688             *bessjn = \&PDLA::bessjn;
689              
690              
691              
692              
693              
694             =head2 bessyn
695              
696             =for sig
697              
698             Signature: (a(); int n(); [o]b())
699              
700             =for ref
701              
702             The regular Bessel function of the first kind, Y_n
703             .
704             This takes a second int argument which gives the order
705             of the function required.
706             Works inplace.
707              
708             =for bad
709              
710             bessyn processes bad values.
711             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
712              
713              
714             =cut
715              
716              
717              
718              
719              
720              
721             *bessyn = \&PDLA::bessyn;
722              
723              
724              
725              
726              
727             =head2 lgamma
728              
729             =for sig
730              
731             Signature: (a(); [o]b(); int[o]s())
732              
733             =for ref
734              
735             log gamma function
736              
737             This returns 2 piddles -- the first set gives the log(gamma) values,
738             while the second set, of integer values, gives the sign of the gamma
739             function. This is useful for determining factorials, amongst other
740             things.
741              
742              
743              
744             =for bad
745              
746             lgamma processes bad values.
747             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
748              
749              
750             =cut
751              
752              
753              
754              
755              
756              
757             *lgamma = \&PDLA::lgamma;
758              
759              
760              
761              
762              
763             =head2 badmask
764              
765             =for sig
766              
767             Signature: (a(); b(); [o]c())
768              
769             =for ref
770              
771             Clears all C and C in C<$a> to the corresponding value in C<$b>.
772              
773             badmask can be run with C<$x> inplace:
774              
775             badmask($x->inplace,0);
776             $x->inplace->badmask(0);
777              
778              
779              
780             =for bad
781              
782             If bad values are present, these are also cleared.
783              
784             =cut
785              
786              
787              
788              
789              
790              
791             *badmask = \&PDLA::badmask;
792              
793              
794              
795              
796              
797             =head2 isfinite
798              
799             =for sig
800              
801             Signature: (a(); int [o]mask())
802              
803             =for ref
804              
805             Sets C<$mask> true if C<$a> is not a C or C (either positive or negative). Works inplace.
806              
807             =for bad
808              
809             Bad values are treated as C or C.
810              
811             =cut
812              
813              
814              
815              
816              
817              
818             *isfinite = \&PDLA::isfinite;
819              
820              
821              
822              
823              
824             =head2 erfi
825              
826             =for sig
827              
828             Signature: (a(); [o]b())
829              
830             =for ref
831              
832             The inverse of the error function. Works inplace.
833              
834             =for bad
835              
836             erfi processes bad values.
837             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
838              
839              
840             =cut
841              
842              
843              
844              
845              
846              
847             *erfi = \&PDLA::erfi;
848              
849              
850              
851              
852              
853             =head2 ndtri
854              
855             =for sig
856              
857             Signature: (a(); [o]b())
858              
859             =for ref
860              
861             The value for which the area under the
862             Gaussian probability density function (integrated from
863             minus infinity) is equal to the argument (cf L). Works inplace.
864              
865             =for bad
866              
867             ndtri processes bad values.
868             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
869              
870              
871             =cut
872              
873              
874              
875              
876              
877              
878             *ndtri = \&PDLA::ndtri;
879              
880              
881              
882              
883              
884             =head2 polyroots
885              
886             =for sig
887              
888             Signature: (cr(n); ci(n); [o]rr(m); [o]ri(m))
889              
890              
891              
892             =for ref
893              
894             Complex roots of a complex polynomial, given coefficients in order
895             of decreasing powers.
896              
897             =for usage
898              
899             ($rr, $ri) = polyroots($cr, $ci);
900              
901              
902              
903             =for bad
904              
905             polyroots does not process bad values.
906             It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.
907              
908              
909             =cut
910              
911              
912              
913              
914              
915              
916             *polyroots = \&PDLA::polyroots;
917              
918              
919              
920             ;
921              
922              
923             =head1 BUGS
924              
925             Hasn't been tested on all platforms to ensure Cephes
926             versions are picked up automatically and used correctly.
927              
928             =head1 AUTHOR
929              
930             Copyright (C) R.J.R. Williams 1997 (rjrw@ast.leeds.ac.uk), Karl Glazebrook
931             (kgb@aaoepp.aao.gov.au) and Tuomas J. Lukka (Tuomas.Lukka@helsinki.fi).
932             Portions (C) Craig DeForest 2002 (deforest@boulder.swri.edu).
933              
934             All rights reserved. There is no warranty. You are allowed
935             to redistribute this software / documentation under certain
936             conditions. For details, see the file COPYING in the PDLA
937             distribution. If this file is separated from the PDLA distribution,
938             the PDLA copyright notice should be included in the file.
939              
940             =cut
941              
942              
943              
944              
945              
946             # Exit with OK status
947              
948             1;
949              
950