Subject: | suggested minor cleanup for PDL-2.007 |
In verifying that PDL::FuncND against the PDL-2.007 pre0
I made a few changes to reduce the import requirements
and to use PDL::Constants rather than Math::Trig. The
motivation is for the eventual regularization of the PDL
import routines to allow for specific selection of routines
to import or not.
I made a few changes to reduce the import requirements
and to use PDL::Constants rather than Math::Trig. The
motivation is for the eventual regularization of the PDL
import routines to allow for specific selection of routines
to import or not.
Subject: | patch-pdl-funcnd.txt |
--- lib/PDL/FuncND.pm 2012-06-19 11:51:58.000000000 -0400
+++ blib/lib/PDL/FuncND.pm 2013-09-21 11:47:11.091176200 -0400
@@ -24,14 +24,12 @@
use strict;
use warnings;
-use Math::Trig qw[ pi ];
-
-use PDL;
-use PDL::Math;
-use PDL::Transform qw[];
-use PDL::Options qw[ iparse ];
-
-use Math::Trig qw[ pi ];
+use PDL::LiteF;
+use PDL::Constants qw( PI );
+use PDL::Math qw( lgamma );
+use PDL::MatrixOps qw( determinant identity );
+use PDL::Transform qw();
+use PDL::Options qw( iparse );
use base 'PDL::Exporter';
@@ -371,7 +369,7 @@
my $pdf =
_gamma((1+$k)/2)
/ ( _gamma(1/2)
- * pi**($k/2)
+ * PI**($k/2)
* sqrt(determinant( $par{scale} ))
* (1 + $d2) ** ( (1+$k)/2 )
);
@@ -541,7 +539,7 @@
{ squared => 1,
( defined $par{center} ? (center => $par{center}) : () )
});
- my $log_pdf = -( $par{ndims} * log(2 * pi)
+ my $log_pdf = -( $par{ndims} * log(2 * PI)
+ log( determinant( $par{scale} ))
+ $d2
)/2;