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 a1bd930c649d4becb42be7205c3f8cdeee865477
Author: Dana Jacobsen <d...@acm.org>
Date:   Sun Jan 12 16:05:37 2014 -0800

    Minor changes to examples
---
 examples/abundant.pl              |  0
 examples/bench-nthprime.pl        |  4 ++--
 examples/bench-primecount.pl      | 20 +++++++++++---------
 examples/test-factor-gnufactor.pl |  6 +++---
 lib/Math/Prime/Util/PP.pm         |  8 +++-----
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/examples/abundant.pl b/examples/abundant.pl
old mode 100644
new mode 100755
diff --git a/examples/bench-nthprime.pl b/examples/bench-nthprime.pl
index 7656b95..5ecee6c 100755
--- a/examples/bench-nthprime.pl
+++ b/examples/bench-nthprime.pl
@@ -11,10 +11,10 @@ my $count = shift || -5;
 
 srand(29);
 my @darray;
-push @darray, [gendigits($_,int(5400/($_*$_*$_)))]  for (2 .. 10);
+push @darray, [gendigits($_,int(5400/($_*$_*$_)))]  for 2 .. 13;
 
 my $sum;
-foreach my $digits (3 .. 10) {
+foreach my $digits (3 .. 12) {
   my @digarray = @{$darray[$digits-2]};
   my $numitems = scalar @digarray;
   my $timing = cmpthese(
diff --git a/examples/bench-primecount.pl b/examples/bench-primecount.pl
index 7298816..b03d1ac 100755
--- a/examples/bench-primecount.pl
+++ b/examples/bench-primecount.pl
@@ -15,16 +15,17 @@ my $sum;
 
 print "Direct sieving:\n";
 cmpthese($count,{
-    ' 2' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_prime_count($_) for @{$darray[2-2]} },
-    ' 3' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_prime_count($_) for @{$darray[3-2]} },
-    ' 4' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_prime_count($_) for @{$darray[4-2]} },
-    ' 5' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_prime_count($_) for @{$darray[5-2]} },
-    ' 6' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_prime_count($_) for @{$darray[6-2]} },
-    ' 7' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_prime_count($_) for @{$darray[7-2]} },
-    ' 8' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_prime_count($_) for @{$darray[8-2]} },
-    #' 9' => sub { $sum += Math::Prime::Util::_XS_prime_count($_) for 
@{$darray[9-2]} },
-    #'10' => sub { $sum += Math::Prime::Util::_XS_prime_count($_) for 
@{$darray[10-2]} },
+    ' 2' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_segment_pi($_) for @{$darray[2-2]} },
+    ' 3' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_segment_pi($_) for @{$darray[3-2]} },
+    ' 4' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_segment_pi($_) for @{$darray[4-2]} },
+    ' 5' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_segment_pi($_) for @{$darray[5-2]} },
+    ' 6' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_segment_pi($_) for @{$darray[6-2]} },
+    ' 7' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_segment_pi($_) for @{$darray[7-2]} },
+    ' 8' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_segment_pi($_) for @{$darray[8-2]} },
+    #' 9' => sub { $sum += Math::Prime::Util::_XS_segment_pi($_) for 
@{$darray[9-2]} },
+    #'10' => sub { $sum += Math::Prime::Util::_XS_segment_pi($_) for 
@{$darray[10-2]} },
 });
+if (0) {
 print "\n";
 print "Direct Lehmer:\n";
 cmpthese($count,{
@@ -38,6 +39,7 @@ cmpthese($count,{
     ' 9' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_lehmer_pi($_) for @{$darray[9-2]} },
     '10' => sub { prime_memfree(); $sum += 
Math::Prime::Util::_XS_lehmer_pi($_) for @{$darray[10-2]} },
 });
+}
 print "\n";
 print "Direct LMO:\n";
 cmpthese($count,{
diff --git a/examples/test-factor-gnufactor.pl 
b/examples/test-factor-gnufactor.pl
index d92eb8e..229461e 100755
--- a/examples/test-factor-gnufactor.pl
+++ b/examples/test-factor-gnufactor.pl
@@ -117,9 +117,9 @@ sub test_array {
   # We should ignore the small digits, since we're comparing direct
   # Perl functions with multiple command line invocations.  It really
   # doesn't make sense until we're over 1ms per number.
-  printf "  MPU:%8.3f ms", (($mpusec*1000) / scalar @narray);
-  printf("  GNU:%8.3f ms", (($gnusec*1000) / scalar @narray)) if $do_gnu;
-  printf("  Pari:%8.3f ms", (($parisec*1000) / scalar @narray)) if $do_pari;
+  printf "  MPU:%8.4f ms", (($mpusec*1000) / scalar @narray);
+  printf("  GNU:%8.4f ms", (($gnusec*1000) / scalar @narray)) if $do_gnu;
+  printf("  Pari:%8.4f ms", (($parisec*1000) / scalar @narray)) if $do_pari;
   print "\n";
 }
 
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index b1bdead..ca8fbbb 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -1249,12 +1249,10 @@ sub znorder {
   return $k;
 }
 
+# This is just a stupid brute force search.
 sub znlog {
-  my($a,$g,$p) = @_;
-  # This is just a stupid brute force search.
-  $a = Math::BigInt->new("$a") unless ref($a) eq 'Math::BigInt';
-  $g = Math::BigInt->new("$g") unless ref($g) eq 'Math::BigInt';
-  $p = Math::BigInt->new("$p") unless ref($p) eq 'Math::BigInt';
+  my ($a,$g,$p) =
+    map { ref($_) eq 'Math::BigInt' ? $_ : Math::BigInt->new("$_") } @_;
   for (my $n = BONE->copy; $n < $p; $n->binc) {
     my $t = $g->copy->bmodpow($n, $p);
     if ($t == $a) {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to