This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git

commit b403a4723aad78eed6b0e9484576e1540689f0f9
Author: aherbert <aherb...@apache.org>
AuthorDate: Tue Feb 21 15:05:32 2023 +0000

    Repeated timings with final implementation
    
    This reflects an update from timings obtained using the simple pow
    (previously named fastPow) and the compensated pow implementation (named
    pow), to a compensated pow (fastPow) and triple-double pow
    implementation, i.e. timings have changed as:
    
    simplePow -> fastPow
    fastPow   -> pow
---
 .../KolmogorovSmirnovDistributionTest.java         | 92 +++++++++++-----------
 1 file changed, 45 insertions(+), 47 deletions(-)

diff --git 
a/commons-statistics-inference/src/test/java/org/apache/commons/statistics/inference/KolmogorovSmirnovDistributionTest.java
 
b/commons-statistics-inference/src/test/java/org/apache/commons/statistics/inference/KolmogorovSmirnovDistributionTest.java
index 3d517f2..7ccb31c 100644
--- 
a/commons-statistics-inference/src/test/java/org/apache/commons/statistics/inference/KolmogorovSmirnovDistributionTest.java
+++ 
b/commons-statistics-inference/src/test/java/org/apache/commons/statistics/inference/KolmogorovSmirnovDistributionTest.java
@@ -427,31 +427,30 @@ class KolmogorovSmirnovDistributionTest {
         "4e-3, 1000001, 1.2630034559846114e-14, 2e-16", // Requires 6.0*n*x 
not 6.0*(n*x)
         "7e-3, 1000001, 2.7357189636541477e-43, 2e-16",
         "1e-2, 1000001, 1.374426245809477e-87, 2e-16",
-        // XXX repeat timings
         // Computed using the double-double implementation (fastPowScaled, 
with timings)
-        "1.0E-4, 1000001, 0.9801333136251243, 6e-8", // 0.634074s
-        "0.001, 1000001, 0.13524481927494492, 6e-8", // 0.504505s
-        "0.0015, 1000001, 0.011097829274951359, 2e-6", // 0.527094s
-        "0.00175, 1000001, 0.0021849210146805925, 3e-6", // 0.512000s
-        "0.002, 1000001, 3.3501117508103243E-4, 6e-6", // 0.505427s
-        "0.0025, 1000001, 3.720346483702557E-6, 2e-5", // 0.488436s
-        "0.003, 1000001, 1.519879017846374E-8, 4e-5", // 0.464440s
-        "0.0035, 1000001, 2.2842024589556203E-11, 7e-5", // 0.457859s
-        "0.004, 1000001, 1.2628687945778359E-14, 2e-4", // 0.440603s
-        "0.007, 1000001, 2.7328605923747603E-43, 2e-3", // 0.383890s
-        "0.01, 1000001, 1.3683915090193192E-87, 5e-3", // 0.348474s
+        "1.0E-4, 1000001, 0.9801333136251243, 6e-8", // 0.724783s
+        "0.001, 1000001, 0.13524481927494492, 6e-8", // 0.709156s
+        "0.0015, 1000001, 0.011097829274951359, 2e-6", // 0.699217s
+        "0.00175, 1000001, 0.0021849210146805925, 3e-6", // 0.696271s
+        "0.002, 1000001, 3.3501117508103243E-4, 6e-6", // 0.679680s
+        "0.0025, 1000001, 3.720346483702557E-6, 2e-5", // 0.658114s
+        "0.003, 1000001, 1.519879017846374E-8, 4e-5", // 0.640645s
+        "0.0035, 1000001, 2.2842024589556203E-11, 7e-5", // 0.629275s
+        "0.004, 1000001, 1.2628687945778359E-14, 2e-4", // 0.613186s
+        "0.007, 1000001, 2.7328605923747603E-43, 2e-3", // 0.534130s
+        "0.01, 1000001, 1.3683915090193192E-87, 5e-3", // 0.487097s
         // Computed using the double-double implementation (powScaled, with 
