[libmath-prime-util-perl] 50/55: whitespace and timings

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:53:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.41
in repository libmath-prime-util-perl.

commit 5a2daa4c58a6acd59f2032b7459e84ebce5c3406
Author: Dana Jacobsen <dana at acm.org>
Date:   Fri May 16 15:34:08 2014 -0700

    whitespace and timings
---
 examples/README               | 2 +-
 examples/inverse_totient.pl   | 4 ++--
 examples/project_euler_193.pl | 4 ++--
 examples/project_euler_342.pl | 8 ++++----
 examples/sophie_germain.pl    | 2 +-
 examples/twin_primes.pl       | 2 +-
 lib/Math/Prime/Util.pm        | 2 +-
 lib/Math/Prime/Util/PP.pm     | 1 +
 t/22-aks-prime.t              | 2 +-
 xt/pari-compare.pl            | 2 +-
 10 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/examples/README b/examples/README
index d58f90b..1fe4809 100644
--- a/examples/README
+++ b/examples/README
@@ -23,7 +23,7 @@ twin_primes.pl
 
 
 find_mr_bases.pl
-  
+
   An example using threads to do a parallel search for good deterministic
   bases for a Miller-Rabin test.  This is definitely not the fastest way
   to find these, but it's a decent example of quickly trying out an idea.
diff --git a/examples/inverse_totient.pl b/examples/inverse_totient.pl
index 5e5153a..cbcbf07 100644
--- a/examples/inverse_totient.pl
+++ b/examples/inverse_totient.pl
@@ -28,8 +28,8 @@ sub inverse_euler_phi {
   my $do_bigint = ($N > 2**49);
   if ($do_bigint) {
     # Math::GMPz and Math::GMP are fast.  Math::BigInt::GMP is 10x slower.
-    eval { use Math::GMPz; $do_bigint = "Math::GMPz"; 1; } || 
-    eval { use Math::GMP; $do_bigint = "Math::GMP"; 1; } || 
+    eval { use Math::GMPz; $do_bigint = "Math::GMPz"; 1; } ||
+    eval { use Math::GMP; $do_bigint = "Math::GMP"; 1; } ||
     eval { use Math::BigInt try=>"GMP,Pari"; $do_bigint = "Math::BigInt"; 1; };
     $N = $do_bigint->new("$N");
   }
diff --git a/examples/project_euler_193.pl b/examples/project_euler_193.pl
index 61340cc..6da86d9 100644
--- a/examples/project_euler_193.pl
+++ b/examples/project_euler_193.pl
@@ -9,9 +9,9 @@ my $method = shift || 'mertens';
 # See http://arxiv.org/pdf/1107.4890v1.pdf
 
 #  2.9s  mertens
-#  9.9s  block     
+#  9.8s  block
 # 10.0s  monolithic
-# 36.0s  simple
+# 33.0s  simple
 # lots   brute
 
 my $sum = 0;
diff --git a/examples/project_euler_342.pl b/examples/project_euler_342.pl
index 20afb8a..2ee0c72 100644
--- a/examples/project_euler_342.pl
+++ b/examples/project_euler_342.pl
@@ -19,11 +19,11 @@ use Math::GMPz;
 #
 # TIMING:
 #              10^7    2*10^7   10^8     10^10
-# Clever       0.07s    0.09s   0.24s    5s
-# Brute        5.7s    11.0s   53.9s     5 hours
-# Simple MPU  12.0s    27.3s  174s       1-2 days?
+# Clever       0.06s    0.09s   0.24s    5s
+# Brute        5.0s    10.2s   52.9s     5 hours
+# Simple MPU  10.8s    24.6s  159s       1 day?
 # Simple Pari 13.6s    33.4s  277s       5 days?
-#   
+#
 
 my $limit = shift || 10**10-1;
 my $method = lc(shift || 'clever');
diff --git a/examples/sophie_germain.pl b/examples/sophie_germain.pl
index 971ad3b..cc5039d 100755
--- a/examples/sophie_germain.pl
+++ b/examples/sophie_germain.pl
@@ -71,7 +71,7 @@ if ($method eq 'forprimes') {
 
   # Use Math::NumSeq
   require Math::NumSeq::SophieGermainPrimes;
-  my $seq = Math::NumSeq::SophieGermainPrimes->new; 
+  my $seq = Math::NumSeq::SophieGermainPrimes->new;
   for (1 .. $count) {
     print 0+($seq->next)[1];
   }
diff --git a/examples/twin_primes.pl b/examples/twin_primes.pl
index 65bb875..b5382ed 100755
--- a/examples/twin_primes.pl
+++ b/examples/twin_primes.pl
@@ -31,7 +31,7 @@ my $count = shift || 20;
 # Alternatives:
 # 229.6s   Math::NumSeq::TwinPrimes (Perl 5.19.7, Math::NumSeq 69)
 #   6.6s - perl -MMath::PariInit=primes=65000000 -MMath::Pari=forprime,PARI -E
-#          '$l=2;forprime($x,2,64764841,sub{say $l if $l+2==$x;$l=int("$x");});' 
+#          '$l=2;forprime($x,2,64764841,sub{say $l if $l+2==$x;$l=int("$x");});'
 
 # This speeds things up, but isn't necessary.
 #  Easy but estimates very high:
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 9060bee..f5f8a8f 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -2306,7 +2306,7 @@ Examples of various ways to set your own irand function:
 
   # Math::Random::MTwist.  Fastest RNG by quite a bit.
   use Math::Random::MTwist;
-  prime_set_config(irand => \&Math::Random::MTwist::irand32);
+  prime_set_config(irand => \&Math::Random::MTwist::_irand32);
 
   # Math::Random::Secure.  Uses ISAAC and strong seed methods.
   use Math::Random::Secure;
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 864bbbc..f04a8fb 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -1828,6 +1828,7 @@ sub binomial {
   if ($n >= 0) {  return 0 if $k < 0 || $k > $n;  }
   else         {  return 0 if $k < 0 && $k > $n;  }
   $k = $n - $k if $k < 0;
+
   # 3. Try to do in integer Perl
   my $r;
   if ($n >= 0) {
diff --git a/t/22-aks-prime.t b/t/22-aks-prime.t
index fdba79f..20d51ff 100644
--- a/t/22-aks-prime.t
+++ b/t/22-aks-prime.t
@@ -17,7 +17,7 @@ plan tests =>   6   # range
 
 # Note: AKS testing is *extremely* sparse due to its lack of speed.
 #       This does almost nothing to test whether AKS is working properly.
-# 
+#
 # If you are concerned about AKS correctness, you really need to use
 # the xt/primality-aks.pl test.
 
diff --git a/xt/pari-compare.pl b/xt/pari-compare.pl
index 243319d..be86b4a 100755
--- a/xt/pari-compare.pl
+++ b/xt/pari-compare.pl
@@ -194,7 +194,7 @@ while (1) {
         == jordan_totient(3,$n);
 
   # TODO: exp_mangoldt:
-  # Lambda(n)={ 
+  # Lambda(n)={
   #   v=factor(n);
   #   if(matsize(v)[1]!=1,return(0),return(log(v[1,1])));
   # };

-- 
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