[libmath-prime-util-perl] 124/181: Try to use Pari in benchmark, but silently remove if not available
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:51:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.36
in repository libmath-prime-util-perl.
commit 6b634d0f2c0cbbce38b940d4243639b746385e94
Author: Dana Jacobsen <dana at acm.org>
Date: Mon Jan 6 09:48:59 2014 -0800
Try to use Pari in benchmark, but silently remove if not available
---
examples/test-factor-gnufactor.pl | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/examples/test-factor-gnufactor.pl b/examples/test-factor-gnufactor.pl
index 2e3b43e..d92eb8e 100755
--- a/examples/test-factor-gnufactor.pl
+++ b/examples/test-factor-gnufactor.pl
@@ -2,7 +2,6 @@
use strict;
use warnings;
use Math::Prime::Util qw/factor/;
-use Math::Pari qw/factorint/;
use File::Temp qw/tempfile/;
use Math::BigInt try => 'GMP,Pari';
use Config;
@@ -34,7 +33,11 @@ my $num = 1000;
my $do_gnu = 1;
my $do_pari = 1;
-my $use_mpu_factor_script = 1;
+my $use_mpu_factor_script = 0;
+
+if ($do_pari) {
+ $do_pari = 0 unless eval { require Math::Pari; Math::Pari->import(); 1; };
+}
my $rgen = sub {
my $range = shift;
@@ -180,7 +183,7 @@ sub pari_factors {
my @piarray;
foreach my $n (@_) {
my @factors;
- my ($pn,$pc) = @{factorint($n)};
+ my ($pn,$pc) = @{Math::Pari::factorint($n)};
# Map the Math::Pari objects returned into Math::BigInts, because Pari will
# throw a hissy fit later when we try to compare them to anything else.
push @piarray, [ $n, map { (Math::BigInt->new($pn->[$_])) x $pc->[$_] } (0 .. $#$pn) ];
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git
More information about the Pkg-perl-cvs-commits
mailing list