timings)
-        "1.0E-4, 1000001, 0.9801333136251243, 6e-8", // 0.736033s
-        "0.001, 1000001, 0.13524481927494492, 6e-8", // 0.629389s
-        "0.0015, 1000001, 0.011097829274951359, 2e-6", // 0.596412s
-        "0.00175, 1000001, 0.0021849210146805925, 3e-6", // 0.591704s
-        "0.002, 1000001, 3.350111750810325E-4, 6e-6", // 0.583618s
-        "0.0025, 1000001, 3.720346483702557E-6, 2e-5", // 0.573333s
-        "0.003, 1000001, 1.519879017846374E-8, 4e-5", // 0.554925s
-        "0.0035, 1000001, 2.2842024589556203E-11, 7e-5", // 0.532223s
-        "0.004, 1000001, 1.2628687945778359E-14, 2e-4", // 0.529170s
-        "0.007, 1000001, 2.7328605923747603E-43, 2e-3", // 0.458782s
-        "0.01, 1000001, 1.3683915090193192E-87, 5e-3", // 0.416742s
+        "1.0E-4, 1000001, 0.9801333136251243, 6e-8", // 2.119189s
+        "0.001, 1000001, 0.13524481927494492, 6e-8", // 1.933861s
+        "0.0015, 1000001, 0.011097829274951359, 2e-6", // 1.914388s
+        "0.00175, 1000001, 0.0021849210146805925, 3e-6", // 1.876002s
+        "0.002, 1000001, 3.350111750810325E-4, 6e-6", // 1.811108s
+        "0.0025, 1000001, 3.720346483702557E-6, 2e-5", // 1.781407s
+        "0.003, 1000001, 1.519879017846374E-8, 4e-5", // 1.739311s
+        "0.0035, 1000001, 2.2842024589556203E-11, 7e-5", // 1.697893s
+        "0.004, 1000001, 1.2628687945778359E-14, 2e-4", // 1.659005s
+        "0.007, 1000001, 2.7328605923747603E-43, 2e-3", // 1.452124s
+        "0.01, 1000001, 1.3683915090193192E-87, 5e-3", // 1.338291s
         // n = 10^7
         // Computed using: numpy.exp(-pow(6.0*n*x+1.0, 2)/(18.0*n)):
         "1e-6, 10000000, 0.9999793279914467, 2e-16",
@@ -460,17 +459,17 @@ class KolmogorovSmirnovDistributionTest {
         "8e-4, 10000000, 2.7593005372427517e-06, 2e-16",
         "1e-3, 10000000, 2.059779966512744e-09, 2e-16",
         // Computed using the double-double implementation (fastPowScaled, 
with timings)
-        "1.0E-6, 10000000, 0.9999793335473409, 1e-8", // 5.499433s
-        "2.0E-6, 10000000, 0.9999186699759279, 1e-8", // 5.536423s
-        "2.0E-4, 10000000, 0.4492690623747514, 2e-8", // 5.431289s
-        "8.0E-4, 10000000, 2.7592963140010787E-6, 2e-6", // 4.979058s
-        "0.001, 10000000, 2.059771738419037E-9, 5e-6", // 4.947680s
+        "1.0E-6, 10000000, 0.9999793335473409, 1e-8", // 8.119499s
+        "2.0E-6, 10000000, 0.9999186699759279, 1e-8", // 8.073493s
+        "2.0E-4, 10000000, 0.4492690623747514, 2e-8", // 8.014497s
+        "8.0E-4, 10000000, 2.7592963140010787E-6, 2e-6", // 7.610442s
+        "0.001, 10000000, 2.059771738419037E-9, 5e-6", // 7.383041s
         // Computed using the double-double implementation (powScaled, with 
timings)
-        "1.0E-6, 10000000, 0.9999793335473409, 1e-8", // 6.965408s
-        "2.0E-6, 10000000, 0.9999186699759279, 1e-8", // 6.737508s
-        "2.0E-4, 10000000, 0.4492690623747514, 2e-8", // 6.905447s
-        "8.0E-4, 10000000, 2.7592963140010787E-6, 2e-6", // 6.539566s
-        "0.001, 10000000, 2.059771738419037E-9, 5e-6", // 6.196324s
+        "1.0E-6, 10000000, 0.9999793335473409, 1e-8", // 22.379404s
+        "2.0E-6, 10000000, 0.9999186699759279, 1e-8", // 22.142838s
+        "2.0E-4, 10000000, 0.4492690623747514, 2e-8", // 22.130956s
+        "8.0E-4, 10000000, 2.7592963140010787E-6, 2e-6", // 20.772157s
+        "0.001, 10000000, 2.059771738419037E-9, 5e-6", // 20.374969s
         // n = 2^30
         // Using scipy ksone.sf found an intermediate overflow bug in v1.9.3:
         // https://github.com/scipy/scipy/issues/17775
@@ -482,12 +481,12 @@ class KolmogorovSmirnovDistributionTest {
         "3e-4, 1073741824, 1.1542138829781214e-84, 2e-16",
         "5e-4, 1073741824, 6.914816492890092e-234, 2e-16",
         // Computed using the double-double implementation (fastPowScaled, 
with timings)
-        "1.0E-6, 1073741824, 0.9978541553094259, 6e-11", // 798.105071s
-        "1.0E-5, 1073741824, 0.8067390416850888, 1e-10", // 799.473844s
-        "1.0E-4, 1073741824, 4.715937547939537E-10, 5e-8", // 711.366173s
-        "2.0E-4, 1073741824, 4.946862487288552E-38, 8e-7", // 608.890882s
-        "3.0E-4, 1073741824, 1.154209467628123E-84, 4e-6", // 552.846079s
-        "5.0E-4, 1073741824, 6.914611021963401E-234, 3e-5", // 481.010631s
+        "1.0E-6, 1073741824, 0.9978541553094261, 6e-11", // 1067.231777s
+        "1.0E-5, 1073741824, 0.806739041685089, 1e-10", // 1066.338235s
+        "1.0E-4, 1073741824, 4.715937547939542E-10, 5e-8", // 974.019864s
+        "2.0E-4, 1073741824, 4.946862487288558E-38, 8e-7", // 841.211851s
+        "3.0E-4, 1073741824, 1.1542094676281237E-84, 4e-6", // 761.320554s
+        "5.0E-4, 1073741824, 6.914611021963405E-234, 3e-5", // 681.080892s
     })
     void testOneSFAsymptotic(double x, int n, double p, double eps) {
         final double p1 = KolmogorovSmirnovDistribution.One.sf(x, n);
@@ -576,13 +575,12 @@ class KolmogorovSmirnovDistributionTest {
         "8e-3, 123456, 1.3636949699766825e-07, 2e-16",
         "3e-2, 123456, 2.9034013257947777e-97, 2e-16",
         // Close to the asymptotic limit (1e6).
-        // XXX repeat timings
         // Timings for the fastPowScaled.
-        "1e-6, 999000, 0.9999972844391667, 2e-16", // 0.000033s
-        "1e-5, 999000, 0.9997935546914299, 2e-15", // 0.586500s
-        "1e-3, 999000, 0.13551585067528177, 2e-15", // 0.526206s
-        "1.5e-3, 999000, 0.011147932231639623, 2e-15", // 0.510105s
-        "1e-2, 999000, 1.671698905805492e-87, 2e-15", // 0.358407s
+        "1e-6, 999000, 0.9999972844391667, 2e-16", // 0.000114s
+        "1e-5, 999000, 0.9997935546914299, 2e-15", // 0.701445s
+        "1e-3, 999000, 0.13551585067528177, 2e-15", // 0.684693s
+        "1.5e-3, 999000, 0.011147932231639623, 2e-15", // 0.680678s
+        "1e-2, 999000, 1.671698905805492e-87, 2e-15", // 0.485230s
         // Test cases requiring careful computation of
         // k = floor(n*x), alpha = nx - k; x = (k+alpha)/n with 0 <= alpha < 1
         // 0.8e-5 * 5e5 = 4.0, actually 3.99999999999999897195950...
@@ -1010,7 +1008,7 @@ class KolmogorovSmirnovDistributionTest {
         // Debugging
         final long start = System.nanoTime();
         final double p = KolmogorovSmirnovDistribution.One.sf(x, n, power);
-        //printf("\"%s, %d, %s\", // %.6fs%n", x, n, p, (System.nanoTime() - 
start) * 1e-9);
+        //TestUtils.printf("\"%s, %d, %s\", // %.6fs%n", x, n, p, 
(System.nanoTime() - start) * 1e-9);
         return p;
     }
 
@@ -1045,7 +1043,7 @@ class KolmogorovSmirnovDistributionTest {
         // Debugging
         final long start = System.nanoTime();
         final double p = sf(x, n, mc);
-        //printf("\"%s, %d, %s\", // %.6fs%n", x, n, p, (System.nanoTime() - 
start) * 1e-9);
+        //TestUtils.printf("\"%s, %d, %s\", // %.6fs%n", x, n, p, 
(System.nanoTime() - start) * 1e-9);
         return p;
     }
 

Reply via email to